:root {
  /* Larger base type for projection/readability */
  font-size: 125%; /* ~20px if browser default is 16px */
  color-scheme: light;
  --bg: #eef4e8;
  --surface: #f8fbf4;
  --surface-strong: #ffffff;
  --text: #163221;
  --muted: #476350;
  --line: #cdddc8;
  --accent: #85b24a;
  --accent-deep: #3e6f3f;
  --accent-soft: #e4efd7;
  --shadow: rgba(27, 58, 35, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #f6fbef 0, #eef4e8 38%, #e5eee0 100%);
  color: var(--text);
}

a {
  color: var(--accent-deep);
}

img {
  max-width: 100%;
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.page-shell-detail {
  padding-top: 32px;
}

.hero,
.objective-section,
.worksheet-panel,
.objective-card,
.objective-nav {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 44px var(--shadow);
}

.hero {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  padding: 10px 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: 0 10px 26px rgba(27, 58, 35, 0.08);
  background: linear-gradient(135deg, rgba(247, 251, 241, 0.97) 0%, rgba(237, 245, 227, 0.97) 52%, rgba(227, 238, 214, 0.97) 100%);
  backdrop-filter: blur(10px);
}

.hero-subpage {
  position: relative;
}

.hero-inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hero-logo {
  width: clamp(42px, 5vw, 56px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 10px rgba(39, 79, 42, 0.12));
}

.hero-copy {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  line-height: 1.05;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.lead,
.card-copy,
.worksheet-panel-head p,
.detail-group p,
.question-diagram-note {
  color: var(--muted);
}

.te-reo-panel {
  background: linear-gradient(180deg, #f7fbf1 0%, #eef6e6 100%);
}

.notes-panel {
  background: linear-gradient(180deg, #fbfcf8 0%, #f3f6ee 100%);
}

.notes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notes-html {
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  background: #fcfbf7;
  border: 1.5px solid #000;
  box-shadow: 0 10px 20px rgba(36, 75, 44, 0.04);
}

.notes-html::before {
  content: none;
  display: none;
}

.notes-html > .notes-columns,
.notes-html > .notes-box,
.notes-html > .notes-section-title {
  margin-top: 14px;
}

.notes-html > :first-child {
  margin-top: 0;
}

.notes-html .notes-columns {
  display: block;
  column-count: 2;
  column-gap: 14px;
}

.notes-html .notes-columns > div {
  break-inside: avoid;
  margin-bottom: 14px;
  border: 1.5px solid #000000;
  border-radius: 16px;
  padding: 5px 6px;
  background: #fffdf9;
}

.notes-html .notes-columns + .notes-columns {
  margin-top: 2.5rem;
}

.notes-html .notes-columns + .notes-columns::before {
  content: "";
  display: block;
  column-span: all;
  height: 14px;
  background: var(--accent-soft);
  border-radius: 8px;
  margin: 0 0 2.5rem;
  width: 100%;
}

.notes-html .notes-columns > div > :first-child {
  margin-top: 0 !important;
}

.notes-html .notes-columns > div > :last-child {
  margin-bottom: 0 !important;
}

.notes-html .notes-section-title {
  margin: 0 0 4px;
  color: #244b2c;
  font-weight: 900;
  font-size: 0.98rem;
}

.notes-html .notes-key-idea {
  border: 1.5px solid #000000;
  border-radius: 14px;
  padding: 10px 11px;
  margin: 0 0 10px;
  background: #edf4e6;
  color: #163221;
}

.notes-html .notes-example-block,
.notes-html .notes-common-block,
.notes-html .notes-try-block {
  margin: 0;
  color: #163221;
}

.notes-html .notes-columns > div.notes-common-block,
.notes-html .notes-columns > div.notes-try-block,
.notes-html > .notes-common-block,
.notes-html > .notes-try-block {
  border: 1.5px solid #000000;
  border-radius: 14px;
  padding: 10px 11px;
  background: #fffdf9;
}

.notes-html .notes-example-block + .notes-example-block,
.notes-html .notes-common-block + .notes-try-block,
.notes-html .notes-try-block + .notes-common-block {
  margin-top: 8px;
}

.notes-html > .notes-common-block,
.notes-html > .notes-try-block {
  border: 1.5px solid #000000;
  border-radius: 14px;
  padding: 10px 11px;
  background: #fffdf9;
}

.notes-html .notes-columns > div.notes-common-block,
.notes-html > .notes-common-block {
  background: #fbf2f3;
  border-color: #8f2f36;
}

.notes-html .notes-key-idea strong,
.notes-html .notes-common-block strong,
.notes-html .notes-try-block strong,
.notes-html .notes-example-title {
  display: block;
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #244b2c;
}

.notes-html .notes-common-block strong {
  color: #8f2f36;
}

.notes-html .notes-example-title p,
.notes-html .notes-common-block strong p,
.notes-html .notes-try-block strong p,
.notes-html .notes-key-idea strong p,
.notes-html .notes-section-title p {
  margin: 0;
  color: inherit;
}

.notes-html .notes-list,
.notes-html .notes-try {
  padding-left: 1rem;
  margin: 0;
}

.notes-html .notes-list li,
.notes-html .notes-try li,
.notes-html .notes-steps li {
  margin-bottom: 2px;
}

.notes-html .notes-list li:last-child,
.notes-html .notes-try li:last-child,
.notes-html .notes-steps li:last-child {
  margin-bottom: 0;
}

.notes-html .notes-list li p,
.notes-html .notes-try li p,
.notes-html .notes-steps li p {
  margin: 0;
}

.notes-html .notes-steps {
  list-style: none;
  padding-left: 0;
  margin-top: 0;
}

.notes-html .notes-steps li {
  margin-bottom: 4px;
}

.notes-html .notes-steps li::before {
  content: counter(list-item) ". ";
  font-weight: 700;
}

.notes-html .notes-list {
  list-style-type: disclosure-closed;
}

.notes-html .notes-list li::marker,
.notes-html .notes-try li::marker {
  color: #244b2c;
}

.notes-html p,
.notes-html li,
.notes-html ol,
.notes-html ul {
  color: #163221;
}

.notes-html p {
  margin: 0 0 4px;
  line-height: 1.18;
}

.notes-html p:last-child,
.notes-html ol:last-child,
.notes-html ul:last-child {
  margin-bottom: 0;
}

.notes-html .notes-page-split {
  height: 6px;
  background: #5d8a56;
  border-radius: 999px;
  margin: 10px 0;
}

.notes-missing {
  color: var(--muted);
}

/* Removed: .te-reo-grid, .te-reo-card, .te-reo-meta, .te-reo-word, .te-reo-link
   — te reo terms now display as PDF preview only */

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent-deep);
  border-radius: 14px;
  background: var(--accent-deep);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.button-secondary {
  background: white;
  color: var(--accent-deep);
}

.button-disabled {
  border-color: var(--line);
  color: var(--muted);
  background: #f4f7f0;
  pointer-events: none;
}

.button-download-all {
  border: 2px solid var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.9em;
  white-space: nowrap;
}

.header-menu {
  position: relative;
  margin-left: auto;
}

.header-menu summary {
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 48px;
  height: 48px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.header-menu summary::-webkit-details-marker {
  display: none;
}

.header-menu summary span {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-deep);
}

.header-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 280px;
  max-height: min(70vh, 640px);
  overflow: auto;
  padding: 10px;
  background: rgba(248, 251, 244, 0.98);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 44px var(--shadow);
}

.header-dropdown-group + .header-dropdown-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.header-dropdown-heading {
  padding: 8px 14px 6px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-dropdown a,
.objective-nav a {
  display: block;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--accent-deep);
  font-weight: 700;
}

.header-dropdown a:hover,
.objective-nav a:hover {
  background: var(--accent-soft);
}

.objective-section,
.worksheet-panel,
.objective-card,
.objective-nav {
  padding: 24px;
}

.intro-section,
.detail-hero,
.objective-nav,
.worksheet-panel,
.objective-card-grid,
.worksheet-panel + .worksheet-panel,
.topic-group + .topic-group {
  margin-top: 0;
  border-top: 1px solid var(--line);
}

/* Topic accordion */
.topic-group {
  border-bottom: 1px solid var(--line);
}

.topic-group[open] {
  padding-bottom: 20px;
}

.topic-group-header {
  margin: 0;
  padding: 16px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  list-style: none;
}

.topic-group-header::-webkit-details-marker {
  display: none;
}

.topic-group-header::before {
  content: '▶';
  font-size: 0.7em;
  color: var(--accent-deep);
  margin-right: 10px;
  transition: transform 0.2s;
}

.topic-group[open] > .topic-group-header::before {
  transform: rotate(90deg);
}

.topic-group-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 1;
}

.topic-group-count {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.intro-grid,
.detail-grid,
.objective-card-grid {
  display: grid;
  gap: 18px;
}

.intro-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.9fr);
  align-items: center;
}

.intro-pills,
.detail-badges,
.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 700;
}

.topic-group-header {
  margin: 24px 0 12px;
}

.topic-group-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--muted);
}

.objective-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}

.objective-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
  height: 100%;
  background: linear-gradient(180deg, #fcfef9 0%, #f3f8ee 100%);
}

.objective-card-top {
  min-height: 0;
}

.objective-card-top h2 {
  margin-bottom: 8px;
  font-size: 1.28rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.objective-debug-code {
  display: none;
  margin-left: auto;
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.8;
}

html[data-debug="1"] .objective-debug-code {
  display: inline-block;
}

.objective-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
  align-self: end;
}

.objective-card-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mini-link {
  font-size: 0.92rem;
  font-weight: 700;
}

.mini-link-muted {
  color: var(--muted);
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-group h3 {
  margin-bottom: 10px;
}

.chip-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list li {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
}

.objective-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.worksheet-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.scaffold-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scaffold-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.scaffold-koru-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scaffold-koru {
  width: 18px;
  height: auto;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(39, 79, 42, 0.12));
}

.blank-line {
  display: inline-block;
  min-width: 7rem;
  border-bottom: 2px solid var(--line);
  transform: translateY(-0.1em);
}

.question-diagram-note {
  font-style: italic;
}

.web-diagram-wrap {
  margin-top: 0.8rem;
}

.web-diagram {
  display: block;
  max-width: min(100%, 760px);
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

/* Detail page panels */
.lo-panel {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 44px var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border-top: 5px solid var(--card-accent, #85b24a);
}

.lo-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.lo-panel-head h3 {
  margin: 0;
}

.panel-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.lo-details {
  background: linear-gradient(180deg, #f7fbf1 0%, #eef6e6 100%);
}

.te-reo-panel {
  background: linear-gradient(180deg, #f7fbf1 0%, #eef6e6 100%);
}

.notes-panel {
  background: linear-gradient(180deg, #fbfcf8 0%, #f3f6ee 100%);
}

/* Module card grid — dashboard-style */
.module-card-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 48px;
}

@media (min-width: 800px) {
  .module-card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .module-card-grid-extra {
    grid-template-columns: 1fr 1fr;
  }
}

/* 2-column variant for te reo + notes panels */
.module-card-grid-extra {
  margin-bottom: 32px;
}

@media (min-width: 800px) {
  .module-card-grid-extra {
    grid-template-columns: 1fr 1fr;
  }
}

.module-card-grid-extra > .module-card {
  margin-bottom: 0;
}

.module-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 44px var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 5px solid var(--card-accent, #85b24a);
}

.module-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-card-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.module-card-desc {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
  flex: 0 0 auto;
}

.module-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-card-actions .button {
  flex: 1;
  min-width: 0;
  text-align: center;
}

/* PDF preview thumbnail */
.pdf-preview-thumb {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 6px var(--shadow);
}

.preview-figure {
  margin: 16px 0 0;
  max-width: 400px;
}

.preview-figure a {
  display: block;
  cursor: pointer;
}

.te-reo-panel .preview-figure {
  max-width: 400px;
}

.notes-panel .preview-figure {
  max-width: 400px;
}

.module-card .preview-figure {
  max-width: 100%;
}

/* Detail page responsive */
@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 88px;
  }
  .page-shell-detail {
    padding-top: 20px;
  }
  .hero-inner {
    width: min(100% - 20px, 1160px);
    gap: 12px;
    align-items: flex-start;
  }
  .intro-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .lo-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .module-card-grid {
    grid-template-columns: 1fr;
  }
  .pdf-preview-thumb {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 8px 0;
  }
  .hero-brand {
    gap: 10px;
  }
  .hero-logo {
    width: 40px;
  }
  .header-menu summary {
    width: 42px;
    height: 42px;
    padding: 0 10px;
  }
  .header-dropdown {
    min-width: min(260px, calc(100vw - 28px));
    right: -4px;
  }
  .objective-section,
  .worksheet-panel,
  .objective-card,
  .objective-nav {
    padding: 20px;
    border-radius: 20px;
  }
  .objective-debug-code {
    width: 100%;
    margin-left: 0;
    margin-top: -2px;
  }
  .button {
    width: 100%;
  }
  .objective-nav {
    grid-template-columns: 1fr;
  }
}
