/* The Vault · styles. Colours and type match darkknowledgereads.com (the night-sky #12101B, gold #F3D6A4,
   IM Fell English headings). Two parts: the door (sign-in) and the lobby (inside). */
@font-face { font-family: 'IM Fell English'; src: url('/fonts/im-fell-english-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IM Fell English'; src: url('/fonts/im-fell-english-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/newsreader-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/newsreader-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/fonts/newsreader-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Libre Franklin'; src: url('/fonts/libre-franklin-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --night: #12101B; --night-2: #1F1A2C; --plum-glow: #3A2A4B;
  --gold: #F3D6A4; --gold-hi: #F8E4BF; --parchment: #F1E5CF; --mist: #D8CEDF;
  --brass-ink: #241B2E;
  --font-display: 'IM Fell English', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-label: 'Libre Franklin', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 4px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--night); color: var(--mist); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.55; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0; color: var(--parchment); }
p { margin: 0; }
a { color: var(--parchment); }
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { font-family: var(--font-display); font-size: 1.25rem; color: var(--mist); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px; border: 1px solid transparent; border-radius: var(--radius); font-family: var(--font-display); font-size: 1.125rem; text-decoration: none; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.btn-gold { background: var(--gold); color: #1B1727; }
.btn-gold:hover { background: var(--gold-hi); color: #1B1727; }
.btn-line { background: transparent; border-color: rgba(241, 229, 207, .45); color: var(--parchment); }
.btn-line:hover { border-color: var(--gold); color: var(--gold); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 1rem; }
.btn:disabled { opacity: .7; cursor: progress; }
.linkish { background: none; border: 0; padding: 8px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .9375rem; }

/* =================================================================== THE DOOR */
.door-scene {
  --d: min(76vw, 46vh, 430px);   /* the door's size */
  --dial: 0deg;                  /* the wheel turns a notch per digit typed */
  position: fixed; inset: 0; z-index: 20; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0;
  padding: 28px 16px 32px; perspective: 1600px;
  background: radial-gradient(70vmax 60vmax at 50% 38%, var(--plum-glow) 0%, var(--night-2) 46%, var(--night) 100%);
}
.door-frame {
  position: relative; flex: none; margin-top: auto; width: var(--d); aspect-ratio: 1; border-radius: 50%;
  /* the opening in the wall the door sits in */
  box-shadow: 0 0 0 calc(var(--d) * .035) #0B0910, 0 0 0 calc(var(--d) * .045) rgba(243, 214, 164, .12), 0 40px 80px -20px rgba(0, 0, 0, .8);
}
.vault-inside {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #FFE9BC 0%, #E7B866 22%, #8A5A2A 52%, #2A1A12 80%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .8);
}
.door { position: absolute; inset: 0; transform-origin: 0% 50%; transform-style: preserve-3d; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .55)); }
.door-svg { width: 100%; height: 100%; overflow: visible; }
.door-svg .rivet { fill: #EBCB8F; }
.door-svg .groove { fill: none; stroke: rgba(243, 214, 164, .2); stroke-width: 2; }
.door-svg .tick { stroke: rgba(243, 214, 164, .32); stroke-width: 1.5; }
.door-svg .tick.long { stroke: rgba(243, 214, 164, .75); stroke-width: 2.6; }
.door-svg .wheel-ring { fill: none; stroke: url(#g-brass); stroke-width: 10; }
.door-svg .spoke { fill: url(#g-brass); }
.door-svg .knob { fill: url(#g-hub); }
.door-svg .hub-dot { fill: #2A2238; }
.door-svg .bolt rect { fill: url(#g-brass); stroke: #6E4E25; stroke-width: 1; }
.door-svg .bolt-move { transition: transform .35s cubic-bezier(.5, 0, .5, 1); }
.door-svg .wheel { transform-box: view-box; transform-origin: 200px 200px; transform: rotate(var(--dial)); transition: transform .4s cubic-bezier(.3, 1.4, .5, 1); }
.door-mark { position: absolute; left: 50%; top: 88%; translate: -50% -50%; opacity: .85; }

/* The brass plate under the door: the form lives here */
.plaque {
  position: relative; z-index: 2; width: min(100%, 430px); margin-top: calc(var(--d) * -.08); margin-bottom: auto;
  padding: 24px 24px 20px; border-radius: 10px; color: var(--brass-ink);
  background:
    radial-gradient(circle at 12px 12px, #6E4E25 0 3px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 12px) 12px, #6E4E25 0 3px, transparent 3.5px),
    radial-gradient(circle at 12px calc(100% - 12px), #6E4E25 0 3px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), #6E4E25 0 3px, transparent 3.5px),
    linear-gradient(160deg, #F8E6BD 0%, #E8C988 45%, #D3AD69 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 0 rgba(110, 78, 37, .35), 0 22px 40px -14px rgba(0, 0, 0, .8);
  transition: opacity .4s ease, transform .4s ease;
}
.plaque a { color: var(--brass-ink); }
.plaque :focus-visible { outline-color: var(--brass-ink); }
.plaque-title { color: var(--brass-ink); text-align: center; font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem); }
.plaque-note { margin-top: 8px; text-align: center; font-size: 1rem; line-height: 1.45; color: #3A2E40; }
.plaque-note.center { margin: 6px 0; font-family: var(--font-display); font-size: 1.25rem; color: var(--brass-ink); }
.plaque-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.plaque-label { font-family: var(--font-label); font-weight: 600; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #5A3F1E; }
.field { width: 100%; min-height: 50px; padding: 10px 14px; border: 1px solid #8C6532; border-radius: var(--radius); background: #FBF3E1; color: var(--brass-ink); font-size: 1.0625rem; }
.field::placeholder { color: #8A7A66; }
.plaque .btn-gold { background: #2A2238; color: var(--gold); }
.plaque .btn-gold:hover { background: #3A2E4A; color: var(--gold-hi); }
.plaque .btn-line { border-color: rgba(36, 27, 46, .5); color: var(--brass-ink); }
.plaque .btn-line:hover { border-color: var(--brass-ink); color: var(--brass-ink); }
.plaque .linkish { color: var(--brass-ink); align-self: center; }
.plaque-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.plaque-foot { margin-top: 14px; text-align: center; font-size: .9375rem; color: #3A2E40; }
.error { padding: 8px 12px; border-left: 3px solid #7A2130; background: rgba(122, 33, 48, .1); color: #5E1824; font-size: .9375rem; }

/* The code, on rolling tumblers. The real input sits on top, invisible, so typing, pasting and autofill all work. */
.tumbler-box { position: relative; display: flex; justify-content: center; padding: 10px 8px; border-radius: 8px; background: #2A2238; box-shadow: inset 0 3px 8px rgba(0, 0, 0, .6); }
.tumbler-box:focus-within { outline: 3px solid var(--brass-ink); outline-offset: 2px; }
.tumblers { display: flex; gap: 6px; flex-wrap: nowrap; }
.tumbler { position: relative; width: clamp(34px, 9.5vw, 44px); height: 56px; overflow: hidden; border-radius: 4px; background: linear-gradient(#17121F, #2E2540 50%, #17121F); box-shadow: inset 0 0 0 1px rgba(243, 214, 164, .18); }
.tumbler::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.55), transparent 30%, transparent 70%, rgba(0,0,0,.55)); pointer-events: none; }
.strip { display: flex; flex-direction: column; transition: transform .45s cubic-bezier(.2, 1.3, .4, 1); }
.strip span { display: grid; place-items: center; height: 56px; font-family: var(--font-display); font-size: 1.875rem; color: rgba(243, 214, 164, .28); font-variant-numeric: lining-nums; }
.tumbler.set .strip span { color: var(--gold); }
.tumbler-box:focus-within .tumbler.next { box-shadow: inset 0 0 0 2px var(--gold); }
.code-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; cursor: text; caret-color: transparent; }

/* The unlock sequence (app.js adds these one after another) */
.door-scene.ok .tumbler.set { box-shadow: inset 0 0 0 2px var(--gold), 0 0 16px rgba(243, 214, 164, .6); }
.door-scene.spin .wheel { transform: rotate(calc(var(--dial) + 320deg)); transition: transform 1s cubic-bezier(.6, 0, .3, 1); }
.door-scene.bolts .bolt-move { transform: translateX(-28px); }
.door-scene.swing .door { transform: rotateY(-112deg); transition: transform 1.1s cubic-bezier(.55, .05, .3, 1); }
.door-scene.swing .plaque { opacity: 0; transform: translateY(24px); }
.door-scene.swing { animation: scene-out 1.15s ease forwards; }
@keyframes scene-out { 0%, 45% { background-color: transparent; opacity: 1; } 100% { opacity: 0; } }
.door-scene.fade { opacity: 0; transition: opacity .25s ease; }
.door-scene.shake .door, .door-scene.shake .plaque { animation: shake .42s ease; }
@keyframes shake { 20% { translate: -7px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 2px 0; } }

/* =================================================================== INSIDE */
.lobby.behind { position: fixed; inset: 0; overflow: hidden; z-index: 1; }
.lobby.arrive { animation: lobby-in 1.1s .25s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lobby-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 20px; }

.lobby-top { position: sticky; top: 0; z-index: 5; background: rgba(18, 16, 27, .88); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(243, 214, 164, .12); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--parchment); }
.brand b { font-family: var(--font-display); font-weight: 400; font-size: 1.375rem; white-space: nowrap; }
.account .btn { white-space: nowrap; }
.account { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; font-size: .875rem; line-height: 1.3; }
.who-mail { color: var(--parchment); max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-plan { color: var(--mist); }

.lobby-main { background: radial-gradient(1100px 520px at 30% 0%, var(--plum-glow) 0%, var(--night-2) 48%, var(--night) 100%) no-repeat; }
.welcome { padding-block: 48px 32px; }
.eyebrow { font-family: var(--font-label); font-weight: 600; font-size: .8125rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.welcome h1 { margin-top: 10px; font-size: clamp(2.75rem, 1.4rem + 4vw, 4.5rem); }
.welcome h1:focus { outline: none; }
.lead { margin-top: 12px; font-size: clamp(1.1875rem, 1rem + .5vw, 1.375rem); color: var(--mist); }
.jump { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.jump a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid rgba(243, 214, 164, .45); border-radius: 999px; text-decoration: none; transition: background-color .2s ease, border-color .2s ease; }
.jump a:hover { background: rgba(243, 214, 164, .12); border-color: var(--gold); }

/* Shelves: one wide colour panel each, in Anna's order, pictures alternating sides */
.shelves { display: flex; flex-direction: column; gap: 12px; padding: 0 12px 12px; }
.shelf { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; min-height: clamp(320px, 30vw, 420px); border-radius: 4px; background: var(--bg); color: var(--txt); scroll-margin-top: 76px; }
.shelf:nth-child(even) { flex-direction: row-reverse; }
.s-guides { --bg: radial-gradient(120% 110% at 100% 0%, #2F568F 0%, #1B3058 46%, #111C36 100%); --txt: #D3DDEE; --acc: #F3D6A4; --solid: #111C36; }
.s-comp   { --bg: radial-gradient(120% 110% at 0% 0%, #8A5A3A 0%, #5E3B26 46%, #3B2518 100%); --txt: #EAD9C2; --acc: #F0C98A; --solid: #3B2518; }
.s-free   { --bg: radial-gradient(110% 100% at 100% 0%, #515935 0%, #353A26 48%, #2A2E1F 100%); --txt: #D5CBAE; --acc: #E2C687; --solid: #2A2E1F; }
.s-db     { --bg: radial-gradient(120% 110% at 0% 0%, #6A4186 0%, #4B2E5F 42%, #2E1D3D 100%); --txt: #E3D8EA; --acc: #F3D6A4; --solid: #2E1D3D; }
.shelf .body { position: relative; z-index: 2; flex: 1 1 46%; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: clamp(26px, 4vw, 56px); max-width: 620px; }
.shelf .body.wide { max-width: none; }
.shelf h2 { font-size: clamp(2rem, 1.1rem + 2.2vw, 3rem); }
.shelf p { font-size: 1.125rem; line-height: 1.5; max-width: 34em; }
.shelf .btn-gold { margin-top: 8px; background: var(--acc); color: var(--solid); }
.shelf .btn-gold:hover { background: #FBF0D8; color: var(--solid); }
.soon-note { font-size: 1rem !important; opacity: .9; }
.num { font-family: var(--font-display); color: var(--acc); font-size: 1.25rem !important; font-style: italic; }
.num b { font-style: normal; font-weight: 400; font-size: clamp(3rem, 5vw, 4.5rem); line-height: 1; margin-right: 8px; }
.stamp { display: inline-block; padding: 6px 12px; border-radius: 3px; font-family: var(--font-label); font-weight: 600; font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase; }
.stamp.open { color: var(--solid); background: var(--acc); rotate: -3deg; }
.stamp.soon { color: var(--acc); border: 1.5px dashed var(--acc); rotate: 2deg; }
.guide-list { margin: 4px 0 0; padding-left: 20px; font-size: 1.125rem; }

.shelf .art { position: relative; flex: 1 1 54%; align-self: stretch; display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.shelf .art img { width: auto; max-width: 100%; }
.s-guides .art img { height: clamp(220px, 23vw, 320px); border-radius: 2px 5px 5px 2px; box-shadow: 0 24px 40px -10px rgba(0, 0, 0, .7); }
.s-guides .art .g1 { rotate: -5deg; position: relative; z-index: 1; }
.s-guides .art .g2 { rotate: 4deg; margin-left: -6%; translate: 0 6%; }
.s-comp .art img { max-height: clamp(240px, 26vw, 360px); filter: drop-shadow(0 22px 30px rgba(0, 0, 0, .5)); }
.s-db .art img { max-height: clamp(220px, 24vw, 320px); rotate: -2deg; border-radius: 6px; box-shadow: 0 24px 46px -12px rgba(0, 0, 0, .65); }

.free-grid { list-style: none; margin: 12px 0 0; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.free-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 12px 16px; border-radius: 4px; background: #F6EEDD; color: #2A2230; text-decoration: none; box-shadow: 0 16px 28px -18px rgba(0, 0, 0, .8); transition: translate .25s ease; }
.free-card:hover { translate: 0 -4px; }
.free-card:focus-visible { outline-color: var(--acc); }
.free-pic { display: grid; place-items: center; height: 140px; margin-bottom: 8px; overflow: hidden; border-radius: 3px; background: #E6D9BC; }
.free-pic img { max-height: 90%; max-width: 90%; width: auto; height: auto; box-shadow: 0 8px 14px -8px rgba(11, 11, 15, .5); }
.free-pic.briefing { align-content: center; gap: 0; background: #2E3322; color: #E2C687; text-align: center; }
.free-pic.briefing span { font-family: var(--font-label); font-weight: 600; font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; }
.free-pic.briefing .stamp { margin-top: 8px; justify-self: center; font-size: .6875rem; }
.free-card.waiting:hover { translate: none; }
.free-pic.briefing b { font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; color: #F1E5CF; }
.free-title { font-family: var(--font-display); font-size: 1.1875rem; line-height: 1.2; }
.free-note { font-size: .9375rem; color: #5A4A50; }

.lobby-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-block: 28px 40px; font-size: 1rem; }

/* Plain pages (404, no JavaScript) */
.plain-page { max-width: 34rem; margin: 18vh auto 0; padding: 0 20px; text-align: center; }
.plain-page p { margin-top: 12px; }

/* =================================================================== SMALLER SCREENS */
@media (max-width: 900px) {
  .shelf, .shelf:nth-child(even) { flex-direction: column; align-items: stretch; }
  .shelf .art { flex: none; padding: 28px 16px 8px; }
  .s-guides .art img { height: clamp(170px, 42vw, 240px); }
  .s-comp .art img, .s-db .art img { max-height: clamp(170px, 46vw, 260px); }
  .free-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .door-scene { --d: min(70vw, 42vh, 320px); justify-content: flex-start; padding-top: 22px; }
  .plaque { padding: 22px 16px 16px; }
  .who-mail { max-width: 16ch; }
  .who-plan { display: none; }
  .welcome { padding-block: 32px 24px; }
  .free-pic { height: 110px; }
  .shelf .btn-gold { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .door-svg .wheel, .strip, .free-card, .door-svg .bolt-move { transition: none; }
  .free-card:hover { translate: none; }
}
