/* PhotoRauf — "contact sheet & viewfinder"
   Warm darkroom paper, ink, one safelight-red accent.
   Display: Cormorant Garamond · Text: Onest · Labels: JetBrains Mono (all self-hosted, incl. Kazakh letters) */

/* ---------- fonts */
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-cyrillic-ext-500-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: italic; font-display: swap;
  src: url(fonts/cormorant-cyrillic-ext-500-italic.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: italic; font-display: swap;
  src: url(fonts/cormorant-cyrillic-500-italic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: italic; font-display: swap;
  src: url(fonts/cormorant-latin-500-italic.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-cyrillic-ext-600-normal.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Cormorant"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/cormorant-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-weight: 100 900; font-display: swap;
  src: url(fonts/onest-cyrillic-ext.woff2) format("woff2-variations"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Onest"; font-weight: 100 900; font-display: swap;
  src: url(fonts/onest-cyrillic.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-weight: 100 900; font-display: swap;
  src: url(fonts/onest-latin.woff2) format("woff2-variations"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JB Mono"; font-weight: 100 800; font-display: swap;
  src: url(fonts/jbmono-cyrillic-ext.woff2) format("woff2-variations"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "JB Mono"; font-weight: 100 800; font-display: swap;
  src: url(fonts/jbmono-cyrillic.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JB Mono"; font-weight: 100 800; font-display: swap;
  src: url(fonts/jbmono-latin.woff2) format("woff2-variations"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- tokens (light only) */
:root {
  color-scheme: light;
  --paper: #f2eee6;
  --paper-2: #e9e3d8;
  --sheet: #fbfaf6;
  --ink: #171513;
  --ink-2: #3a3530;
  --muted: #7a7368;
  --line: #dcd5c8;
  --line-2: #c7bead;
  --accent: #c4361f;      /* darkroom safelight */
  --accent-ink: #9e2914;
  --accent-wash: #f5e2da;
  --ok: #2d6a4a;

  --f-display: "Cormorant", "Times New Roman", Georgia, serif;
  --f-text: "Onest", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: "JB Mono", ui-monospace, Menlo, monospace;

  --r: 3px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --gutter: 20px;
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100svh; background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--f-text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5; mix-blend-mode: multiply;
  background-image: 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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
code { font: 500 14px var(--f-mono); }

/* ---------- type */
.label {
  font: 500 11px/1.4 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 8px;
}
.label.accent { color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }
.dot.live { animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.display {
  font: 500 clamp(42px, 11.5vw, 76px)/.94 var(--f-display); letter-spacing: -.015em; text-wrap: balance;
}
.display em, .display-s em { font-style: italic; color: var(--accent); }
.display-s { font: 500 clamp(28px, 7vw, 40px)/1 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
.lead { font-size: 17px; line-height: 1.5; color: var(--ink-2); max-width: 34ch; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.fine { font: 400 12px/1.5 var(--f-mono); color: var(--muted); letter-spacing: .02em; }
.wordmark { font: 600 17px/1 var(--f-text); letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.wordmark em { font: italic 500 21px/1 var(--f-display); letter-spacing: 0; color: var(--accent); margin-left: 1px; }

/* ---------- buttons */
.btn {
  --h: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: var(--h); padding: 0 26px; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); font: 600 15px/1 var(--f-text); letter-spacing: -.005em;
  text-decoration: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:active { transform: scale(.98); }
.btn[disabled] { background: var(--paper-2); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn .arrow { width: 18px; height: 18px; transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn.danger { background: transparent; color: var(--accent); border-color: var(--line-2); }
.btn.danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.sm { --h: 38px; padding: 0 16px; font-size: 13px; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 4px 0; font: 500 14px var(--f-text); color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link:hover { color: var(--accent); }

/* ---------- form */
.field { display: block; }
.field > span { display: block; margin-bottom: 8px; }
.input {
  width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--sheet); color: var(--ink); font: 400 16px var(--f-text); transition: border-color .15s;
}
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-wash); }
.error { color: var(--accent); font-size: 14px; }

/* ---------- viewfinder frame (corner brackets) */
.vf { --c: var(--ink); --s: 22px; --t: 2px; position: relative; }
.vf::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    linear-gradient(var(--c) 0 0) top left / var(--s) var(--t), linear-gradient(var(--c) 0 0) top left / var(--t) var(--s),
    linear-gradient(var(--c) 0 0) top right / var(--s) var(--t), linear-gradient(var(--c) 0 0) top right / var(--t) var(--s),
    linear-gradient(var(--c) 0 0) bottom left / var(--s) var(--t), linear-gradient(var(--c) 0 0) bottom left / var(--t) var(--s),
    linear-gradient(var(--c) 0 0) bottom right / var(--s) var(--t), linear-gradient(var(--c) 0 0) bottom right / var(--t) var(--s);
  background-repeat: no-repeat;
}
.hud { position: absolute; z-index: 3; font: 500 10.5px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); display: inline-flex; gap: 7px; align-items: center; }
.hud.tl { top: 16px; left: 18px; } .hud.tr { top: 16px; right: 18px; }
.hud.bl { bottom: 16px; left: 18px; } .hud.br { bottom: 16px; right: 18px; }

/* ---------- motion */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .8s var(--ease) forwards; }
.reveal:nth-child(2) { animation-delay: .06s; } .reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .18s; } .reveal:nth-child(5) { animation-delay: .24s; }
.reveal:nth-child(6) { animation-delay: .3s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.screen-in { animation: fade .45s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   GUEST
   ===================================================================== */
.g { max-width: 560px; margin: 0 auto; padding: 0 var(--gutter) calc(40px + env(safe-area-inset-bottom)); }
.g-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; border-bottom: 1px solid var(--line); }
.screen { padding-top: 34px; }
.screen > * + * { margin-top: 22px; }
.screen .display { margin-top: 14px; }

.hero-vf { --c: var(--ink); aspect-ratio: 4 / 3.4; background: var(--paper-2); overflow: hidden; margin-top: 30px; }
.hero-vf::before { /* faint rule-of-thirds grid */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent calc(33.33% - .5px), rgba(23,21,19,.08) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgba(23,21,19,.08) 0 calc(66.66% + .5px), transparent 0),
    linear-gradient(transparent calc(33.33% - .5px), rgba(23,21,19,.08) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgba(23,21,19,.08) 0 calc(66.66% + .5px), transparent 0);
}
.focus {
  position: absolute; left: 50%; top: 50%; width: 38%; aspect-ratio: 3 / 3.7; translate: -50% -52%; border-radius: 50% / 46%;
  border: 1.5px solid var(--ink); animation: lock 2.2s var(--ease) .5s both;
}
.focus::before, .focus::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--accent); translate: -50% -50%; }
.focus::before { width: 14px; height: 1.5px; } .focus::after { width: 1.5px; height: 14px; }
@keyframes lock {
  0% { scale: 1.25; opacity: 0; border-color: var(--ink); }
  45% { scale: .96; opacity: 1; border-color: var(--ink); }
  60% { scale: 1.02; } 75% { scale: 1; border-color: var(--accent); }
  100% { scale: 1; border-color: var(--accent); }
}
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.steps li { padding: 14px 0 14px 12px; font-size: 14px; line-height: 1.3; color: var(--ink-2); border-left: 1px solid var(--line); }
.steps li:first-child { border-left: 0; padding-left: 0; }
.steps b { display: block; font: 500 11px var(--f-mono); letter-spacing: .12em; color: var(--accent); margin-bottom: 6px; }
.g-foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }

/* camera */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cam { --c: #fff; --s: 30px; aspect-ratio: 3 / 4; background: #0f0e0d; overflow: hidden; border-radius: var(--r); }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam .guide {
  position: absolute; left: 50%; top: 45%; width: 58%; aspect-ratio: 3 / 3.9; translate: -50% -50%; border-radius: 50% / 46%;
  border: 1.5px dashed rgba(255,255,255,.75); box-shadow: 0 0 0 100vmax rgba(15,14,13,.32); z-index: 1;
}
.cam .hud { color: #fff; }
.shutter-row { display: flex; justify-content: center; padding: 6px 0; }
.shutter {
  width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--ink); background: transparent; padding: 5px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--accent); transition: transform .12s var(--ease); }
.shutter:active span { transform: scale(.88); }
.fallback { padding: 26px 0 6px; border-top: 1px solid var(--line); }
.fallback > * + * { margin-top: 14px; }

/* working */
.work-vf { --c: var(--accent); aspect-ratio: 1; width: min(68%, 260px); margin: 40px auto 34px !important; background: var(--paper-2); overflow: hidden; }
.scan { position: absolute; left: 0; right: 0; height: 36%; top: -36%;
  background: linear-gradient(transparent, rgba(196,54,31,.18) 80%, var(--accent) 99%, transparent);
  animation: scan 1.5s cubic-bezier(.5,0,.5,1) infinite; }
@keyframes scan { to { top: 100%; } }
.center { text-align: center; }

/* results — contact sheet */
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); }
@media (min-width: 560px) { .sheet { margin-left: 0; margin-right: 0; } }
.frame {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; background: var(--paper-2); overflow: hidden; cursor: zoom-in; display: block;
  animation: fade .5s var(--ease) both;
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease), opacity .4s; opacity: 0; }
.frame img.ok { opacity: 1; }
.frame:hover img { transform: scale(1.04); }
.frame .n { position: absolute; left: 7px; top: 6px; font: 600 10px var(--f-mono); letter-spacing: .08em; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.dock {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; z-index: 5;
  margin: 26px calc(var(--gutter) * -1) 0 !important; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(242,238,230,0), var(--paper) 30%);
}
.empty { padding: 30px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- consent sheet */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center;
  background: rgba(23,21,19,.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; animation: fade .25s ease-out; }
.modal {
  width: 100%; max-width: 600px; max-height: 94svh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet); border-radius: 14px 14px 0 0; padding: 26px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(23,21,19,.18); animation: up .4s var(--ease);
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 20px; } .modal { border-radius: 6px; padding: 34px 36px 26px; } }
@keyframes up { from { transform: translateY(40px); } to { transform: none; } }
.modal .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -10px auto 18px; }
@media (min-width: 640px) { .modal .grab { display: none; } }
.modal h2 { margin: 12px 0 14px; }
.notice { border-left: 2px solid var(--accent); padding: 4px 0 4px 14px; color: var(--ink-2); font-size: 15px; }
.clauses { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line); }
.clauses li { display: grid; grid-template-columns: 34px 1fr; gap: 4px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.clauses li > b:first-child { font: 500 11px/1.9 var(--f-mono); color: var(--accent); letter-spacing: .08em; }
.clauses strong { color: var(--ink); font-weight: 600; }
.check { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; margin-top: 20px; padding: 16px; background: var(--paper); border-radius: var(--r); cursor: pointer; font-size: 14.5px; line-height: 1.45; }
.check input { appearance: none; -webkit-appearance: none; margin: 0; width: 24px; height: 24px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--sheet); cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.check input:checked { background: var(--ink); }
.check input:checked::after { content: ""; width: 12px; height: 7px; border-left: 2px solid var(--paper); border-bottom: 2px solid var(--paper); transform: translateY(-2px) rotate(-45deg); }
.modal .actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 18px; }
.modal .fine { margin-top: 14px; text-align: center; }

/* ---------- lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: #0f0e0d; color: #f2eee6; display: none; flex-direction: column; }
.lightbox.open { display: flex; animation: fade .2s ease-out; }
.lb-top { display: flex; justify-content: space-between; align-items: center; padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 10px; }
.lb-top .label { color: rgba(242,238,230,.7); }
.lb-close { background: none; border: 0; color: #f2eee6; font: 500 14px var(--f-text); cursor: pointer; padding: 8px 0; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 12px; position: relative; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 50%; translate: 0 -50%; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(242,238,230,.25); background: rgba(15,14,13,.4); color: #f2eee6; cursor: pointer; display: none; place-items: center; }
@media (hover: hover) { .lb-nav { display: grid; } }
.lb-nav:hover { border-color: #f2eee6; }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lb-bar { padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom)); }
.lb-bar .btn { background: #f2eee6; color: var(--ink); border-color: #f2eee6; }
.lb-bar .btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =====================================================================
   ADMIN
   ===================================================================== */
.a-top { display: flex; align-items: center; gap: 18px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(242,238,230,.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.a-top .crumb { font: 500 12px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-top .crumb:hover { color: var(--ink); }
.spacer { flex: 1; }
.a { max-width: 1180px; margin: 0 auto; padding: 44px 28px 100px; }
@media (max-width: 640px) { .a { padding: 30px var(--gutter) 80px; } .a-top { padding: 14px var(--gutter); } }
.a-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid var(--ink); }
.a-head .display { margin-top: 12px; }
.a-head .display sup { font: 500 14px var(--f-mono); color: var(--accent); vertical-align: top; margin-left: 6px; letter-spacing: 0; }

.section { padding: 46px 0 0; }
.sec-h { display: flex; align-items: baseline; gap: 14px; padding-bottom: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.sec-h .num { font: 500 12px var(--f-mono); color: var(--accent); letter-spacing: .08em; }
.sec-h h2 { font: 500 30px/1 var(--f-display); letter-spacing: -.01em; }
.sec-h .aside { margin-left: auto; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 56px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.stat { padding: 22px 0 20px 22px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat b { display: block; font: 500 52px/1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.stat span { display: block; margin-top: 8px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat:nth-child(3) { border-left: 0; padding-left: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); } .stat b { font-size: 40px; } }

/* create form */
.create { display: grid; grid-template-columns: 2.4fr 1fr 1fr auto; gap: 14px; align-items: end; padding: 26px 0 30px; border-bottom: 1px solid var(--line); }
@media (max-width: 800px) { .create { grid-template-columns: 1fr 1fr; } .create .field:first-child, .create .btn { grid-column: 1 / -1; } }

/* events index */
.index { list-style: none; margin: 0; padding: 0; }
.index li a {
  display: grid; grid-template-columns: 110px 1fr auto 28px; gap: 20px; align-items: baseline; padding: 22px 0;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: padding .25s var(--ease), color .2s;
}
.index li a:hover { padding-left: 10px; color: var(--ink); }
.index li a:hover .go { color: var(--accent); transform: translateX(4px); }
.index .t { font: 500 clamp(24px, 3.4vw, 34px)/1.05 var(--f-display); letter-spacing: -.01em; }
.index .go { transition: transform .25s var(--ease), color .2s; color: var(--muted); }
.index .meta { display: flex; gap: 18px; }
@media (max-width: 640px) { .index li a { grid-template-columns: 1fr 22px; gap: 6px 12px; } .index .d { grid-column: 1 / -1; } .index .meta { grid-column: 1; } .index .go { grid-row: 2; grid-column: 2; } }
.empty-state { padding: 60px 0; text-align: center; }

/* QR + link */
.qr { display: grid; grid-template-columns: 196px 1fr; gap: 28px; align-items: start; }
@media (max-width: 520px) { .qr { grid-template-columns: 1fr; } }
.qr .vf { --s: 18px; padding: 14px; background: #fff; width: 196px; }
.qr img { width: 100%; display: block; image-rendering: pixelated; }
.qr .stack > * + * { margin-top: 14px; }
.url { font: 500 14px/1.5 var(--f-mono); word-break: break-all; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); }
.url a { text-decoration: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* key-value (FTP) */
.kv { margin: 0; border-top: 1px solid var(--line); }
.kv div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); min-height: 50px; }
.kv dt { font: 500 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kv code { font-size: 15px; user-select: all; }
details.howto { margin-top: 16px; font-size: 14px; color: var(--ink-2); }
details.howto summary { cursor: pointer; font: 500 12px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); list-style: none; }
details.howto summary::before { content: "+ "; color: var(--accent); }
details.howto[open] summary::before { content: "– "; }
details.howto ul { padding-left: 18px; margin: 12px 0 0; }
details.howto li { margin: 6px 0; }

/* dropzone */
.drop {
  display: block; position: relative; padding: 46px 20px; text-align: center; cursor: pointer; border: 1px dashed var(--line-2); border-radius: var(--r);
  background: var(--sheet); transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #fff; }
.drop .display-s { margin: 10px 0 8px; }
.progress { height: 2px; background: var(--line); margin-top: 12px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .25s var(--ease); }
.upl { margin-top: 16px; }

/* admin contact sheet */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.tile { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--paper-2); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute; left: 6px; bottom: 6px; padding: 3px 7px; border-radius: 2px; background: rgba(15,14,13,.72); color: #fff;
  font: 500 10px var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
}
.tile .badge.failed { background: var(--accent); }
.tile .src { position: absolute; right: 6px; bottom: 6px; padding: 3px 6px; border-radius: 2px; background: var(--accent); color: #fff; font: 600 9.5px var(--f-mono); letter-spacing: .1em; }
.tile .placeholder { height: 100%; display: grid; place-items: center; padding: 10px; text-align: center; font: 500 11px var(--f-mono); color: var(--muted); word-break: break-all; }
.tile .placeholder::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.5) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.tile .del {
  position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(251,250,246,.92); color: var(--ink); font: 500 15px/1 var(--f-text); opacity: 0; transition: opacity .15s, background .15s;
}
.tile .del:hover { background: var(--accent); color: #fff; }
.tile:hover .del, .tile:focus-within .del { opacity: 1; }
@media (hover: none) { .tile .del { opacity: 1; } }
.danger-zone { margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* login */
.login { min-height: 100svh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { position: relative; border-right: 1px solid var(--line); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login .art .sheet-art { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(100%, 460px); margin: 0 auto; transform: rotate(-4deg); }
.login .art .sheet-art span { aspect-ratio: 1; background: linear-gradient(160deg, #e3dccf, #d6cdbd); position: relative; }
.login .art .sheet-art span:nth-child(3n) { background: linear-gradient(200deg, #d9d1c2, #c9bfac); }
.login .art .sheet-art span:nth-child(4n+1) { background: linear-gradient(120deg, #ebe5da, #ddd5c6); }
.login .art .sheet-art span::after { content: attr(data-n); position: absolute; left: 6px; top: 5px; font: 500 9px var(--f-mono); color: var(--muted); }
.login .art .sheet-art span.hit { outline: 2px solid var(--accent); outline-offset: -2px; }
.login .art .sheet-art span.hit::after { color: var(--accent); }
.login .form { display: grid; place-items: center; padding: 40px var(--gutter); }
.login form { width: 100%; max-width: 360px; }
.login form > * + * { margin-top: 18px; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login .art { display: none; } }

/* missing */
.missing { min-height: 70svh; display: grid; align-content: center; gap: 16px; }

/* series / similar frames */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.switch { display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: start; cursor: pointer; max-width: 640px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 46px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s var(--ease); margin-top: 1px; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--sheet); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track .knob { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 3px; }
.switch b { display: block; font-weight: 600; margin-bottom: 3px; }
.tile.similar img { opacity: .38; filter: grayscale(.6); }
.tile .series { position: absolute; left: 6px; top: 6px; padding: 3px 7px; border-radius: 2px; background: var(--sheet); color: var(--ink); font: 600 9.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; }
