/* Visual pass 02 — locally hosted fonts, warm editorial style, original artwork. */
@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Zilla Slab';
  src: url('fonts/zilla-slab-regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/caveat-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #fdfdfc;
  --surface: #f7f8f4;
  --white: #ffffff;
  --ink: #1c1b1b;
  --muted: #464a47;
  --line: #d9d9d7;
  --honey: #f5d188;
  --terracotta: #a5380b;
  --sage: #f7f8f4;
  --night: #151613;
  --max: 1160px;
  --read: 760px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Arial, "Segoe UI", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font: inherit; }
.wrap { width: min(var(--max), calc(100% - 56px)); margin-inline: auto; }
.skip-link {
  position: absolute; z-index: 30; top: 8px; left: 8px;
  transform: translateY(-160%); padding: 10px 14px;
  background: var(--ink); color: var(--white); border-radius: 4px;
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 4px; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.nav { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand {
  display: inline-flex; align-items: center; gap: 11px; color: var(--ink);
  text-decoration: none; font: 700 19px/1 Inter, Arial, sans-serif; letter-spacing: .09em;
}
.brand-mark {
  width: 31px; height: 31px; display: grid; place-items: center;
  border: 1.5px solid var(--ink); border-radius: 5px;
  background: var(--honey); color: var(--ink); font: 700 14px/1 Inter, Arial, sans-serif;
}
.nav-right { display: flex; align-items: center; gap: 24px; font: 15px/1.2 Inter, Arial, sans-serif; }
.nav-link { color: var(--muted); text-decoration: none; }
.nav-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.menu { position: relative; }
.menu-button {
  min-height: 44px; padding: 10px 14px; display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--paper);
  color: var(--ink); cursor: pointer; font: 600 14px/1.2 Inter, Arial, sans-serif;
}
.menu-button:hover, .menu-button[aria-expanded="true"] { border-color: var(--ink); background: var(--surface); }
.menu-list {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  display: none; width: max-content; min-width: min(230px, calc(100vw - 32px));
  max-width: calc(100vw - 32px); padding: 7px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--white);
  box-shadow: 0 12px 28px rgb(28 27 27 / 10%);
}
.menu-list.open { display: grid; }
.menu-list a { padding: 11px 12px; border-radius: 3px; text-decoration: none; font: 15px/1.35 Inter, Arial, sans-serif; white-space: normal; overflow-wrap: anywhere; }
.menu-list a:hover, .menu-list a:focus-visible { background: var(--sage); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 {
  color: var(--ink); font-family: "Zilla Slab", Georgia, "Times New Roman", serif;
  font-weight: 400; text-wrap: balance;
}
.hero {
  max-width: none; min-height: 560px; padding: clamp(56px, 8vw, 108px) 0 84px;
  display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(280px, .82fr);
  align-items: center; gap: clamp(24px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}
.home-hero { min-height: 0; display: block; padding: 38px 0 12px; border-bottom: 0; }
.home-hero h1 { max-width: 18ch; margin-bottom: 14px; font-size: clamp(42px, 6vw, 68px); }
.home-hero .lede { max-width: 700px; margin-bottom: 0; }
.hero-copy { max-width: 740px; }
.eyebrow {
  margin: 0 0 19px; color: var(--terracotta);
  font: 700 12px/1.35 Inter, Arial, sans-serif; letter-spacing: .14em; text-transform: uppercase;
}
.hero .eyebrow, .lesson-header .eyebrow {
  font: 600 24px/1.05 Caveat, cursive; letter-spacing: 0; text-transform: none;
}
h1 {
  max-width: 11ch; margin: 0 0 23px;
  font-size: clamp(48px, 7vw, 86px); line-height: .98; letter-spacing: -.055em;
}
.hero-highlight { box-shadow: inset 0 -.29em 0 var(--honey); }
.lede { max-width: 580px; margin: 0 0 28px; color: var(--muted); font-size: clamp(18px, 1.7vw, 21px); line-height: 1.58; }
.hero-action {
  min-height: 48px; display: inline-flex; align-items: center; gap: 19px;
  padding: 12px 17px; border: 1px solid var(--ink); border-radius: 4px;
  background: var(--ink); color: var(--white); text-decoration: none;
  font: 600 14px/1.2 Inter, Arial, sans-serif; transition: background-color .16s ease, color .16s ease;
}
.hero-action:hover { background: var(--paper); color: var(--ink); }
.hero-art {
  width: min(100%, 450px); aspect-ratio: 1 / .92; margin: 0 0 0 auto;
  display: grid; place-items: center; padding: 24px;
  background: var(--sage); border-radius: 47% 53% 49% 51% / 51% 45% 55% 49%;
}
.hero-art img { display: block; width: 100%; height: auto; }

.section-head {
  min-height: 88px; padding: 28px 0 18px; display: flex; align-items: end;
  justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--ink);
}
.section-head h2 { margin: 0; font-size: clamp(32px, 4vw, 45px); line-height: 1.08; letter-spacing: -.04em; }
.section-head p { margin: 0 0 4px; color: var(--muted); font: 15px/1.45 Inter, Arial, sans-serif; }
.lesson-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 18px 0 80px; }
.lesson-card {
  min-height: 242px; display: flex; flex-direction: column; position: relative;
  padding: 20px 22px 48px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.lesson-card:hover, .lesson-card:focus-visible {
  transform: translateY(-2px); border-color: var(--ink); background: var(--white);
  box-shadow: 0 8px 22px rgb(28 27 27 / 8%); outline-offset: 3px;
}
.lesson-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.lesson-number { color: var(--terracotta); font: 600 22px/1 Caveat, cursive; }
.lesson-art { width: 96px; height: 74px; display: grid; place-items: center; padding: 5px; border-radius: 12px 20px 13px 19px; }
.lesson-card:nth-child(1) .lesson-art { background: #fbf4ea; }
.lesson-card:nth-child(2) .lesson-art { background: #f9ab95; }
.lesson-card:nth-child(3) .lesson-art { background: #f7f8f4; }
.lesson-card:nth-child(4) .lesson-art { background: #c4e2fb; }
.lesson-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.lesson-card h3 { margin: 0 42px 6px 0; font-size: clamp(25px, 2.5vw, 32px); line-height: 1.12; letter-spacing: -.025em; }
.lesson-card p { max-width: 34ch; margin: 0; color: var(--muted); font: 16px/1.5 Inter, Arial, sans-serif; }
.arrow { position: absolute; top: auto; right: 19px; bottom: 16px; color: var(--ink); font: 22px/1 Inter, Arial, sans-serif; transition: transform .16s ease; }
.lesson-card:hover .arrow { transform: translate(2px, -2px); }
.coming {
  display: inline-block; margin-top: 15px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 3px; color: var(--muted);
  font: 700 10px/1.3 Inter, Arial, sans-serif; letter-spacing: .08em;
}

.lesson-header { max-width: 880px; padding: 58px 0 20px; }
.breadcrumb { margin: 0 0 19px; color: var(--muted); font: 14px/1.45 Inter, Arial, sans-serif; }
.breadcrumb a { text-underline-offset: 3px; }
.lesson-header .eyebrow { margin-bottom: 13px; }
.lesson-header h1 { max-width: 14ch; margin-bottom: 17px; font-size: clamp(42px, 6.4vw, 68px); line-height: 1.02; }
.lesson-intro { max-width: 720px; margin: 0; color: var(--muted); font: 19px/1.6 Inter, Arial, sans-serif; }
.sheet-figure {
  margin: 26px 0 40px; padding: 12px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
}
.sheet-figure img { display: block; width: 100%; height: auto; border-radius: 4px; }
.sheet-figure figcaption { padding: 11px 5px 2px; color: var(--muted); font: 14px/1.45 Inter, Arial, sans-serif; }
.sheet-figure figcaption a { margin-left: 8px; color: var(--terracotta); font-weight: 700; text-underline-offset: 3px; }
.article { max-width: var(--read); padding-bottom: 84px; font: 18px/1.75 Inter, Arial, sans-serif; }
.article kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--white); color: var(--ink); font: 600 .82em/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.article section { padding: 30px 0 36px; border-bottom: 1px solid var(--line); }
.article section:last-child { border-bottom: 0; }
.article h2 { margin: 0 0 17px; font-size: clamp(28px, 3.3vw, 37px); line-height: 1.12; letter-spacing: -.035em; }
.article h3 { margin: 25px 0 9px; font-size: 24px; line-height: 1.22; letter-spacing: -.02em; }
.article p { margin-bottom: 13px; }
.article ul { padding-left: 24px; }
.example {
  margin: 20px 0; padding: 20px 22px;
  border: 1px solid #e5e2db; border-radius: 6px; background: var(--sage);
}
.example p:last-child { margin-bottom: 0; }
.math { display: inline; color: var(--ink); font-weight: 700; box-shadow: inset 0 -.28em 0 var(--honey); }
.formula {
  display: inline-block; max-width: 100%; padding: 5px 9px; overflow-wrap: anywhere;
  border: 1px solid var(--line); border-radius: 4px; background: var(--white);
  color: var(--ink); font: 600 .9em/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.formula-block { display: block; width: fit-content; margin: 10px 0; padding: 9px 12px; font-size: 16px; }
.cell-pill { display: inline-block; padding: 1px 7px; border-radius: 3px; background: var(--honey); color: var(--ink); font: 700 14px/1.5 Inter, Arial, sans-serif; }
.formula-table-wrap { margin: 18px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--white); }
.formula-table { width: 100%; border-collapse: collapse; font: 15px/1.5 Inter, Arial, sans-serif; }
.formula-table th, .formula-table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.formula-table th { background: var(--sage); color: var(--ink); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.formula-table tr:last-child td { border-bottom: 0; }
.formula-table code { white-space: nowrap; font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.note { color: var(--muted); font-size: 15px; }
.upcoming-box { max-width: 700px; margin: 20px 0 82px; padding: 25px 27px; border: 1px dashed #bcb7ad; border-radius: 6px; background: var(--surface); }
.upcoming-box h2 { font: 400 30px/1.15 "Zilla Slab", Georgia, "Times New Roman", serif; }
.upcoming-box a { color: var(--terracotta); font-weight: 700; text-underline-offset: 3px; }
.site-footer { padding: 24px 0; background: var(--night); color: #fdfdfc; font: 14px/1.5 Inter, Arial, sans-serif; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner a { text-underline-offset: 3px; }
.notice { color: var(--muted); font: 14px/1.5 Inter, Arial, sans-serif; }

@media (max-width: 780px) {
  .wrap { width: min(var(--max), calc(100% - 36px)); }
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 34px; padding: 58px 0 58px; }
  .hero-art { width: min(100%, 380px); margin: 0 auto; }
  .lesson-grid { gap: 0 20px; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .wrap { width: min(var(--max), calc(100% - 30px)); }
  .nav { min-height: 66px; }
  .nav-right { gap: 10px; }
  .nav-link { display: inline; }
  .menu-list { position: fixed; top: 74px; left: 14px; right: 14px; width: auto; min-width: 0; max-width: 360px; margin-inline: auto; }
  .hero { padding: 45px 0 46px; }
  .home-hero { padding: 30px 0 8px; }
  h1 { font-size: clamp(44px, 13vw, 62px); }
  .hero-art { width: min(100%, 320px); padding: 16px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 8px; padding-top: 25px; }
  .lesson-grid { grid-template-columns: 1fr; padding-bottom: 55px; }
  .lesson-card { min-height: 210px; padding: 18px 20px 46px; }
  .lesson-art { width: 84px; height: 66px; }
  .lesson-header { padding: 38px 0 16px; }
  .lesson-header h1 { font-size: clamp(38px, 11vw, 52px); }
  .lesson-intro { font-size: 17px; }
  .sheet-figure { margin: 20px 0 26px; padding: 7px; }
  .article { padding-bottom: 55px; font-size: 17px; }
  .article section { padding: 24px 0 28px; }
  .example { padding: 16px; }
  .formula-table { min-width: 570px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
