/* What I Learned mini books (built by tools/build_wil.py). Uses the tokens in /styles.css. */

.wil main { background: var(--bone); color: var(--ink); }
.wil .wil-bp { color: var(--oxblood); }

/* HERO */
.wil-hero { padding-block: calc(var(--nav-h) + clamp(32px, 6vw, 80px)) clamp(32px, 5vw, 64px); border-bottom: 1px solid var(--line-light); overflow: hidden; }
.wil-hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: center; }
.wil-hero__copy { min-width: 0; }
.wil-hero__title { font-family: var(--font-serif); font-weight: 800; font-size: clamp(3.2rem, 9vw, 7.5rem); line-height: .88; letter-spacing: -.025em; text-transform: uppercase; text-wrap: balance; }
.wil-hero__role { margin-top: 20px; padding-top: 18px; border-top: 4px solid var(--ink); width: fit-content; font-family: var(--font-serif); font-style: italic; font-weight: 500; font-size: clamp(1.3rem, 2.2vw, 1.75rem); color: var(--oxblood); }
.wil-hero__by { margin-top: 14px; font-size: var(--fs-small); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-wrap: pretty; }
.wil-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 32px; }
.wil-hero__art { min-width: 0; }
.wil-hero__art img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }

/* LAYOUT: contents rail + reading column */
.wil-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 42rem) minmax(0, 1fr); gap: var(--gap); padding: clamp(48px, 7vw, 96px) var(--gutter) var(--section-y); }
.wil-toc { grid-column: 1; justify-self: end; position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; max-width: 15rem; }
.wil-toc__h { font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.wil-toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; border-left: var(--rule) solid var(--oxblood); padding-left: 14px; }
.wil-toc a { font-size: var(--fs-small); line-height: 1.35; color: var(--graphite); text-decoration: none; }
.wil-toc a:hover { color: var(--oxblood); }
.wil-article { grid-column: 2; min-width: 0; font-size: 1.0625rem; line-height: 1.7; color: var(--graphite); }
.wil-article > * + * { margin-top: 1.1em; }
.wil-article a { color: var(--oxblood); text-underline-offset: 3px; overflow-wrap: anywhere; }
.wil-article [id] { scroll-margin-top: calc(var(--nav-h) + 24px); }

/* TYPE */
.wil-kicker { margin-bottom: 0; }
.wil-article .wil-kicker { margin-top: clamp(56px, 8vw, 96px); }
.wil-article .wil-kicker:first-child { margin-top: 0; }
.wil-h2 { font-family: var(--font-serif); font-weight: 700; font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.04; letter-spacing: -.015em; color: var(--ink); text-wrap: balance; }
.wil-article .wil-kicker + .wil-h2 { margin-top: 14px; }
.wil-h2 em { color: var(--oxblood); }
.wil-h3 { font-family: var(--font-serif); font-weight: 700; font-size: clamp(1.35rem, 2vw, 1.6rem); line-height: 1.2; color: var(--ink); text-wrap: balance; }
.wil-article .wil-h3 { margin-top: 2em; }
.wil-lead { font-family: var(--font-serif); font-size: clamp(1.25rem, 1.8vw, 1.45rem); line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.wil-article strong { color: var(--ink); }
.wil-note { font-size: var(--fs-small); line-height: 1.55; color: var(--muted); }

/* QUOTES, CALLOUTS, CARDS */
.wil-quote { margin-inline: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--oxblood); }
.wil-quote p { font-family: var(--font-serif); font-style: italic; font-size: clamp(1.2rem, 1.7vw, 1.38rem); line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.wil-quote p + p { margin-top: .6em; }
.wil-quote footer { margin-top: 10px; font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--oxblood); }
.wil-callout { padding: clamp(20px, 3vw, 28px); background: var(--ink); color: var(--bone); }
.wil-callout__lab { font-size: var(--fs-label); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ox-bright); margin-bottom: 8px; }
.wil-callout p:last-child { line-height: 1.6; }
.wil-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.wil-card { min-width: 0; padding: 16px 18px 18px; border-top: var(--rule) solid var(--ink); background: var(--paper); }
.wil-card__h { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; line-height: 1.25; color: var(--ink); margin-bottom: 6px; }
.wil-card p:last-child { font-size: .95rem; line-height: 1.55; }

/* KEY NUMBERS */
.wil-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 18px; margin-top: 14px; }
.wil-stats div { min-width: 0; border-top: var(--rule) solid var(--oxblood); padding-top: 8px; }
.wil-stats dt { font-family: var(--font-serif); font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.1; color: var(--ink); }
.wil-stats dd { margin: 4px 0 0; font-size: var(--fs-small); line-height: 1.45; color: var(--muted); }

/* TABLES */
.wil-tablewrap { overflow-x: auto; }
.wil-table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.wil-table td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--line-light); vertical-align: top; }
.wil-table td:last-child { padding-right: 0; }
.wil-table--two td:first-child { width: 28%; font-weight: 700; color: var(--ink); }
.wil-table--stat td:first-child { width: 4.5rem; font-family: var(--font-serif); font-size: 1.6rem; line-height: 1.1; color: var(--oxblood); }
.wil-table--stat td:nth-child(2) { font-weight: 700; color: var(--ink); }
.wil-table--stat td:last-child { color: var(--muted); }
.wil-table--list td:first-child { width: 2.5rem; font-family: var(--font-serif); font-weight: 700; color: var(--oxblood); }
.wil-table--list td:nth-child(2) { width: 40%; font-weight: 700; color: var(--ink); }

/* WORKSHEET */
.wil-sheet { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.wil-sheet li { counter-increment: s; padding: 14px 0 44px; border-bottom: 1px solid var(--ink); font-weight: 700; color: var(--ink); }
.wil-sheet li::before { content: counter(s) ". "; color: var(--oxblood); }

/* PLATES */
.wil-plate { margin-inline: 0; }
.wil-article .wil-plate { margin-top: clamp(48px, 7vw, 80px); margin-bottom: clamp(32px, 5vw, 56px); }
.wil-plate img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.wil-plate figcaption { margin-top: 10px; text-align: center; font-family: var(--font-serif); font-style: italic; font-weight: 500; font-size: 1.15rem; color: var(--oxblood); text-wrap: balance; }

/* DIAGRAMS (rebuilt from the print file) */
.wil-c0 { background: var(--oxblood); }
.wil-c1 { background: var(--ink); }
.wil-c2 { background: var(--graphite); }
.wil-c3 { background: var(--muted); }
.wil-fig { margin: 28px 0; }
.wil-layers { display: flex; flex-direction: column; gap: 8px; }
.wil-layer { display: grid; grid-template-columns: var(--w) minmax(0, 1fr); gap: 14px; align-items: center; }
.wil-layer__bar { display: block; padding: 12px 14px; color: var(--bone); font-weight: 700; font-size: .9rem; line-height: 1.3; }
.wil-layer__note { font-size: .9rem; line-height: 1.4; color: var(--muted); }
.wil-day__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wil-day__list li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 4px 12px; align-items: center; }
.wil-day__t { font-size: var(--fs-small); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.wil-day__track { position: relative; height: 14px; background: linear-gradient(to right, var(--line-light) 1px, transparent 1px) 0 0 / calc(100% / 6) 100%; }
.wil-day__track i { position: absolute; top: 0; bottom: 0; left: calc(var(--s) / 18 * 100%); width: calc((var(--e) - var(--s)) / 18 * 100%); min-width: 6px; }
.wil-day__l { grid-column: 2; font-size: .9rem; line-height: 1.4; color: var(--ink); }
.wil-split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wil-split__seg { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.wil-split__bar { padding: 14px; color: var(--bone); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3; }
.wil-split__note { padding-right: 10px; font-size: .88rem; line-height: 1.4; color: var(--muted); }
.wil-moon { text-align: center; }
.wil-moon__n { font-weight: 700; color: var(--ink); }
.wil-moon__path { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.wil-moon__path span { flex: 1; height: 16px; border-top: 3px dashed var(--oxblood); border-bottom: 3px dashed var(--oxblood); }
.wil-moon__earth { width: 44px; height: 44px; border-radius: 50%; background: var(--ink); flex-shrink: 0; }
.wil-moon__moon { width: 20px; height: 20px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.wil-moon__sub { font-size: .9rem; color: var(--muted); }
.wil-bars__row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(8px, 2vw, 20px); align-items: end; height: 230px; }
.wil-bars__col { min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; text-align: center; gap: 6px; }
.wil-bars__col i { display: block; height: calc(var(--h) * .7); min-height: 6px; }
.wil-bars__col b { font-size: clamp(.78rem, 2.4vw, 1.05rem); line-height: 1.15; color: var(--ink); }
.wil-bars__col span { font-size: clamp(.7rem, 2vw, .85rem); line-height: 1.25; color: var(--muted); }

/* AUTHOR + REBEL MEMO */
.wil-col { max-width: 42rem; margin-inline: auto; padding-inline: var(--gutter); box-sizing: content-box; }
.wil-author, .wil-rebel { padding-block: clamp(56px, 8vw, 96px); }
.wil-author { background: var(--ink); color: var(--bone-72); }
.wil-author .kicker, .wil-author .wil-bp { color: var(--ox-bright); }
.wil-author .kicker::before { background: var(--ox-bright); }
.wil-author .wil-h2 { color: var(--bone); margin: 10px 0 16px; }
.wil-author p + p { margin-top: 1em; }
.wil-author .textlink { color: var(--bone); }
.wil-rebel { background: var(--oxblood); color: var(--bone); }
.wil-rebel .kicker { color: var(--bone); }
.wil-rebel .kicker::before { background: var(--bone); }
.wil-rebel .wil-h2 { color: var(--bone); margin: 10px 0 12px; }
.wil-rebel .signup { margin-top: 24px; }
.wil-rebel .signup a { color: inherit; }
.wil-legal { margin-top: 40px; font-size: .75rem; line-height: 1.55; color: var(--bone-72); }

/* RESPONSIVE */
@media (max-width: 1100px) {
  .wil-body { grid-template-columns: minmax(0, 1fr); max-width: 42rem; margin-inline: auto; padding-inline: var(--gutter); box-sizing: content-box; }
  .wil-toc { grid-column: 1; position: static; justify-self: stretch; max-width: none; margin-bottom: 40px; }
  .wil-article { grid-column: 1; }
  .wil-plate { margin-inline: 0; }
}
@media (max-width: 760px) {
  .wil-hero__grid { grid-template-columns: minmax(0, 1fr); }
  .wil-hero__art { order: -1; margin-inline: calc(var(--gutter) * -1); }
  .wil-layer { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .wil-layer__bar { width: var(--w); min-width: fit-content; max-width: 100%; box-sizing: border-box; }
  .wil-layer__note { margin-bottom: 6px; }
  .wil-split { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wil-table--list td:nth-child(2) { width: auto; }
  .wil-table--two td:first-child { width: 34%; }
}

/* Short text: avoid a lone last word (long reading text keeps normal flow) */
.wil-table td, .wil-layer__note, .wil-split__note, .wil-split__bar, .wil-day__l, .wil-card p, .wil-stats dd, .wil-note, .wil-callout p, .wil-sheet li, .wil-author p, .wil-rebel p { text-wrap: pretty; }

/* Small phones: stack two-column and toolkit tables instead of squeezing columns */
@media (max-width: 520px) {
  .wil-table--two tr, .wil-table--list tr { display: block; border-bottom: 1px solid var(--line-light); padding-block: 10px; }
  .wil-table--two td, .wil-table--list td { display: block; width: auto !important; padding: 0; border: 0; }
  .wil-table--two td:first-child { margin-bottom: 2px; }
  .wil-table--list tr { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); }
  .wil-table--list td:first-child { grid-row: span 2; }
  .wil-table--list td:last-child { grid-column: 2; }
}
