/* The frame around every page: sky, bar, tabs, footer, sheet, shared words. Page styles live in src/pages/<page>.css. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); color: var(--ink); font-family: var(--face); font-size: var(--fs-body); line-height: var(--lh-text);
  -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; color-scheme: dark; scroll-padding-top: var(--bar-h); }
body { margin: 0; min-height: 100svh; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: var(--edge); top: -64px; z-index: 40; background: var(--accent); color: var(--accent-ink); padding: var(--sp-2) var(--sp-4); border-radius: 8px; text-decoration: none; font-weight: 600; transition: top var(--touch) var(--shutter); }
.skip:focus { top: var(--sp-3); }

/* the sky under everything. Without WebGL the same dusk stays as a plain gradient */
#sky { position: fixed; inset: 0; width: 100%; height: 100lvh; display: block; z-index: 0; opacity: 0; transition: opacity var(--turn) var(--shutter); }
html.sky-on #sky { opacity: 1; }
html:not(.sky-on)::before { content: ''; position: fixed; inset: 0; z-index: 0; background: linear-gradient(#0f1f45, #2c2a5c 46%, #6e3346 62%, var(--ground) 62.4%); }
html[data-mode='red']:not(.sky-on)::before { background: var(--ground); }

.bar, #main, .foot, .tabs { position: relative; z-index: 2; }

/* bar */
.bar::before { content: ''; position: absolute; inset: 0 0 -48px 0; background: linear-gradient(rgb(4 6 9 / 62%), transparent); pointer-events: none; z-index: -1; }
html[data-mode='red'] .bar::before { background: linear-gradient(rgb(7 0 0 / 70%), transparent); }
.bar { transition: background var(--sheet) var(--shutter); }
.is-scrolled:not(.bar-clear) .bar { background: var(--veil); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
@supports not (backdrop-filter: blur(1px)) { .is-scrolled:not(.bar-clear) .bar { background: var(--ground-up); } }
@media (prefers-reduced-transparency: reduce) { .is-scrolled:not(.bar-clear) .bar { background: var(--ground-up); backdrop-filter: none; } }
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: 0 var(--edge); z-index: 20; }
.mark { display: inline-flex; align-items: center; gap: var(--sp-2); text-decoration: none; font-weight: 560; font-stretch: var(--wide); letter-spacing: -.01em; font-size: 20px; padding: var(--sp-2) 0; }
.mark svg { width: 26px; height: 26px; overflow: visible; }
.mark path { stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-dasharray: 40; stroke-dashoffset: 0; transition: stroke-dashoffset var(--turn) var(--shutter); }
.mark circle { fill: var(--accent); }
.mark:hover path { stroke-dashoffset: 80; }
.links { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 36px); }
.links a { position: relative; text-decoration: none; color: var(--ink-soft); padding: var(--sp-2) 0; transition: color var(--touch) var(--shutter); }
.links a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 3px; height: 2px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform var(--sheet) var(--shutter); }
.links a:hover { color: var(--ink); }
.links a:hover::after { transform: scaleX(1); }
.links a[aria-current='page'] { color: var(--ink); font-weight: 620; }
.tools { display: flex; align-items: center; gap: var(--sp-3); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-4); border-radius: 999px; background: var(--veil); color: var(--ink); transition: background var(--touch) var(--shutter), transform var(--sheet) var(--hand); }
.chip:hover { background: var(--ground-hi); }
.chip:active { transform: scale(.96); }
.chip--round { width: 40px; padding: 0; justify-content: center; }
.chip svg { width: 20px; height: 20px; }
[data-night] circle { fill: #e5483a; }
html[data-mode='red'] [data-night] circle { fill: none; stroke: currentColor; stroke-width: 2; }

@media (max-width: 820px) {
  .links { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding: 0 var(--edge) env(safe-area-inset-bottom); justify-content: space-between; gap: 0; background: var(--veil); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 20; }
  .links a { padding: var(--sp-3) var(--sp-1); font-size: 16px; }
  .links a::after { display: none; }
  .wide { display: none; }
  body { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
}
@supports not (backdrop-filter: blur(1px)) { .links { background: var(--ground-up); } }
@media (prefers-reduced-transparency: reduce) { .links { background: var(--ground-up); backdrop-filter: none; } }

/* pages: reading happens on the ground */
#main { outline: none; transition: opacity var(--touch) var(--shutter); }
#main.is-leaving { opacity: 0; }
.page { padding: calc(var(--bar-h) + 22svh) var(--edge) var(--sp-9); min-height: 100svh; }
.page-title { font-size: var(--fs-1); font-weight: 460; font-stretch: var(--wide); line-height: var(--lh-tight); letter-spacing: -.015em; max-width: 16ch; }
.page-lead { font-size: var(--fs-lead); line-height: 1.32; color: var(--ink-soft); margin-top: var(--sp-5); max-width: 40ch; }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { font-size: var(--fs-3); font-weight: 520; font-stretch: 112%; line-height: 1.2; margin-top: var(--sp-7); }
.section-title { font-size: var(--fs-2); font-weight: 460; font-stretch: var(--wide); line-height: 1.08; letter-spacing: -.012em; }
.text-link { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--ink-faint); transition: text-decoration-color var(--touch) var(--shutter); }
.text-link:hover { text-decoration-color: var(--accent); }

/* the signature in type: a line draws out sideways */
.js [data-draw] { transform-origin: left center; }
.js .is-drawing [data-draw], .js [data-draw].is-drawing { animation: draw var(--draw-time, var(--turn)) var(--shutter) both; animation-delay: var(--draw-delay, 0ms); }
@keyframes draw { from { transform: scaleX(.62); opacity: 0; } 42% { opacity: 1; } to { transform: none; opacity: 1; } }

/* buttons */
.act { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 48px; padding: 0 var(--sp-5); border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; transition: transform var(--sheet) var(--hand), background var(--touch) var(--shutter); }
.act:active { transform: scale(.96); }
.act--quiet { background: var(--ground-hi); color: var(--ink); }

/* footer */
.foot { background: var(--ground); padding: var(--sp-8) var(--edge) var(--sp-7); display: grid; gap: var(--sp-6); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: end; }
.foot-now { font-size: var(--fs-lead); line-height: 1.3; font-stretch: 112%; max-width: 30ch; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2) var(--sp-5); color: var(--ink-soft); }
.foot-links a { text-decoration: none; padding: var(--sp-2) 0; }
.foot-links a:hover { color: var(--ink); }
.foot-note { grid-column: 1 / -1; color: var(--ink-soft); }
@media (max-width: 820px) { .foot { grid-template-columns: 1fr; } .foot-links { justify-content: flex-start; } }

/* place sheet */
.sheet { border: 0; padding: 0; margin: auto; width: min(560px, calc(100vw - 2 * var(--sp-4))); max-height: min(76svh, 640px); background: var(--ground-up); color: var(--ink); border-radius: 18px; box-shadow: 0 24px 80px -24px rgb(0 0 0 / 80%); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet var(--sheet) var(--shutter) both; }
.sheet::backdrop { background: rgb(0 0 0 / 55%); }
@keyframes sheet { from { opacity: 0; transform: scaleX(.94); } to { opacity: 1; transform: none; } }
.sheet-head { padding: var(--sp-5) var(--sp-5) var(--sp-3); display: grid; gap: var(--sp-3); }
.sheet-head h2 { font-size: var(--fs-3); font-stretch: 112%; font-weight: 520; line-height: 1.15; }
.sheet-note { color: var(--ink-soft); }
.field { width: 100%; min-height: 48px; padding: 0 var(--sp-4); border: 0; border-radius: 12px; background: var(--ground-hi); }
.field::placeholder { color: var(--ink-faint); }
.field:focus-visible { outline-offset: 0; }
.place-list { overflow: auto; padding: 0 var(--sp-3) var(--sp-3); flex: 1; }
.place-list button { display: flex; justify-content: space-between; gap: var(--sp-4); width: 100%; text-align: left; padding: var(--sp-3); border-radius: 10px; }
.place-list button:hover, .place-list button:focus-visible { background: var(--ground-hi); }
.place-list span { color: var(--ink-soft); }
.place-empty { padding: var(--sp-3); color: var(--ink-soft); }
.sheet-foot { display: flex; justify-content: flex-end; padding: var(--sp-3) var(--sp-5) var(--sp-4); }
