@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Thai";
  src: url("/fonts/NotoSansThai-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans Thai";
  src: url("/fonts/NotoSansThai-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --surface: #f7f7f7;
  --surface-raised: #ffffff;
  --text: #0a0a0a;
  --muted: #505050;
  --line: #d0d0d0;
  --action: #3edc81;
  --action-text: #063119;
  --link: #17653f;
  --focus: #17653f;
  --radius: 0.75rem;
  --page-width: 72rem;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0a0a0a;
  --surface-raised: #171717;
  --text: #f7f7f7;
  --muted: #c8c8c8;
  --line: #555555;
  --action: #3edc81;
  --action-text: #062c16;
  --link: #82efae;
  --focus: #82efae;
}

* { box-sizing: border-box; }

html { background: var(--surface); }

body {
  margin: 0;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
  font-family: Inter, "Noto Sans Thai", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

a { color: var(--link); text-decoration-thickness: 0.12em; text-underline-offset: 0.18em; }
a:hover { color: var(--text); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link { position: fixed; z-index: 5; top: 0.75rem; left: 0.75rem; padding: 0.6rem 0.85rem; background: var(--action); color: var(--action-text); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner, .page-shell, .site-footer { width: min(100% - 2rem, var(--page-width)); margin-inline: auto; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding-block: 1.15rem; }
.course-identity p { margin: 0; }
.eyebrow, .preview-label { margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.course-code { font-weight: 700; }
.institution { color: var(--muted); font-size: 0.9rem; }
.site-nav { display: flex; flex: 1 1 26rem; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem 1rem; }
.site-nav a { padding: 0.35rem 0; white-space: nowrap; }

.page-shell { padding-block: clamp(2.5rem, 6vw, 5.5rem); }
.course-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(15rem, 0.65fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: end; padding-bottom: clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
h1, h2, h3, h4 { margin: 0; color: var(--text); line-height: 1.22; text-wrap: balance; }
h1 { max-width: 15ch; font-size: clamp(2.3rem, 7vw, 5.6rem); letter-spacing: -0.055em; }
h2 { font-size: clamp(1.65rem, 4vw, 2.7rem); letter-spacing: -0.035em; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.55rem); }
h4 { font-size: 1.08rem; }
.hero-subtitle { margin: 1.15rem 0 0; font-size: clamp(1.15rem, 2vw, 1.5rem); font-weight: 700; }
.hero-summary { max-width: 58ch; margin: 0.85rem 0 0; color: var(--muted); font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin: 1.75rem 0 0; align-items: center; }
.hero-actions a:first-child { display: inline-flex; min-height: 2.8rem; align-items: center; padding: 0.55rem 1rem; background: var(--action); border: 1px solid var(--action); border-radius: var(--radius); color: var(--action-text); font-weight: 700; text-decoration: none; }
.learning-preview { padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); }
.learning-preview ol { display: grid; gap: 0.75rem; margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: route; }
.learning-preview li { display: flex; align-items: center; gap: 0.7rem; font-weight: 700; }
.learning-preview li::before { display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); content: counter(route, decimal-leading-zero); counter-increment: route; font: 700 0.7rem/1 Inter, sans-serif; }
.content-section { padding-top: clamp(3rem, 8vw, 7rem); }
.content-section > p, .goals-section li { max-width: 72ch; }
.content-section > p { color: var(--muted); }
.goals-section ul { padding-left: 1.25rem; }
.day-grid, .lesson-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
.day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.day-card, [data-lesson] { min-width: 0; padding: clamp(1.1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); }
.day-card p, [data-lesson] p { color: var(--muted); }
.lesson-day + .lesson-day { margin-top: 2.5rem; }
.lesson-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-lesson] { display: flex; flex-direction: column; gap: 0.85rem; }
[data-lesson] p { margin: 0; }
[data-lesson] a { width: fit-content; margin-top: auto; font-weight: 700; }
.resources-section ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 2rem; padding: 0; list-style: none; }
.resources-section a { display: inline-block; padding: 0.35rem 0; }
.site-footer { margin-top: 2rem; padding-block: 2rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.site-footer p { margin: 0.25rem 0; }

button, input, select, textarea { min-height: 2.75rem; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface-raised); color: var(--text); font: inherit; }
button, select { padding-inline: 0.8rem; }
input, textarea { width: 100%; padding: 0.6rem 0.8rem; }

@media (max-width: 46rem) {
  .header-inner, .site-nav { align-items: flex-start; justify-content: flex-start; }
  .course-hero, .day-grid, .lesson-grid, .resources-section ul { grid-template-columns: 1fr; }
  h1 { max-width: none; }
  .site-nav { flex-basis: 100%; }
}

@media print {
  :root, html[data-theme="dark"] { color-scheme: light; --surface: #fff; --surface-raised: #fff; --text: #000; --muted: #333; --line: #888; --link: #000; }
  .skip-link, .site-nav { display: none; }
  .page-shell { padding-block: 1.5rem; }
  .course-hero, .day-grid, .lesson-grid, .resources-section ul { grid-template-columns: 1fr; }
  a { color: #000; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
