/* Celestial Code: "Volvelle" design system. Tokens documented in ../../MASTER.md */
:root {
  /* paper & ink */
  --paper: #EFE6D2;
  --paper-deep: #E6D9BB;
  --paper-light: #F6F0E2;
  --ink: #1A1A2E;
  --ink-soft: #45445C;
  --rule: rgba(26, 26, 46, .32);
  --rule-strong: #1A1A2E;
  /* gilding & thread */
  --gold: #C9A84C;        /* decoration only, never text on paper */
  --gold-ink: #7A5B17;    /* gold for text on paper, 5.1:1 */
  --thread: #9B2D20;      /* the single pointer accent */
  --focus: #9B2D20;
  /* type */
  --f-display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --f-caps: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --f-body: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --f-glyph: "Noto Sans Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", serif;
  --t-xs: 14px; --t-sm: 16px; --t-md: 20px; --t-lg: 23px;
  --t-xl: clamp(26px, 3vw, 32px);
  --t-2xl: clamp(32px, 4.2vw, 46px);
  --t-3xl: clamp(40px, 6vw, 72px);
  /* space (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --measure: 34em;
  --page: 1120px;
  /* motion */
  --ease-wheel: cubic-bezier(.22, .8, .25, 1);
  --ease-ui: cubic-bezier(.2, 0, 0, 1);
  --d-wheel: 2200ms;
  --d-ui: 180ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--f-body);
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
}
/* laid-paper grain, fixed so it does not repaint on scroll */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    repeating-linear-gradient(0deg, rgba(26,26,46,.025) 0 1px, transparent 1px 5px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .36  0 0 0 0 .29  0 0 0 0 .17  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; transition: text-decoration-thickness var(--d-ui) var(--ease-ui), color var(--d-ui) var(--ease-ui); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.g { font-family: var(--f-glyph); font-variant-emoji: text; font-variant-numeric: normal; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.wrap { width: min(var(--page), 100% - 2 * var(--s4)); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(var(--page), 100% - 2 * var(--s7)); } }
section { padding-block: var(--s9); }
@media (max-width: 719px) { section { padding-block: var(--s8); } }
.split { display: grid; gap: var(--s7); align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1.05fr; } .split.rev > :first-child { order: 2; } }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.04; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); line-height: 1.12; }
h1 i, h2 i, h3 i { color: var(--gold-ink); }
p { margin: 0 0 var(--s4); max-width: var(--measure); text-wrap: pretty; }
.lead { font-size: var(--t-lg); line-height: 1.5; }
.kicker {
  font-family: var(--f-caps); font-size: var(--t-xs); letter-spacing: .2em;
  display: inline-block; padding-bottom: var(--s2); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--rule-strong);
}
.small { font-size: var(--t-sm); color: var(--ink-soft); }
.num { font-variant-numeric: lining-nums tabular-nums; }

/* ---------- rules & ornaments ---------- */
.rule { border: 0; border-top: 1px solid var(--rule-strong); margin: 0; }
.rule-double { border: 0; height: 4px; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); margin: 0; }
.orn { text-align: center; font-family: var(--f-glyph); color: var(--gold-ink); letter-spacing: .55em; font-size: 17px; padding-block: var(--s6); user-select: none; }

/* ---------- header / footer ---------- */
.site-head { border-bottom: 1px solid var(--rule-strong); background: var(--paper); position: relative; z-index: 2; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 72px; flex-wrap: wrap; padding-block: var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; font-family: var(--f-caps); font-size: 19px; letter-spacing: .14em; }
.brand svg { width: 34px; height: 34px; }
.nav { display: flex; gap: var(--s5); flex-wrap: wrap; font-family: var(--f-caps); font-size: var(--t-sm); letter-spacing: .1em; }
.nav a { text-decoration: none; padding-block: var(--s2); border-bottom: 1px solid transparent; transition: border-color var(--d-ui) var(--ease-ui); }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--thread); }
@media (max-width: 719px) {
  .site-head .wrap { min-height: 0; gap: var(--s2); }
  .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: var(--s4); font-size: 15px; letter-spacing: .06em; white-space: nowrap; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}

.site-foot { border-top: 3px double var(--rule-strong); padding-block: var(--s7) var(--s8); font-size: var(--t-sm); }
.site-foot .cols { display: grid; gap: var(--s6); }
@media (min-width: 800px) { .site-foot .cols { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-foot h4 { font-family: var(--f-caps); font-weight: 400; letter-spacing: .16em; font-size: var(--t-xs); margin: 0 0 var(--s3); }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.site-foot .fine { margin-top: var(--s6); color: var(--ink-soft); font-size: var(--t-xs); max-width: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s3);
  font-family: var(--f-caps); font-size: 18px; letter-spacing: .12em; line-height: 1.1;
  min-height: 52px; padding: var(--s3) var(--s6);
  background: var(--ink); color: var(--paper-light); border: 1px solid var(--ink);
  text-decoration: none; cursor: pointer; border-radius: 0;
  transition: background-color var(--d-ui) var(--ease-ui), color var(--d-ui) var(--ease-ui);
}
.btn:hover { background: #2C2C48; }
.btn:active { background: #000; }
.btn[disabled], .btn[aria-disabled="true"] { background: transparent; color: var(--ink-soft); border-color: var(--rule); cursor: not-allowed; }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper-light); }
.btn .price { font-family: var(--f-body); letter-spacing: 0; font-size: 19px; padding-left: var(--s3); border-left: 1px solid currentColor; }
.btn-row { display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center; }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--s1); }
.field label, .legend { font-family: var(--f-caps); font-size: var(--t-xs); letter-spacing: .16em; }
.input, select.input {
  font: 400 var(--t-md)/1.3 var(--f-body); color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid var(--rule-strong); border-radius: 0;
  padding: var(--s2) 2px; min-height: 48px; width: 100%;
  transition: border-color var(--d-ui) var(--ease-ui), background-color var(--d-ui) var(--ease-ui);
}
.input:hover { background: rgba(255,255,255,.25); }
.input:focus { outline: none; border-bottom: 2px solid var(--thread); background: rgba(255,255,255,.35); }
.input:disabled { color: var(--ink-soft); border-bottom-style: dashed; }
.input[aria-invalid="true"] { border-bottom-color: var(--thread); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: right 10px top 55%, right 4px top 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 22px; }
.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-sm); line-height: 1.45; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--ink); flex: none; }
.error { color: var(--thread); font-size: var(--t-sm); min-height: 1.4em; margin: 0; }

/* ---------- slips (cards) ---------- */
.slips { display: grid; gap: var(--s5); }
@media (min-width: 800px) { .slips { grid-template-columns: repeat(3, 1fr); } }
.slip {
  position: relative; background: var(--paper-light); border: 1px solid var(--rule-strong);
  padding: var(--s6) var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s3);
  outline: 1px solid var(--rule); outline-offset: -7px;
}
.slip .tag { font-family: var(--f-caps); font-size: var(--t-xs); letter-spacing: .18em; color: var(--gold-ink); }
.slip h3 { font-size: 28px; }
.slip p { font-size: 18px; margin: 0; }
.slip .foot { margin-top: auto; padding-top: var(--s4); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; border-top: 1px solid var(--rule); }
.slip .cost { font-family: var(--f-display); font-size: 28px; }
.slip .cost small { font-family: var(--f-body); font-size: var(--t-sm); color: var(--ink-soft); }
a.slip { text-decoration: none; transition: background-color var(--d-ui) var(--ease-ui); }
a.slip:hover { background: #FBF7EC; }
.slip .seal { position: absolute; top: -14px; right: 18px; background: var(--thread); color: var(--paper-light); font-family: var(--f-caps); font-size: 13px; letter-spacing: .14em; padding: 4px 10px; }

/* ---------- ledger tables ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 18px; }
.ledger caption { text-align: left; font-family: var(--f-display); font-size: var(--t-xl); padding-bottom: var(--s3); }
.ledger th { font-family: var(--f-caps); font-weight: 400; font-size: var(--t-xs); letter-spacing: .16em; text-align: left; border-bottom: 1px solid var(--rule-strong); padding: var(--s2) var(--s3) var(--s2) 0; }
.ledger td { border-bottom: 1px solid var(--rule); padding: var(--s3) var(--s3) var(--s3) 0; vertical-align: top; font-variant-numeric: lining-nums tabular-nums; }
.ledger td.g { font-size: 22px; color: var(--gold-ink); width: 36px; }
.ledger tr.mark td { background: rgba(201,168,76,.18); }
.table-scroll { overflow-x: auto; }

/* ---------- lists ---------- */
.pointing { list-style: none; padding: 0; margin: 0 0 var(--s5); display: grid; gap: var(--s3); max-width: var(--measure); }
.pointing li { padding-left: 30px; position: relative; }
.pointing li::before { content: "\2609\FE0E"; font-family: var(--f-glyph); position: absolute; left: 0; top: .1em; color: var(--gold-ink); font-size: 18px; }

/* ---------- FAQ ---------- */
.faq details { border-top: 1px solid var(--rule-strong); padding-block: var(--s4); }
.faq details:last-child { border-bottom: 1px solid var(--rule-strong); }
.faq summary { cursor: pointer; font-family: var(--f-display); font-size: var(--t-lg); list-style: none; display: flex; justify-content: space-between; gap: var(--s4); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-body); color: var(--gold-ink); transition: transform var(--d-ui) var(--ease-ui); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: var(--s3); }

/* ---------- volvelle ---------- */
.volvelle { width: 100%; max-width: 540px; margin-inline: auto; aspect-ratio: 1; }
.volvelle .ring { transform-box: view-box; transform-origin: 50% 50%; transition: transform var(--d-wheel) var(--ease-wheel); }
.volvelle .ring.dim { opacity: .35; transition: transform var(--d-wheel) var(--ease-wheel), opacity 600ms var(--ease-ui); }
/* calculator layout: heading, wheel, form on phones; wheel beside both on desktop */
.hero-grid { display: grid; gap: var(--s6); grid-template-areas: "head" "wheel" "form"; }
.hero-grid .hg-head { grid-area: head; } .hero-grid .hg-form { grid-area: form; } .hero-grid .hg-wheel { grid-area: wheel; }
.hero-grid .hg-head .lead { margin-bottom: 0; }
@media (max-width: 899px) { .hero-grid .volvelle { max-width: 340px; } }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1fr 1.05fr; column-gap: var(--s7); row-gap: var(--s5); grid-template-areas: "head wheel" "form wheel"; align-items: start; }
  .hero-grid.wheel-left { grid-template-columns: 1.05fr 1fr; grid-template-areas: "wheel head" "wheel form"; }
  .hero-grid .hg-wheel { align-self: center; }
}
.vol-legend { display: flex; justify-content: center; gap: var(--s5); flex-wrap: wrap; font-family: var(--f-caps); font-size: var(--t-xs); letter-spacing: .14em; color: var(--ink-soft); margin-top: var(--s4); }
.vol-legend b { color: var(--ink); font-weight: 400; }

/* calculator */
.calc { display: grid; gap: var(--s5); }
.calc .row { display: grid; gap: var(--s4); grid-template-columns: 1.4fr .8fr 1fr; }
@media (max-width: 520px) { .calc .row { grid-template-columns: 1fr 1fr; } .calc .row .field:first-child { grid-column: 1 / -1; } }
.calc .row2 { display: grid; gap: var(--s4); grid-template-columns: .8fr 1.6fr; align-items: end; }
@media (max-width: 520px) { .calc .row2 { grid-template-columns: 1fr; } }
.result { border-top: 3px double var(--rule-strong); padding-top: var(--s5); }
.result[hidden] { display: none; }
.result .trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin-bottom: var(--s5); }
.result .trio div { border: 1px solid var(--rule-strong); padding: var(--s4) var(--s2) var(--s3); text-align: center; background: var(--paper-light); }
.result .trio .g { font-size: 40px; line-height: 1.25; display: block; }
.result .trio b { font-family: var(--f-display); font-weight: 400; font-size: 22px; display: block; line-height: 1.1; }
.result .trio small { font-family: var(--f-caps); font-size: 12px; letter-spacing: .16em; color: var(--ink-soft); }
.result .notes p { font-size: 18px; }
.result .notes b { font-family: var(--f-caps); font-weight: 400; letter-spacing: .08em; }
.result .caution { font-size: var(--t-sm); color: var(--thread); }

/* ---------- hero ---------- */
.hero { padding-block: var(--s8) var(--s9); }
.hero h1 { margin-bottom: var(--s5); }
.page-head { padding-block: var(--s8) var(--s7); border-bottom: 1px solid var(--rule-strong); }
.page-head p { margin-top: var(--s4); }

/* ---------- plain prose (legal) ---------- */
.prose { max-width: 40em; }
.prose h2 { font-size: var(--t-xl); margin: var(--s7) 0 var(--s3); }
.prose p, .prose li { font-size: 19px; max-width: none; }
.prose ul { padding-left: 1.2em; margin: 0 0 var(--s4); }
.prose .stamp { display: inline-block; border: 1px solid var(--thread); color: var(--thread); font-family: var(--f-caps); font-size: var(--t-xs); letter-spacing: .14em; padding: var(--s1) var(--s3); margin-bottom: var(--s5); }

/* ---------- band (dark night print) ---------- */
.band { background: var(--ink); color: var(--paper-light); }
.band .kicker { border-bottom-color: var(--gold); color: var(--gold); }
.band h2 i, .band h3 i { color: var(--gold); }
.band .btn { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.band .btn:hover { background: #D8BB66; }
.band .small { color: #C9C4D8; }
.band .pointing li::before { color: var(--gold); }
.band a { color: var(--paper-light); }

/* ---------- misc ---------- */
.notice { border: 1px solid var(--rule-strong); background: var(--paper-light); padding: var(--s4) var(--s5); font-size: 18px; max-width: var(--measure); }
.center { text-align: center; }
.center p { margin-inline: auto; }
.mt-5 { margin-top: var(--s5); } .mt-6 { margin-top: var(--s6); } .mt-7 { margin-top: var(--s7); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* town picker */
.picker { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 0; padding: 0; list-style: none; background: var(--paper-light); border: 1px solid var(--rule-strong); max-height: 330px; overflow-y: auto; }
.picker li { padding: var(--s3) var(--s4); font-size: 18px; line-height: 1.3; cursor: pointer; border-bottom: 1px solid var(--rule); }
.picker li:last-child { border-bottom: 0; }
.picker li[aria-selected="true"], .picker li[role="option"]:hover { background: var(--ink); color: var(--paper-light); }
.picker li.note { cursor: default; color: var(--ink-soft); font-style: italic; }
