/* Simvex draft B. A street poster that reprints a woodblock print.
   Ground: flat sky. Paper is the white. Sumi is the ink. Red is only ever a stamped verdict.
   Fonts (SIL OFL, files in ./fonts): Fredoka for titles, Atkinson Hyperlegible Next for reading, Red Hat Mono for numbers. */
@font-face { font-family: "Fredoka"; src: url(fonts/fredoka.woff2) format("woff2"); font-weight: 300 700; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url(fonts/atkinson-next.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Red Hat Mono"; src: url(fonts/redhatmono.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --sky: #6CBFEE; --sky-2: #8ED0F4; --sky-ink: #0F3554;
  --paper: #F5EEE1; --paper-2: #EADFCB; --paper-3: #DCCDB2;
  --sumi: #1A1714; --sumi-2: rgba(26, 23, 20, .78); --sumi-3: rgba(26, 23, 20, .6);
  --ai: #1C3F94; --ai-2: #2E5DB8; --ai-3: #5C8AD0;
  --beni: #E2372B; --kihada: #F6C62F; --ochre: #C99A4E;
  --up: #047857; --down: #BE123C;
  --f-title: "Fredoka", ui-rounded, sans-serif;
  --f-body: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --f-mono: "Red Hat Mono", ui-monospace, monospace;
  --t-xl: clamp(44px, 11.2vw, 176px);
  --t-l: clamp(28px, 2.8vw, 40px);
  --t-m: 22px; --t-s: 18px; --t-xs: 15px;
  --pad: clamp(16px, 2.2vw, 32px);
  --e-out: cubic-bezier(.22, 1, .36, 1); --e-long: cubic-bezier(.16, 1, .3, 1); --e-ui: cubic-bezier(.4, 0, .2, 1);
  --specks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -11 7.4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sky); color: var(--sumi); font: 400 var(--t-s)/1.5 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, canvas { display: block; }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--kihada); color: var(--sumi); }
:focus-visible { outline: 3px solid var(--sumi); outline-offset: 4px; }

/* ---------- bookmark tabs: paper slips hanging from the top edge ---------- */
.tabs { position: absolute; top: 0; left: var(--pad); z-index: 30; display: flex; align-items: flex-start; gap: 6px; }
.tab { --tab: var(--paper); --tab-ink: var(--sumi); position: relative; display: inline-flex; align-items: flex-end; gap: 8px; min-height: 58px;
  padding: 18px 16px 16px; background: var(--tab); color: var(--tab-ink); border: 0; font: 600 var(--t-xs)/1 var(--f-title); letter-spacing: .01em;
  text-decoration: none; cursor: pointer; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 9px), 0 100%);
  transform: translateY(-8px); transition: transform 180ms var(--e-ui), background-color 150ms var(--e-ui); }
.tab:hover { transform: translateY(-2px); }
.tab:active { transform: translateY(-4px) scale(.97); }
.tab[aria-current="page"], .tab[aria-selected="true"] { transform: translateY(0); min-height: 70px; }
.tab:focus-visible { outline: 3px solid var(--sumi); outline-offset: -6px; }
.tab-y { --tab: var(--kihada); }
.tab-b { --tab: var(--ai); --tab-ink: var(--paper); }
.tab-b:focus-visible { outline-color: var(--paper); }
.tab-k { --tab: var(--sumi); --tab-ink: var(--paper); }
.tab-k:focus-visible { outline-color: var(--paper); }
.tab-mark { padding-right: 18px; font-size: 18px; }
.mark { width: 22px; height: 22px; flex: none; }

/* ---------- underlined text links are the buttons ---------- */
.ul { position: relative; color: inherit; font: 600 1em/1.2 var(--f-title); text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(var(--kihada), var(--kihada));
  background-size: 100% 3px, 100% 0; background-position: 0 100%, 0 100%; background-repeat: no-repeat; padding-bottom: 3px;
  transition: background-size 200ms var(--e-out), transform 150ms var(--e-ui); display: inline; }
.ul:hover { background-size: 100% 3px, 100% 46%; }
.ul:active { transform: scale(.94); display: inline-block; }
.ul[aria-disabled="true"], .ul:disabled { opacity: .5; cursor: not-allowed; }
.ul.big { font-size: var(--t-m); }
.ul.on-dark { background-image: linear-gradient(var(--paper), var(--paper)), linear-gradient(var(--beni), var(--beni)); }
.ul.on-dark:focus-visible { outline-color: var(--paper); }

/* ---------- the stamp: a carved seal, red, specked like a real impression ---------- */
.stamp { display: inline-grid; place-items: center; padding: 8px 12px 7px; background: var(--beni); color: var(--paper); font: 700 var(--t-m)/1 var(--f-title);
  letter-spacing: .02em; border-radius: 5px; -webkit-mask: var(--specks); mask: var(--specks); white-space: nowrap; }
.stamp.ink { background: var(--sumi); }
.stamp.hollow { background: transparent; color: var(--sumi); box-shadow: inset 0 0 0 3px currentColor; }
.stamp.land { animation: stamp 220ms var(--e-out) both; }
@keyframes stamp { from { transform: scale(1.35) rotate(var(--r, 0deg)); opacity: 0; } to { transform: scale(1) rotate(var(--r, 0deg)); opacity: 1; } }

/* ---------- print sheets: paper, thick and thin border ---------- */
.sheet { position: relative; margin: 0; background: var(--paper); padding: 10px; box-shadow: 0 1px 0 rgba(26,23,20,.12), 0 18px 30px -18px rgba(26,23,20,.5); }
.sheet::before { content: ""; position: absolute; inset: 6px; border: 3px solid var(--sumi); pointer-events: none; z-index: 2; }
.sheet::after { content: ""; position: absolute; inset: 12px; border: 1px solid var(--sumi); pointer-events: none; z-index: 2; }
.sheet canvas { width: 100%; height: 100%; }
.cartouche { position: absolute; z-index: 3; background: var(--paper); padding: 10px 14px 10px; box-shadow: inset 0 0 0 3px var(--sumi), inset 0 0 0 6px var(--paper), inset 0 0 0 7px var(--sumi); }
.cartouche .c-t { display: block; font: 600 var(--t-m)/1.1 var(--f-title); }
.cartouche .c-n { display: block; font: 600 var(--t-l)/1.05 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cartouche .c-s { display: block; font: 400 var(--t-xs)/1.3 var(--f-body); color: var(--sumi-2); }

/* ---------- map legend ---------- */
.legend { font: 400 var(--t-xs)/1.35 var(--f-body); }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legend li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; }
.key { width: 26px; height: 12px; display: block; }
.key.ridge { height: 4px; background: var(--sumi); border-radius: 2px; }
.key.water { background: radial-gradient(circle, var(--ai-2) 45%, transparent 47%) 0 0/6px 6px; height: 14px; }
.key.post { height: 6px; background: var(--beni); }
.key.seal { width: 16px; height: 16px; background: var(--beni); border-radius: 3px; }

/* ---------- dialog: a paper slip pulled down from its tab ---------- */
dialog.slip { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; color: var(--sumi); }
dialog.slip::backdrop { background: rgba(15, 53, 84, .45); }
dialog.slip[open] .slip-in { animation: slipin 250ms var(--e-out) both; }
@keyframes slipin { from { transform: translateY(-14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.slip-in { background: var(--paper); padding: 34px 32px 28px; position: relative; box-shadow: inset 0 0 0 3px var(--sumi), inset 0 0 0 9px var(--paper), inset 0 0 0 10px var(--sumi); }
.slip-in h2 { font: 700 34px/1 var(--f-title); margin: 0 0 16px; letter-spacing: -.02em; }
.slip-in ol { margin: 0 0 18px; padding-left: 1.3em; display: grid; gap: 10px; }
.slip-in p { margin: 0 0 14px; }
.x-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--sumi); border-radius: 8px; transition: background-color 150ms var(--e-ui), transform 150ms var(--e-ui); }
.x-close:hover { background: var(--paper-2); }
.x-close:active { transform: scale(.94); }
code, pre { font-family: var(--f-mono); font-size: var(--t-xs); }
code { background: rgba(26, 23, 20, .07); padding: 1px 5px; border-radius: 4px; }

/* ---------- controls ---------- */
.switch { --w: 2.2em; position: relative; display: inline-block; width: var(--w); height: 1.1em; flex: none; border-radius: 1em; border: 0; background: var(--sumi-3); cursor: pointer; padding: 0;
  transition: background-color 200ms var(--e-ui), transform 150ms var(--e-ui); vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: .12em; left: .12em; width: .86em; height: .86em; border-radius: 50%; background: var(--paper); transition: transform 250ms var(--e-out); }
.switch[aria-checked="true"] { background: var(--sumi); }
.switch[aria-checked="true"]::after { transform: translateX(1.1em); }
.switch:active { transform: scale(.96); }
.switch::before { content: ""; position: absolute; inset: -12px; }
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(26, 23, 20, .1); padding: 3px; border-radius: 10px; position: relative; }
.seg button { position: relative; z-index: 1; min-height: 40px; padding: 0 14px; border: 0; background: transparent; font: 600 var(--t-xs)/1 var(--f-title); color: var(--sumi-2); cursor: pointer; border-radius: 8px; transition: color 150ms var(--e-ui), transform 150ms var(--e-ui); white-space: nowrap; }
.seg button:hover { color: var(--sumi); }
.seg button:active { transform: scale(.97); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { color: var(--paper); }
.seg .seg-ind { position: absolute; top: 3px; bottom: 3px; left: 3px; background: var(--sumi); border-radius: 8px; transition: transform 250ms var(--e-out), width 0ms; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: var(--sumi); border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--kihada); box-shadow: inset 0 0 0 3px var(--sumi); transition: transform 150ms var(--e-ui); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-track { height: 6px; background: var(--sumi); border-radius: 3px; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--kihada); border: 3px solid var(--sumi); }
.field { display: grid; gap: 6px; }
.field label { font: 600 var(--t-xs)/1.2 var(--f-title); }
.field input[type="text"], .field select { font: 500 16px/1 var(--f-mono); min-height: 44px; padding: 0 12px; background: var(--paper); border: 0; border-radius: 8px; color: var(--sumi);
  box-shadow: inset 0 0 0 2px var(--sumi); font-variant-numeric: tabular-nums; transition: box-shadow 150ms var(--e-ui); }
.field input[type="text"]:hover, .field select:hover { box-shadow: inset 0 0 0 3px var(--sumi); }
.field input[type="text"]:focus-visible, .field select:focus-visible { outline: 3px solid var(--kihada); outline-offset: 2px; }
.field input[aria-invalid="true"] { box-shadow: inset 0 0 0 3px var(--beni); }
.hint { font: 400 var(--t-xs)/1.35 var(--f-body); color: var(--sumi-2); min-height: 1.35em; }
.hint.err { color: var(--down); }
.shake { animation: shake 280ms var(--e-ui); }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 55% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }

/* a press button: the one filled action per screen */
.press { position: relative; display: inline-grid; place-items: center; min-height: 52px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--sumi); color: var(--paper);
  font: 600 var(--t-s)/1 var(--f-title); cursor: pointer; transition: transform 150ms var(--e-ui), background-color 150ms var(--e-ui); }
.press > span { grid-area: 1 / 1; transition: opacity 150ms var(--e-ui); }
.press:hover { background: #2E2924; }
.press:active { transform: scale(.97); }
.press:focus-visible { outline: 3px solid var(--kihada); outline-offset: 3px; }
.press[aria-busy="true"] { cursor: progress; }
.press:disabled { opacity: .5; cursor: not-allowed; }
.press .when-busy, .press .when-ok, .press .when-err { opacity: 0; }
.press[data-state="busy"] .when-idle, .press[data-state="ok"] .when-idle, .press[data-state="err"] .when-idle { opacity: 0; }
.press[data-state="busy"] .when-busy, .press[data-state="ok"] .when-ok, .press[data-state="err"] .when-err { opacity: 1; }
.press[data-state="err"] { background: var(--down); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; display: inline-block; vertical-align: -3px; margin-right: 8px; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* copy button for code */
.copy { position: relative; display: inline-grid; place-items: center; min-width: 88px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--paper); color: var(--sumi);
  box-shadow: inset 0 0 0 2px var(--sumi); font: 600 var(--t-xs)/1 var(--f-title); cursor: pointer; transition: transform 150ms var(--e-ui), background-color 150ms var(--e-ui); }
.copy:hover { background: var(--kihada); }
.copy:active { transform: scale(.97); }
.copy > span { grid-area: 1 / 1; transition: opacity 200ms var(--e-ui), transform 330ms var(--e-out), filter 200ms; }
.copy .c2, .copy .c3 { opacity: 0; transform: scale(.25); filter: blur(4px); }
.copy[data-state="ok"] .c1, .copy[data-state="err"] .c1 { opacity: 0; transform: scale(.25); filter: blur(4px); }
.copy[data-state="ok"] .c2, .copy[data-state="err"] .c3 { opacity: 1; transform: none; filter: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 220%); background: var(--sumi); color: var(--paper); padding: 12px 18px; border-radius: 10px; font: 600 var(--t-xs)/1.2 var(--f-title); z-index: 90; visibility: hidden; transition: transform 400ms var(--e-out), visibility 0s linear 400ms; }
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform 400ms var(--e-out), visibility 0s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
