/* =====================================================================
   The Developing Polo Player — Volume I
   Design tokens and layout. No build step, no framework.
   ===================================================================== */

:root {
  /* Surfaces */
  --paper:        #ffffff;
  --background:   #f7f8f5;
  --muted:        #edf0ee;
  --secondary:    #eaf2ec;
  --border:       #d9e0dc;

  /* Ink */
  --foreground:   #14242d;
  --muted-fg:     #4c5a61;   /* darkened from #5c6b73 -> 7.1:1 on --background */

  /* Brand */
  --navy:         #153247;
  --navy-deep:    #0d2230;
  --green:        #3f704d;
  --green-deep:   #244b32;
  --red:          #96382d;
  --gold:         #8a6216;   /* darkened from #c7943e -> 5.6:1 on --background */
  --gold-bright:  #c7943e;   /* decorative only: rules, dots, never text */
  --gold-pale:    #faf3e5;

  --on-navy:      #ffffff;

  --radius:       0.6rem;
  --serif:        Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans:         "Helvetica Neue", Arial, Helvetica, sans-serif;

  --measure:      68ch;
  --pad:          clamp(1.25rem, 4vw, 3rem);
  --shell:        1200px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; max-width: var(--measure); }

a { color: var(--navy); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.shell { width: 100%; max-width: var(--shell); margin-inline: auto; padding-inline: var(--pad); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--navy); color: var(--on-navy);
  padding: 0.85rem 1.25rem; border-radius: 0 0 var(--radius) 0; font-size: 0.9rem;
}
.skip-link:focus { left: 0; }

/* ---------- Shared type utilities ---------- */

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.eyebrow--muted { color: var(--muted-fg); }

.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted-fg); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.95rem; font-weight: 600;
  font-family: var(--sans);
  text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.btn:active { transform: translateY(1px); }

/* THE FIX: white on navy, not navy on navy. */
.btn--primary { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.btn--primary:hover { background: var(--navy-deep); border-color: var(--navy-deep); }

.btn--ghost { background: transparent; color: var(--navy); border-color: var(--border); }
.btn--ghost:hover { background: var(--muted); border-color: var(--navy); }

.btn--quiet {
  background: none; border: none; padding: 0.5rem 0;
  color: var(--navy); font-weight: 700; min-height: 44px;
}
.btn--quiet:hover { color: var(--green-deep); }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--background); /* fallback where color-mix is unsupported */
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
/* No blur support means no translucency, or text sits on moving content. */
@supports not (backdrop-filter: blur(10px)) {
  .site-header { background: var(--background); }
}
.site-header__inner {
  display: flex; align-items: center; gap: 1rem;
  min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--foreground); margin-right: auto; }
.brand__mark {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: var(--navy); color: var(--on-navy);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 0.85rem; letter-spacing: 0.02em;
  border: 2px solid var(--gold-bright);
}
.brand__name { font-family: var(--serif); font-size: 1.02rem; line-height: 1.2; }
.brand__meta { font-size: 0.66rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--muted-fg); }

.site-nav { display: flex; align-items: center; gap: 0.35rem; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 0.85rem; border-radius: var(--radius);
  font-size: 0.88rem; color: var(--muted-fg); text-decoration: none; font-weight: 500;
}
.site-nav a:hover { color: var(--navy); background: var(--muted); }

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .brand__meta { display: none; }
  .site-header__inner { min-height: 60px; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; flex: none;
    background: none; border: 1.5px solid var(--border); border-radius: var(--radius);
    color: var(--navy); cursor: pointer;
  }
  .nav-toggle svg { width: 22px; height: 22px; }
  .nav-toggle .icon-close { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-open { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-close { display: block; }

  /* Mobile menu: the three section links reappear here. */
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 30px -22px rgba(13, 34, 48, 0.45);
    padding: 0.5rem var(--pad) 1rem;
  }
  .site-nav[hidden] { display: none; }
  .site-nav a { min-height: 52px; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .site-nav a:last-child { border-bottom: none; }
  .site-nav .btn { margin-top: 0.75rem; }
}

.header-cta { display: inline-flex; }
@media (max-width: 900px) { .header-cta--desktop { display: none; } }
@media (min-width: 901px) { .header-cta--mobile { display: none; } }

/* ---------- Hero ---------- */

.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero::after {
  content: ""; position: absolute; right: -12%; top: -20%; width: 62%; height: 150%;
  background: linear-gradient(160deg, var(--secondary), transparent 65%);
  transform: skewX(-12deg); z-index: 0; pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: center; }
@media (min-width: 950px) { .hero__inner { grid-template-columns: 1fr 1fr; } }

.hero h1 { font-size: clamp(2.75rem, 7vw, 4.5rem); }
.hero h1 em { font-style: italic; color: var(--green-deep); display: block; }
.hero .lede { margin-top: 1.5rem; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 2rem; }

.hero__figure { border-radius: var(--radius); overflow: hidden; box-shadow: 0 30px 60px -35px rgba(13, 34, 48, 0.55); border: 1px solid var(--border); background: var(--paper); }

.meta-strip {
  display: grid; gap: 1.5rem; margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.75rem; border-top: 1px solid var(--border);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.meta-strip dt { font-size: 0.68rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted-fg); font-weight: 700; }
.meta-strip dd { margin: 0.4rem 0 0; font-family: var(--serif); font-size: 1.05rem; }

/* ---------- Chapter index ---------- */

.chapter-index { background: var(--navy); color: var(--on-navy); padding: clamp(3rem, 6vw, 4.5rem) 0; }
.chapter-index .eyebrow { color: var(--gold-bright); }
.chapter-index h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); max-width: 20ch; }
.chapter-list { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 0.25rem; }
.chapter-list a {
  display: flex; align-items: baseline; gap: 1.25rem;
  padding: 1.1rem 0.5rem; min-height: 56px;
  color: var(--on-navy); text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  transition: background-color .18s ease, padding-left .18s ease;
}
.chapter-list li:last-child a { border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.chapter-list a:hover { background: rgba(255, 255, 255, 0.07); padding-left: 1rem; }
.chapter-list__num { font-family: var(--serif); font-size: 1.1rem; color: var(--gold-bright); flex: none; width: 2.2rem; }
.chapter-list__title { font-family: var(--serif); font-size: clamp(1.15rem, 2.2vw, 1.45rem); }
.chapter-list__arrow { margin-left: auto; opacity: 0.55; }

/* ---------- Chapters ---------- */

.chapter { padding: clamp(3.5rem, 7vw, 6rem) 0; border-top: 1px solid var(--border); }
.chapter:nth-of-type(even) { background: var(--paper); }

.chapter__head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.chapter__num {
  font-family: var(--serif); font-size: clamp(3rem, 8vw, 5rem);
  color: var(--gold-bright); line-height: 1; display: block; margin-bottom: 0.5rem;
}
.chapter__head h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); max-width: 22ch; margin-bottom: 1rem; }

.prose { max-width: var(--measure); }
.prose h3 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin: 2.5rem 0 1rem; }

figure { margin: 2.5rem 0; }
figure img { border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); }
figcaption { font-size: 0.85rem; color: var(--muted-fg); margin-top: 0.85rem; font-style: italic; }

.checklist { list-style: none; padding: 0; margin: 1.5rem 0; max-width: var(--measure); }
.checklist li { position: relative; padding-left: 1.9rem; margin-bottom: 0.7rem; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold-bright);
}

/* Callouts */
.callout {
  border-left: 4px solid var(--gold-bright);
  background: var(--gold-pale);
  padding: 1.5rem 1.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 2.5rem 0;
  max-width: var(--measure);
}
.callout h3 { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.15em; text-transform: uppercase; font-weight: 700; color: #6d4c16; margin: 0 0 0.6rem; }
.callout p:last-child { margin-bottom: 0; }
.callout--navy { background: var(--navy); border-left-color: var(--gold-bright); color: var(--on-navy); }
.callout--navy h3 { color: var(--gold-bright); }
.callout--danger { background: #fbeeec; border-left-color: var(--red); }
.callout--danger h3 { color: var(--red); }

/* Card grids */
.grid { display: grid; gap: 1.25rem; margin: 2.5rem 0; }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.card h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.card p { font-size: 0.92rem; color: var(--muted-fg); margin: 0; }
.card__tag {
  display: inline-block; font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase;
  font-weight: 700; color: var(--gold); margin-bottom: 0.6rem;
}

.numbered { list-style: none; counter-reset: q; padding: 0; margin: 2rem 0; max-width: var(--measure); }
.numbered li { counter-increment: q; position: relative; padding-left: 3rem; margin-bottom: 1.25rem; }
.numbered li::before {
  content: counter(q); position: absolute; left: 0; top: 0;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--navy); color: var(--on-navy);
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700;
}

.figure-pair { display: grid; gap: 1.5rem; margin: 2.5rem 0; }
@media (min-width: 800px) { .figure-pair { grid-template-columns: 1fr 1fr; } }
.figure-pair figure { margin: 0; }

/* ---------- Checkpoint ---------- */

.checkpoint__progress {
  display: flex; align-items: baseline; gap: 0.75rem;
  margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border);
}
.checkpoint__count { font-family: var(--serif); font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1; color: var(--green-deep); }
.checkpoint__of { font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-fg); font-weight: 700; }

.checkpoint__bar { height: 6px; background: var(--muted); border-radius: 999px; overflow: hidden; margin-bottom: 2rem; max-width: var(--measure); }
.checkpoint__fill { height: 100%; width: 0%; background: var(--green); border-radius: 999px; transition: width .3s ease; }

.check-list { list-style: none; padding: 0; margin: 0 0 2rem; max-width: var(--measure); display: grid; gap: 0.5rem; }
.check-item {
  display: flex; align-items: flex-start; gap: 1rem;
  width: 100%; min-height: 56px; padding: 1rem 1.15rem;
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 0.95rem; text-align: left; color: var(--foreground);
  cursor: pointer; transition: border-color .18s ease, background-color .18s ease;
}
.check-item:hover { border-color: var(--green); }
.check-item__box {
  flex: none; width: 24px; height: 24px; margin-top: 1px;
  border: 2px solid var(--border); border-radius: 6px;
  display: grid; place-items: center; transition: all .18s ease;
}
.check-item__box svg { width: 14px; height: 14px; opacity: 0; color: var(--on-navy); }
.check-item[aria-pressed="true"] { background: var(--secondary); border-color: var(--green); }
.check-item[aria-pressed="true"] .check-item__box { background: var(--green); border-color: var(--green); }
.check-item[aria-pressed="true"] .check-item__box svg { opacity: 1; }

/* ---------- Signup ---------- */

.signup {
  background: var(--navy); color: var(--on-navy);
  border-radius: var(--radius); padding: clamp(2rem, 5vw, 3rem);
  margin: 3rem 0 0; max-width: 760px;
}
.signup h3 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.75rem; }
.signup p { color: rgba(255, 255, 255, 0.82); font-size: 0.98rem; }
.signup .eyebrow { color: var(--gold-bright); }

.signup__form { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.signup__form input[type="email"] {
  flex: 1 1 240px; min-height: 48px; padding: 0.75rem 1rem;
  border-radius: var(--radius); border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08); color: var(--on-navy);
  font: inherit; font-size: 1rem;
}
.signup__form input::placeholder { color: rgba(255, 255, 255, 0.55); }
.signup__form input:focus { border-color: var(--gold-bright); background: rgba(255, 255, 255, 0.14); }
.signup__form .btn {
  background: var(--gold-bright); color: #2b1e05; border-color: var(--gold-bright); flex: none;
}
.signup__form .btn:hover { background: #dcab55; border-color: #dcab55; }
.signup__form .btn[disabled] { opacity: 0.6; cursor: progress; }

.signup__note { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); margin: 1rem 0 0; }
.signup__status { margin: 1rem 0 0; font-size: 0.92rem; min-height: 1.4em; }
.signup__status[data-state="error"] { color: #ffbdb3; }
.signup__status[data-state="ok"] { color: #a8e0b8; }

/* Honeypot: hidden from people, tempting to bots. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Practice log ---------- */

.log-list { list-style: none; padding: 0; margin: 2rem 0; max-width: var(--measure); display: grid; gap: 0; }
.log-list li {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 0; border-bottom: 1px dashed var(--border);
  font-size: 0.98rem;
}
.log-list li::before {
  content: ""; flex: none; width: 10px; height: 10px;
  border: 1.5px solid var(--muted-fg); border-radius: 2px;
}

/* ---------- About ---------- */

.about { background: var(--secondary); padding: clamp(3.5rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--border); }
.about__grid { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .about__grid { grid-template-columns: 1fr 1fr; } }
.about h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: 18ch; margin-bottom: 1rem; }
.about dl { margin: 0; display: grid; gap: 1.5rem; }
.about dt { font-family: var(--serif); font-size: 1.1rem; margin-bottom: 0.35rem; }
.about dd { margin: 0; color: var(--muted-fg); font-size: 0.95rem; }

/* ---------- Sources ---------- */

.sources { padding: clamp(3rem, 6vw, 4.5rem) 0; border-top: 1px solid var(--border); }
.sources h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1rem; max-width: 24ch; }
.source-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; padding: 0; list-style: none; }
.source-links a {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px;
  padding: 0.6rem 1.1rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--paper); text-decoration: none; font-size: 0.9rem; color: var(--navy); font-weight: 500;
}
.source-links a:hover { border-color: var(--navy); background: var(--muted); }

/* ---------- Footer ---------- */

.site-footer { background: var(--navy-deep); color: rgba(255, 255, 255, 0.75); padding: 3rem 0; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; }
.site-footer .brand__name { color: #fff; }
.site-footer__meta { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; }
.site-footer a { color: #fff; text-decoration: none; margin-left: auto; font-size: 0.9rem; min-height: 44px; display: inline-flex; align-items: center; }

@media print {
  .site-header, .chapter-index, .signup, .site-footer, .hero::after { display: none !important; }
  body { background: #fff; }
  .chapter { break-inside: avoid; }
}
