/* Wise Old Pup
   Night stage for the hero, warm paper for reading.
   The tennis ball is the one bright object on the site. */

:root {
  --night: #0d1417;
  --ink: #141c20;
  --paper: #fbfaf7;
  --white: #ffffff;
  --ball: #d7e04a;
  --mist: #a3b0ae;      /* quiet text on night */
  --stone: #5b6664;     /* quiet text on paper */
  --rule: rgba(20, 28, 32, 0.14);
  --rule-night: rgba(255, 255, 255, 0.16);

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 36rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.7rem, 8.5vw, 6rem); }
h2 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); }
h3 { font-size: 1.5rem; line-height: 1.15; }
em, .it { font-style: italic; }

p, ul, ol { margin: 0 0 1.1em; }
a { color: inherit; text-decoration-thickness: 0.06em; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 0.12em; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ball); color: var(--ink); padding: 0.6rem 1rem; z-index: 30; }
.skip:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem var(--gutter);
  background: rgba(251, 250, 247, 0.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: background 0.4s, color 0.4s, border-color 0.4s;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--display); font-size: 1.4rem; letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark-ball { width: 1.15rem; height: 1.15rem; flex: none; transform: rotate(var(--spin, 0deg)); }
.site-header nav { display: flex; gap: 1.6rem; font-size: 0.9rem; }
.site-header nav a { text-decoration: none; padding: 0.4rem 0; position: relative; }
.site-header nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0.2rem; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease);
}
.site-header nav a:hover::after { transform: scaleX(1); }

/* On the home page the header floats over the night hero until you leave it. */
.home .site-header { position: absolute; left: 0; right: 0; background: transparent; color: var(--white); border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.js .home .site-header { position: fixed; }
.js .home .site-header.is-solid { background: rgba(251, 250, 247, 0.82); color: var(--ink); border-color: var(--rule); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; gap: 0.6rem;
  background: var(--ball); color: var(--ink);
  font: 500 0.95rem var(--body);
  padding: 0.9rem 1.5rem; border-radius: 999px;
  text-decoration: none;
  transition: transform 0.3s var(--ease), background 0.3s;
}
.button:hover { background: var(--white); transform: translateY(-2px); }
.button.on-paper { background: var(--ink); color: var(--paper); }
.button.on-paper:hover { background: var(--night); }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(60rem 40rem at 50% 38%, rgba(215, 224, 74, 0.10), transparent 62%),
    var(--night);
  color: var(--white);
  text-align: center;
}
.hero-stage { padding: 6.5rem var(--gutter) 4rem; }
.hero-ball { width: min(62vw, 20rem); margin: 0 auto 2.5rem; }
.hero-ball svg { display: block; width: 100%; height: auto; overflow: visible; }
.hero-copy { max-width: 60rem; margin: 0 auto; }
.hero h1 { margin: 0; font-size: clamp(2.6rem, 7.2vw, 5.4rem); }
.hero h1 span { display: block; }
.hero .line-2 { font-style: italic; color: var(--ball); padding-bottom: 0.12em; }
.hero-more { padding-top: 1.6rem; }
.hero .lede { max-width: 31rem; margin: 0 auto 1.6rem; color: var(--mist); font-size: 1.05rem; }
.scroll-cue { display: none; }

/* Pinned, scroll-driven version (switched on by hero.js when it fits) */
.hero.is-pinned { height: 260vh; height: 260svh; }
.hero.is-pinned .hero-stage { position: sticky; top: 0; height: 100vh; height: 100svh; padding: 0; overflow: hidden; }
.hero.is-pinned .hero-ball { position: absolute; left: 50%; margin: 0; will-change: transform; }
.hero.is-pinned .hero-copy { position: absolute; left: 0; right: 0; bottom: 7vh; padding: 0 var(--gutter); max-width: none; will-change: transform; }
.hero.is-pinned .scroll-cue {
  display: block; position: absolute; left: 50%; bottom: 1.6vh; transform: translateX(-50%);
  margin: 0; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--mist);
}
.hero.is-pinned .scroll-cue::after {
  content: ""; display: block; width: 1px; height: 1.4rem; margin: 0.35rem auto 0; background: var(--mist);
  animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

.ball-seams { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .ball-float { animation: float 6s ease-in-out infinite alternate; }
  @keyframes float { from { transform: translateY(-1.2%); } to { transform: translateY(1.2%); } }
}

/* ---------- Home sections ---------- */
.section { padding: clamp(4rem, 11vw, 9rem) var(--gutter); }
.split { display: grid; gap: 2.5rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 62rem) { .split { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); } }
.split > header p { color: var(--stone); max-width: 22rem; }

.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.rows li {
  display: grid; gap: 0.4rem 2.5rem; grid-template-columns: minmax(0, 1fr);
  padding: clamp(1.4rem, 3vw, 2.2rem) 0; border-bottom: 1px solid var(--rule);
}
@media (min-width: 44rem) { .rows li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: baseline; } }
.rows h3 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); margin: 0; line-height: 1.02; }
.rows p { margin: 0; color: var(--stone); }
.rows .status { font-size: 0.82rem; color: var(--stone); }

.night { background: var(--night); color: var(--white); }
.night h2 .it { color: var(--ball); }
.principles { display: grid; gap: 2.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); margin-top: clamp(2.5rem, 6vw, 5rem); }
.principles > div { border-top: 1px solid var(--rule-night); padding-top: 1.4rem; }
.principles h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.principles p { color: var(--mist); margin: 0; }
.night .more { margin: clamp(2.5rem, 6vw, 4rem) 0 0; }

/* Quiet reveal, used on a handful of blocks */
.js .reveal { opacity: 0; transform: translateY(1.6rem); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Reading pages ---------- */
.page { max-width: calc(var(--measure) + 2 * var(--gutter)); padding: clamp(3rem, 9vw, 6.5rem) var(--gutter) 5rem; }
.page h1 { font-size: clamp(2.6rem, 7.5vw, 4.6rem); margin-bottom: 0.4em; }
.page h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-top: 2em; line-height: 1.08; }
.page ul, .page ol { padding-left: 1.2em; }
.page li { margin-bottom: 0.5em; }
.page a { text-decoration-color: var(--stone); }
.lede { font-size: 1.2rem; line-height: 1.5; }
.note, .updated { color: var(--stone); font-size: 0.88rem; }

.guide-list { list-style: none; padding: 0 !important; border-top: 1px solid var(--ink); }
.guide-list li { margin: 0; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); font-family: var(--display); font-size: 1.45rem; line-height: 1.15; }
.guide-list .status { display: block; font-family: var(--body); color: var(--stone); font-size: 0.82rem; margin-top: 0.3rem; }

.disclosure-line { background: var(--white); border-left: 3px solid var(--ball); padding: 0.85rem 1.1rem; font-size: 0.88rem; }
.compare { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0 0 1.4em; }
.compare th, .compare td { text-align: left; padding: 0.7rem 0.8rem 0.7rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.compare thead th { border-bottom: 1px solid var(--ink); font-weight: 500; }
.table-scroll { overflow-x: auto; }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: var(--mist); padding: clamp(3rem, 8vw, 6rem) var(--gutter) 2rem; font-size: 0.85rem; overflow: hidden; }
.footer-top { display: grid; gap: 2rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 50rem) { .footer-top { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.site-footer p { max-width: 30rem; }
.site-footer nav { display: grid; gap: 0.5rem; justify-items: start; color: var(--white); font-size: 0.95rem; }
.site-footer nav a { text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }
.footer-mark {
  font-family: var(--display); color: var(--white); line-height: 0.9; letter-spacing: -0.03em;
  font-size: clamp(3.4rem, 17.5vw, 15rem); white-space: nowrap;
  margin: clamp(2.5rem, 7vw, 5rem) 0 0 -0.04em; padding-bottom: 0.22em;
}
.site-footer .copyright { margin: 0; border-top: 1px solid var(--rule-night); padding-top: 1.2rem; max-width: none; }
