@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-latin.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Gaegu"; src: url("../fonts/gaegu-latin.woff2") format("woff2"); font-display: block; }

:root {
  --paper: #ffffff; --ink: #111111; --ink-2: #7a7a7a; --biro: #2B33D9;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --hand: "Gaegu", "Comic Sans MS", cursive;
  --wonk: 12px 15px 11px 14px / 14px 11px 15px 12px;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; }
html, body { background: var(--paper); color: var(--ink); }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
svg.ln { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
svg.ln path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout: phone first ---------- */
.page { max-width: 440px; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 16px 48px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-top: 26px; position: relative; }

.page { display: flex; flex-direction: column; }
.head { order: 1; } .lock { order: 2; } .grid { order: 3; } .demo { order: 4; } .steps { order: 5; } .make { order: 6; }

/* tablet: wider page, 6 doors across */
@media (min-width: 600px) {
  .page { max-width: 760px; padding: 40px 32px 64px; }
  .grid { grid-template-columns: repeat(6, 1fr); gap: 14px; margin-top: 34px; }
  h1 { font-size: 56px !important; }
}
/* laptop: title on the left, all 24 doors on the right, no scrolling needed */
@media (min-width: 960px) {
  .page { max-width: 1280px; min-height: 100vh; padding: 48px 48px; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; grid-template-rows: 1fr auto auto auto auto 1fr; grid-template-areas: ". grid" "head grid" "steps grid" "make grid" "demo grid" ". grid"; column-gap: 64px; align-items: start; }
  .head { grid-area: head; } .steps { grid-area: steps; } .make { grid-area: make; } .demo { grid-area: demo; }
  .grid, .lock { grid-area: grid; align-self: center; }
  .steps { margin-top: 28px; }
  h1 { font-size: 52px !important; }
  .grid, .lock { margin-top: 0; }
  .grid { gap: 16px; width: min(100%, calc((100vh - 96px) * 1.5)); justify-self: center; }
  .lock { max-width: 420px; }
  .door .n { font-size: clamp(34px, 3.4vw, 46px) !important; }
}

/* ---------- header ---------- */
.label { font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
h1 { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: .98; letter-spacing: -.02em; margin-top: 8px; position: relative; }
h1 .u { position: relative; display: inline-block; }
h1 .u svg.ln { top: auto; bottom: -7px; height: 10px; }
h1 .u svg.ln path { stroke-width: 2.6; }
.hstar { position: absolute; right: 4px; top: -4px; width: 26px; height: 26px; }
.aside { font-family: var(--hand); font-size: 24px; line-height: 1.02; letter-spacing: -.01em; color: var(--biro); transform: rotate(-3deg); transform-origin: left; display: inline-block; margin-top: 12px; }
.head .aside { margin-top: 20px; transform: rotate(-2deg); display: block; }
.head .aside .line { display: block; white-space: nowrap; width: max-content; }
.head .aside .s { white-space: nowrap; }
.head .aside.split .s { display: block; width: max-content; }
/* fewer lonely last words */
p, li, .fine { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
.note { font-family: var(--sans); font-size: 13px; line-height: 1.4; color: var(--ink-2); margin-top: 22px; max-width: 34ch; }

.demo { margin-top: 22px; }
.demo-row { display: flex; align-items: center; gap: 14px; }
.demo-row .label { white-space: nowrap; }
.demo input { flex: 1; accent-color: var(--ink); max-width: 240px; }
.demo output { font-family: var(--hand); font-size: 24px; min-width: 5ch; color: var(--biro); }

/* ---------- steps (demo only) ---------- */
.steps { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 10px; counter-reset: s; }
.steps li { position: relative; padding-left: 34px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: -2px; font-family: var(--serif); font-size: 30px; line-height: 1; }
.steps b { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.05; letter-spacing: -.01em; }
.steps span { display: block; font-family: var(--hand); font-size: 21px; line-height: 1; letter-spacing: -.01em; color: var(--biro); margin-top: 2px; transform: rotate(-1deg); transform-origin: left; }

/* ---------- make your own ---------- */
.make { margin-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn.btn-ghost { display: inline-block; text-decoration: none; background: transparent; color: var(--ink); box-shadow: none; padding: 13px 20px; }
.btn.soon { opacity: .4; cursor: default; box-shadow: none; }
.make .aside { flex-basis: 100%; margin-top: 4px; font-size: 21px; }
.btn.btn-accent { display: inline-block; text-decoration: none; background: #FFE600; color: var(--ink); }

/* ---------- password ---------- */
.lock { margin-top: 48px; }
.lock form { display: flex; flex-direction: column; gap: 22px; }
.field { width: 100%; border: 0; border-bottom: 2px solid var(--ink); background: transparent; color: var(--ink); font-family: var(--serif); font-size: 38px; line-height: 1.1; padding: 6px 0 8px; border-radius: 0; outline: none; }
.field::placeholder { color: var(--ink-2); opacity: .55; font-style: italic; }
.btn { appearance: none; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 16px; font-weight: 500; padding: 15px 22px; border-radius: 999px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .18s cubic-bezier(.3,1.4,.5,1); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.err { font-family: var(--hand); font-size: 24px; color: var(--biro); min-height: 24px; transform: rotate(-2deg); }
.lock.wob form { animation: wob .5s cubic-bezier(.3,1.4,.5,1); }

/* ---------- doors ---------- */
.door { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-user-select: none; border: 0; background: none; padding: 0; color: inherit; font: inherit; }
.door:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 12px; }
.door .n { position: relative; z-index: 2; font-family: var(--serif); font-size: 38px; line-height: 1; letter-spacing: -.02em; }
.door svg.fill, .door svg.shadow, .door svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.door svg.fill path, .door svg.shadow path { fill: var(--ink); }
.door svg.shadow { transform: translate(4px, 4px); }
.door svg.bg path { fill: var(--paper); }
.door svg.ln { z-index: 1; }
.door .photo { position: absolute; inset: 5px; z-index: 0; background-size: cover; background-position: center; border-radius: var(--wonk); background-color: #f1f1f1; }
.door.open .n { position: absolute; left: 3px; top: 3px; font-size: 19px !important; background: var(--paper); padding: 3px 7px 2px; border-radius: 0 0 10px 0; }
.door.today:not(.open) { transform: rotate(-3deg); animation: nudge 4s 1.5s infinite; }
.door.today:not(.open) .n { color: var(--paper); }
.door.loading .photo { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { background-color: #e2e2e2; } }
@keyframes nudge { 0%, 88%, 100% { transform: rotate(-3deg); } 91% { transform: rotate(3deg) scale(1.04); } 94% { transform: rotate(-6deg) scale(1.04); } 97% { transform: rotate(1deg); } }
.door .tstar { position: absolute; top: -13px; right: -9px; width: 20px; height: 20px; z-index: 3; transform: rotate(8deg); }
.door.wob { animation: wob .55s cubic-bezier(.3,1.4,.5,1); }
@keyframes wob { 0% { transform: rotate(0); } 18% { transform: rotate(-9deg); } 38% { transform: rotate(8deg); } 58% { transform: rotate(-5deg); } 78% { transform: rotate(3deg); } 100% { transform: rotate(0); } }
@media (hover: hover) { .door:not(.today):hover { transform: rotate(-1.5deg); } }

.toast { position: absolute; z-index: 5; background: var(--ink); color: var(--paper); font-family: var(--hand); font-size: 22px; padding: 10px 16px 9px; border-radius: 13px 16px 12px 15px / 15px 12px 16px 13px; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: rotate(-2deg) translateY(6px) scale(.9); transition: opacity .18s, transform .3s cubic-bezier(.3,1.4,.5,1); }
.toast.on { opacity: 1; transform: rotate(-2deg) translateY(0) scale(1); }
.toast::after { content: ""; position: absolute; top: -7px; left: var(--tip, 30px); width: 14px; height: 14px; background: var(--ink); transform: rotate(45deg); border-radius: 2px; }

/* ---------- the big picture ---------- */
.veil { position: fixed; inset: 0; z-index: 20; background: rgba(255,255,255,.94); opacity: 0; pointer-events: none; transition: opacity .35s; }
.veil.on { opacity: 1; pointer-events: auto; cursor: pointer; }
.zoom { position: fixed; z-index: 21; object-fit: cover; border-radius: var(--wonk); border: 2.5px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); background: #ddd; cursor: pointer;
  transition: left .55s cubic-bezier(.3,1.25,.5,1), top .55s cubic-bezier(.3,1.25,.5,1), width .55s cubic-bezier(.3,1.25,.5,1), height .55s cubic-bezier(.3,1.25,.5,1), transform .55s cubic-bezier(.3,1.25,.5,1); }
.zoom.small { transition-timing-function: cubic-bezier(.5,0,.3,1); transition-duration: .5s; box-shadow: none; border-width: 0; }
.cap { position: fixed; z-index: 22; left: 16px; right: 16px; text-align: center; pointer-events: none; opacity: 0; transform: translateY(8px) rotate(-2deg); transition: opacity .3s .25s, transform .4s .25s cubic-bezier(.3,1.4,.5,1); }
.cap.on { opacity: 1; transform: translateY(0) rotate(-2deg); }
.cap .day { font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.cap .txt { font-family: var(--hand); font-size: 30px; line-height: 1; letter-spacing: -.01em; color: var(--biro); margin-top: 6px; }
.cap .close { font-family: var(--hand); font-size: 17px; color: var(--ink-2); margin-top: 8px; }

/* Gaegu has no umlauts: draw the two dots with its own full stops */
.uml { position: relative; }
.uml::after { content: ".."; position: absolute; left: 50%; top: -.5em; transform: translateX(-52%); letter-spacing: -.06em; }

@media (prefers-reduced-motion: reduce) { .zoom, .cap { transition-duration: .01s !important; } .door, .lock form { animation: none !important; } }
