@font-face { font-family: "Spectral"; src: url(/fonts/spectral-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(/fonts/spectral-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(/fonts/spectral-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(/fonts/spectral-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(/fonts/spectral-latin-600-italic.woff2) format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex"; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --vault: #0E1440; --vault-2: #080C2A; --vault-3: #18215A;
  --star: #E2BA55; --gold-soft: #F2D682;
  --plaster: #DCD2BE; --plaster-2: #CFC3AB; --plaster-3: #B5A88E;
  --ink: #1B1611; --ink-2: #554A3C;
  --ivory: #F3ECDD; --ivory-2: #B9B7CF;
  --vermilion: #D9412A; --vermilion-2: #B8321F;
  --serif: "Spectral", Georgia, serif; --sans: "Plex", system-ui, sans-serif;
  --r: 3px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body {
  margin: 0; color: var(--ivory); font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  background-color: var(--vault);
  /* Giotto's blue vault: scattered gold stars on ultramarine */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%23E2BA55' opacity='.55'%3E%3Cpath d='M30 22l2 6 6 2-6 2-2 6-2-6-6-2 6-2z' opacity='.55'/%3E%3Cpath d='M150 60l1.4 4.2 4.2 1.4-4.2 1.4L150 71.4l-1.4-4.2-4.2-1.4 4.2-1.4z' opacity='.4'/%3E%3Cpath d='M95 140l2.4 7.2 7.2 2.4-7.2 2.4L95 159.2l-2.4-7.2-7.2-2.4 7.2-2.4z' opacity='.5'/%3E%3Cpath d='M195 175l1.2 3.6 3.6 1.2-3.6 1.2-1.2 3.6-1.2-3.6-3.6-1.2 3.6-1.2z' opacity='.35'/%3E%3Cpath d='M60 190l1 3 3 1-3 1-1 3-1-3-3-1 3-1z' opacity='.3'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(120% 80% at 50% 0%, var(--vault-3) 0%, var(--vault) 45%, var(--vault-2) 100%);
  background-attachment: fixed, fixed;
}
a { color: var(--gold-soft); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ivory); color: var(--ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--ivory-2); }

/* ───── header */
.top { display: flex; align-items: center; gap: 28px; padding: 14px clamp(16px, 3vw, 36px); max-width: 1560px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ivory); text-decoration: none; font: 600 22px/1 var(--serif); }
.brand img { border-radius: 2px; }
.top nav { display: flex; gap: 22px; margin-left: auto; }
.top nav a { color: var(--ivory-2); text-decoration: none; font-size: 14px; }
.top nav a:hover { color: var(--ivory); }

/* ───── buttons and fields */
.btn { font: 500 15px/1 var(--sans); border-radius: var(--r); padding: 12px 16px; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .1s, border-color .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-paint { width: 100%; background: var(--vermilion); color: #FFF5EE; font-size: 16px; padding: 14px 16px; }
.btn-paint:hover:not(:disabled) { background: var(--vermilion-2); }
.btn-plain { background: transparent; color: var(--ink); border-color: rgba(27, 22, 17, .35); }
.btn-plain:hover:not(:disabled) { border-color: var(--ink); background: rgba(27, 22, 17, .05); }
.btn-quiet { background: rgba(243, 236, 221, .08); color: var(--ivory); border-color: rgba(243, 236, 221, .22); }
.btn-quiet:hover { background: rgba(243, 236, 221, .14); }
.card .btn-quiet { color: var(--ink); background: transparent; border-color: rgba(27, 22, 17, .25); }
.danger { color: var(--vermilion-2) !important; }
.btn-small { padding: 6px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.lab { font-size: 13px; color: var(--ink-2); }
.lab em, .lab b { color: var(--ink); }
.lab em { font: italic 500 15px var(--serif); }
.inp { display: flex; align-items: center; border: 1px solid rgba(27, 22, 17, .3); border-radius: var(--r); background: #EDE5D4; }
.inp input { flex: 1; min-width: 0; border: 0; background: transparent; font: 500 16px var(--sans); padding: 10px 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.inp input:focus { outline: none; }
.inp:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.inp b { padding: 0 12px; font: 500 13px var(--sans); color: var(--ink-2); }
input[type=range] { width: 100%; accent-color: var(--vermilion); }
small { font-size: 12px; line-height: 1.45; }

/* ───── hero: the wall */
.hero { max-width: 1560px; margin: 0 auto; padding: 6px clamp(16px, 3vw, 36px) 40px; }
.lede { display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap; margin: 6px 0 16px; }
.lede h1 { font-size: clamp(30px, 3.6vw, 52px); font-weight: 500; }
.lede p { max-width: 54ch; margin: 0; color: var(--ivory-2); font-size: 15px; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.wallcol { min-width: 0; }
.frame { position: relative; padding: 10px; border-radius: 2px;
  background: linear-gradient(135deg, #8E6E2B, #E7C66A 30%, #A8822F 55%, #F0D486 78%, #8C6B26);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .4); }
.wallbox { position: relative; aspect-ratio: 16 / 9; max-height: calc(100vh - 250px); margin: 0 auto; background: var(--plaster); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); }
@supports (aspect-ratio: 1) { .wallbox { width: min(100%, calc((100vh - 250px) * 16 / 9)); } }
#wall-cv { display: block; touch-action: none; cursor: crosshair; }
#wall-cv:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: -2px; }
.bare { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; pointer-events: none; text-align: center; font: italic 400 clamp(17px, 2vw, 26px)/1.4 var(--serif); color: rgba(27, 22, 17, .62); }
.tip { position: fixed; z-index: 30; pointer-events: none; max-width: 260px; background: var(--plaster); color: var(--ink); border-radius: var(--r); padding: 10px 12px; font-size: 13px; line-height: 1.45; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.tip strong { font: italic 600 15px var(--serif); display: block; }
.tip .sw { display: inline-block; width: 10px; height: 10px; border-radius: 1px; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.tools { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tools button { font: 500 13px var(--sans); color: var(--ivory); background: rgba(243, 236, 221, .07); border: 1px solid rgba(243, 236, 221, .2); border-radius: var(--r); padding: 8px 11px; cursor: pointer; }
.tools button:hover { background: rgba(243, 236, 221, .13); }
.tools .icon { width: 36px; padding: 8px 0; font-size: 16px; }
.tools .plain { background: none; border-color: transparent; color: var(--ivory-2); }
.seg { display: inline-flex; }
.seg button:first-child { border-radius: var(--r) 0 0 var(--r); }
.seg button:last-child { border-radius: 0 var(--r) var(--r) 0; margin-left: -1px; }
.seg button[aria-pressed=true] { background: var(--ivory); color: var(--ink); border-color: var(--ivory); }
.hint { font-size: 12px; color: var(--ivory-2); margin-left: auto; }
.pulse { margin: 14px 0 0; font: italic 400 19px/1.45 var(--serif); color: var(--ivory); max-width: 80ch; }
.pulse b { font-style: normal; font-weight: 600; color: var(--gold-soft); font-variant-numeric: tabular-nums; }

/* ───── the bench: plaster cards beside the wall */
.bench { display: grid; gap: 14px; }
.card { background: var(--plaster); color: var(--ink); border-radius: var(--r); padding: 18px 18px 16px; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
  background-image: radial-gradient(rgba(120, 100, 70, .10) 1px, transparent 1.2px), radial-gradient(rgba(255, 255, 255, .25) 1px, transparent 1.2px);
  background-size: 7px 7px, 11px 11px; background-position: 0 0, 3px 5px; }
.card h2 { font-size: 22px; margin-bottom: 6px; }
.card .muted { color: var(--ink-2); font-size: 14px; margin: 0 0 14px; }
.cartellino { border-top: 3px solid var(--ink); }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.palette button { aspect-ratio: 1; border: 0; border-radius: 2px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22); transition: transform .12s; padding: 0; }
.palette button:hover { transform: scale(1.12); }
.palette button[aria-checked=true] { outline: 2px solid var(--ink); outline-offset: 2px; transform: scale(1.05); }
.sum { margin: 4px 0 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.sum dt { color: var(--ink-2); }
.sum dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.sum .total { border-top: 1px solid rgba(27, 22, 17, .25); padding-top: 8px; font-weight: 600; color: var(--ink); }
#patron { width: 100%; margin-top: 8px; }
.strokes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow: auto; font-size: 13.5px; }
.strokes li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: start; line-height: 1.4; }
.strokes li.muted { display: block; }
.strokes .sw { width: 14px; height: 14px; border-radius: 1px; margin-top: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.strokes em { font: italic 500 14.5px var(--serif); }
.strokes time { color: var(--ink-2); }
.strokes li.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: rgba(226, 186, 85, .45); } to { background: transparent; } }

/* ───── sections below the wall */
main > section:not(.hero) { max-width: 1180px; margin: 0 auto; padding: 72px clamp(16px, 3vw, 36px); }
main > section h2 { font-size: clamp(30px, 3.2vw, 44px); margin-bottom: 14px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { counter-increment: s; border-top: 1px solid rgba(243, 236, 221, .25); padding-top: 18px; }
.steps li::before { content: counter(s, upper-roman); font: italic 500 18px var(--serif); color: var(--star); display: block; margin-bottom: 8px; }
.steps h3 { font-size: 26px; margin-bottom: 10px; }
.steps p { color: var(--ivory-2); margin: 0; }
.steps b { color: var(--ivory); font-weight: 500; }
.example { margin-top: 28px; font: italic 400 19px var(--serif); color: var(--ivory); }
.rail { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.rail li { background: var(--plaster); color: var(--ink); border-radius: var(--r); overflow: hidden; }
.rail .chip { height: 64px; position: relative; }
.rail .chip::after { content: ""; position: absolute; inset: 0; background: radial-gradient(rgba(0, 0, 0, .12) 1px, transparent 1.3px) 0 0 / 5px 5px; mix-blend-mode: multiply; }
.rail span { display: block; padding: 8px 10px 10px; font: italic 500 15px/1.2 var(--serif); }
.rail small { display: block; font: 400 11px var(--sans); color: var(--ink-2); font-style: normal; margin-top: 2px; }
.cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 44px; margin-top: 24px; }
.cols h3 { font-size: 23px; margin-bottom: 8px; }
.cols p { margin: 0; color: var(--ivory-2); }
.faq details { border-top: 1px solid rgba(243, 236, 221, .2); padding: 16px 0; max-width: 760px; }
.faq summary { cursor: pointer; font: 500 20px var(--serif); }
.faq details p { color: var(--ivory-2); margin: 10px 0 0; }
.foot { max-width: 1180px; margin: 0 auto; padding: 36px clamp(16px, 3vw, 36px) 60px; border-top: 1px solid rgba(243, 236, 221, .15); font-size: 14px; }
.foot p { margin: 6px 0; }
.foot a { margin-left: 12px; }
.ca { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ca code { font-size: 13px; word-break: break-all; color: var(--ivory); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--plaster); color: var(--ink); padding: 12px 14px; border-radius: var(--r); box-shadow: 0 14px 30px rgba(0, 0, 0, .5); font-size: 14px; border-left: 4px solid var(--ink-2); animation: tin .25s ease-out; }
.toast.good { border-left-color: #2F9B63; }
.toast.bad { border-left-color: var(--vermilion); }
.toast a { color: var(--ink); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1100px) {
  .stage { grid-template-columns: 1fr; }
  .bench { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .wallbox { max-height: none; width: 100%; }
}
@media (max-width: 760px) {
  .top nav { display: none; }
  .top { justify-content: space-between; }
  .steps, .cols { grid-template-columns: 1fr; }
  .hint { margin-left: 0; width: 100%; }
  .frame { padding: 6px; }
  .lede { gap: 10px; }
}
