:root {
  --resource-ink: var(--puk-theme-text, #1f2933);
  --resource-muted: var(--puk-theme-muted, #5f6f6b);
  --resource-brand: #1fa37a;
  --resource-brand-dark: #157a5c;
  --resource-soft: var(--puk-theme-surface, #f4faf7);
  --resource-border: var(--puk-theme-border, #e2ece7);
  --resource-page-width: 1120px;
  --resource-reading-width: 900px;
}

body.public-resource-page {
  background: var(--puk-theme-surface, #fff) !important;
  color: var(--puk-theme-text, var(--resource-ink)) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  overflow-x: hidden;
}

.public-resource-page *,
.public-resource-page *::before,
.public-resource-page *::after {
  box-sizing: border-box;
}

.resource-hub,
.module-index,
.resource-page {
  margin: 0 auto;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 4vw, 2rem) clamp(2.5rem, 5vw, 4rem);
  width: 100%;
}

.resource-hub { max-width: var(--resource-page-width); }
.module-index,
.resource-page { max-width: var(--resource-reading-width); }

.resource-hub__header,
.module-index__header {
  max-width: 48rem;
}

.resource-hub h1,
.module-index h1 {
  color: var(--puk-theme-text, var(--resource-ink));
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 .65rem;
  overflow-wrap: anywhere;
}

.resource-hub .intro,
.module-intro {
  color: var(--puk-theme-muted, var(--resource-muted));
  font-size: 17px;
  line-height: 1.65;
  margin: 0 0 1rem;
  max-width: 46rem;
}

.resource-hub a,
.module-index a,
.resource-page > :not(.resource-content) a {
  text-underline-offset: .18em;
}

.board-selector {
  background: var(--puk-theme-surface, var(--resource-soft));
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 999px;
  display: inline-flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  max-width: 100%;
  padding: .25rem;
}

.board-selector a {
  align-items: center;
  border-radius: 999px;
  color: var(--puk-theme-text, var(--resource-ink));
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: .4rem;
  justify-content: center;
  min-height: 44px;
  padding: .45rem .9rem;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.board-selector a:hover { background: var(--puk-theme-success-soft, var(--resource-border)); }
.board-selector a:focus-visible {
  outline: 3px solid var(--puk-theme-border, rgba(31, 163, 122, .28));
  outline-offset: 2px;
}
.board-selector a.active {
  background: var(--puk-theme-action, var(--resource-brand));
  color: var(--puk-theme-on-action, #fff);
}
.board-selector .board-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  opacity: .9;
  text-transform: uppercase;
}

.trust-strip {
  color: var(--puk-theme-text, var(--resource-ink));
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: .5rem 1rem;
  margin: 0 0 clamp(1.5rem, 3vw, 2rem);
}
.trust-strip span {
  align-items: flex-start;
  display: inline-flex;
  gap: .4rem;
}
.trust-strip span::before {
  color: var(--puk-theme-accent, var(--resource-brand));
  content: "\2713";
  font-weight: 800;
}

.paper-hub-banner,
.tools-banner {
  background: var(--puk-theme-surface, var(--resource-soft));
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 14px;
  padding: clamp(1rem, 2.5vw, 1.4rem);
}
.paper-hub-banner { margin: 1.5rem 0 2rem; }
.tools-banner { margin-top: 2rem; }
.paper-hub-banner h2,
.tools-banner h2 {
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 .55rem;
}
.paper-hub-banner p,
.tools-banner p {
  color: var(--puk-theme-muted, var(--resource-muted));
  font-size: 15px;
  margin: 0 0 .75rem;
}
.paper-hub-banner ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.paper-hub-banner a {
  background: var(--puk-theme-surface, #fff);
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 8px;
  color: var(--puk-theme-accent, var(--resource-brand-dark));
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  min-height: 42px;
  padding: .5rem .8rem;
  text-decoration: none;
}
.paper-hub-banner a:hover {
  background: var(--puk-theme-action, var(--resource-brand));
  border-color: var(--puk-theme-accent, var(--resource-brand));
  color: var(--puk-theme-on-action, #fff);
}

.module-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.module-section {
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 14px;
  min-width: 0;
  padding: 1rem;
}
.module-section h2 {
  border-bottom: 2px solid var(--puk-theme-accent, var(--resource-brand));
  display: inline-block;
  font-size: 17px;
  line-height: 1.35;
  margin: 0 0 .75rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding-bottom: .3rem;
}
.module-section h2 a { color: inherit; text-decoration: none; }
.module-section h2 a:hover { color: var(--puk-theme-accent, var(--resource-brand-dark)); }

.resource-list {
  display: grid;
  gap: .5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.resource-list li {
  background: var(--puk-theme-surface, var(--resource-soft));
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 9px;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.resource-list li:hover {
  border-color: var(--puk-theme-border, #b8d8c8);
  box-shadow: 0 5px 14px rgba(31, 163, 122, .1);
  transform: translateY(-1px);
}
.resource-list a {
  align-items: center;
  color: var(--puk-theme-text, var(--resource-ink));
  display: flex;
  font-size: 15px;
  font-weight: 650;
  gap: .65rem;
  justify-content: space-between;
  line-height: 1.4;
  min-height: 48px;
  min-width: 0;
  padding: .7rem .8rem;
  text-decoration: none;
}
.resource-list a:hover { color: var(--puk-theme-accent, var(--resource-brand-dark)); }
.resource-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.resource-type,
.resource-type-badge {
  background: var(--puk-theme-action, var(--resource-brand));
  border-radius: 999px;
  color: var(--puk-theme-on-action, #fff);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  max-width: 12rem;
  overflow: hidden;
  padding: .25rem .55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-banner a,
.resource-hub__footer a,
.module-index .breadcrumb a,
.module-index .back-link {
  color: var(--puk-theme-accent, var(--resource-brand-dark));
  font-weight: 700;
}
.resource-hub__footer {
  color: var(--puk-theme-muted, var(--resource-muted));
  font-size: 15px;
  margin: 1.75rem 0 0;
}

.module-index .breadcrumb,
.resource-breadcrumb,
.resource-hub__breadcrumb {
  color: var(--puk-theme-muted, var(--resource-muted));
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  overflow-wrap: anywhere;
}
.module-index .breadcrumb a,
.resource-breadcrumb a,
.resource-hub__breadcrumb a { color: var(--puk-theme-accent, var(--resource-brand-dark)); font-weight: 700; }
.topic-heading {
  font-size: 16px;
  margin: 0 0 .55rem;
}
.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.topic-list li {
  background: var(--puk-theme-surface, var(--resource-soft));
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 999px;
  color: var(--puk-theme-muted, #374151);
  font-size: 14px;
  line-height: 1.35;
  padding: .4rem .75rem;
}
.resource-meta {
  align-items: center;
  color: var(--puk-theme-muted, var(--resource-muted));
  display: flex;
  flex: 0 1 auto;
  font-size: 13px;
  font-weight: 400;
  gap: .5rem;
  min-width: 0;
}
.resource-topic {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-state {
  background: var(--puk-theme-surface, var(--resource-soft));
  border: 1px solid var(--puk-theme-border, var(--resource-border));
  border-radius: 12px;
  color: var(--puk-theme-muted, var(--resource-muted));
  padding: 2rem 1rem;
  text-align: center;
}
.back-link { display: inline-block; margin-top: 1.5rem; text-decoration: none; }
.module-index__footer {
  color: var(--puk-theme-muted, var(--resource-muted));
  font-size: 14px;
  margin: .75rem 0 0;
}

.resource-home-logo {
  display: inline-block;
  margin-bottom: .75rem;
}
.resource-home-logo img {
  height: 36px;
  max-width: 100%;
  opacity: .85;
  width: auto;
}
.resource-content {
  line-height: 1.65;
  min-width: 0;
  overflow-wrap: break-word;
}

/* Stored resources are legacy full HTML documents. These high-specificity,
   important guardrails stop their unscoped viewport CSS escaping the article. */
.public-resource-detail .resource-content h1 {
  font-size: 40px !important;
  letter-spacing: -.025em !important;
  line-height: 1.08 !important;
  max-width: 52rem !important;
  overflow-wrap: anywhere;
}
.public-resource-detail .resource-content h2 {
  font-size: 26px !important;
  line-height: 1.2 !important;
}
.public-resource-detail .resource-content h3 {
  font-size: 19px !important;
  line-height: 1.3 !important;
}
/* Some older site-wide styles target every list item with viewport-based
   typography. Learning-resource lists must keep a readable, fixed size on
   wide desktops as well as mobile devices. */
.public-resource-detail .resource-content ul > li,
.public-resource-detail .resource-content ol > li {
  display: list-item !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
  padding: 0 !important;
}
.public-resource-detail .resource-content ul:not(.check-list) > li {
  list-style: inherit !important;
}
.public-resource-detail .resource-content .check-list > li {
  display: block !important;
  list-style: none !important;
  padding: 10px 12px 10px 39px !important;
}
.public-resource-detail .resource-content li > strong,
.public-resource-detail .resource-content li > b {
  font-weight: 700 !important;
}
.public-resource-detail .resource-content .hero {
  min-height: 0 !important;
  padding-block: clamp(1.5rem, 5vw, 3rem) !important;
}
.public-resource-detail .resource-content img,
.public-resource-detail .resource-content svg,
.public-resource-detail .resource-content video,
.public-resource-detail .resource-content iframe {
  height: auto;
  max-width: 100% !important;
}
.public-resource-detail .resource-content canvas {
  max-width: 100% !important;
}
.public-resource-detail .resource-content iframe {
  aspect-ratio: 16 / 9;
  border: 0;
  width: 100%;
}
.public-resource-detail .resource-content pre,
.public-resource-detail .resource-content .equation,
.public-resource-detail .resource-content .answer-line,
.public-resource-detail .resource-content .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.public-resource-detail .resource-content table { min-width: 34rem; }
.public-resource-detail .resource-content button,
.public-resource-detail .resource-content input,
.public-resource-detail .resource-content select,
.public-resource-detail .resource-content textarea { max-width: 100%; }
.public-resource-detail .resource-content button,
.public-resource-detail .resource-content [role="button"] { min-height: 44px; }

.author-review-box {
  background: var(--puk-theme-surface, var(--resource-soft)) !important;
  border: 1px solid var(--puk-theme-border, var(--resource-border)) !important;
  border-radius: 12px !important;
  color: var(--puk-theme-muted, #374151) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  margin: 1.75rem 0 !important;
  padding: 1rem 1.25rem !important;
}
.author-review-box p { margin: .35rem 0 !important; }
.related-resources {
  border-top: 1px solid var(--puk-theme-border, var(--resource-border));
  margin-top: 2rem;
  padding-top: 1.5rem;
}
.related-resources h2 {
  font-family: inherit !important;
  font-size: 22px !important;
  line-height: 1.3 !important;
  margin: 0 0 1rem !important;
}
.related-resources h3 {
  font-family: inherit !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  margin: 1rem 0 .5rem !important;
}
.related-resources ul {
  display: grid;
  gap: .55rem;
  list-style: none;
  margin: 0 0 1rem !important;
  padding: 0 !important;
}
.related-resources li { margin: 0 !important; }
.related-resources a { color: var(--puk-theme-accent, var(--resource-brand-dark)) !important; font-weight: 650; }
.resource-footer {
  border-top: 1px solid var(--puk-theme-border, var(--resource-border));
  color: var(--puk-theme-muted, var(--resource-muted)) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  margin-top: 2rem;
  padding-top: 1rem;
}
.resource-footer p { margin: 0 0 .75rem !important; }
.resource-footer a { color: var(--puk-theme-accent, var(--resource-brand-dark)) !important; }

@media (max-width: 760px) {
  .resource-hub h1,
  .module-index h1 { font-size: 28px; }
  .resource-hub .intro,
  .module-intro { font-size: 16px; }
  .module-grid { grid-template-columns: 1fr; }
  .module-section { padding: .85rem; }
  .resource-list a { align-items: flex-start; }
  .resource-meta { flex-direction: column; align-items: flex-end; }
  .resource-topic { display: none; }
  .public-resource-detail .resource-content h1 { font-size: 32px !important; }
  .public-resource-detail .resource-content h2 { font-size: 22px !important; }
  .public-resource-detail .resource-content h3 { font-size: 18px !important; }
  .public-resource-detail .resource-content .grid,
  .public-resource-detail .resource-content .practice-grid,
  .public-resource-detail .resource-content .learning-route,
  .public-resource-detail .resource-content .equation-options {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 420px) {
  .board-selector { display: flex; width: 100%; }
  .board-selector a { flex: 1 1 0; padding-inline: .55rem; }
  .trust-strip { display: grid; }
  .resource-type,
  .resource-type-badge { max-width: 8.5rem; }
  .paper-hub-banner a { flex: 1 1 auto; }
  .resource-page { padding-inline: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .resource-list li { transition: none; }
  .resource-list li:hover { transform: none; }
}
