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

/* ---------- fonts */
@font-face { font-family: "EB Garamond"; font-weight: 400 800; font-style: italic; font-display: swap;
  src: url(fonts/ebgaramond-cyrillic-ext-italic.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: "EB Garamond"; font-weight: 400 800; font-style: italic; font-display: swap;
  src: url(fonts/ebgaramond-cyrillic-italic.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "EB Garamond"; font-weight: 400 800; font-style: italic; font-display: swap;
  src: url(fonts/ebgaramond-latin-italic.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: "EB Garamond"; font-weight: 400 800; font-style: normal; font-display: swap;
  src: url(fonts/ebgaramond-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: "EB Garamond"; font-weight: 400 800; font-style: normal; font-display: swap;
  src: url(fonts/ebgaramond-cyrillic.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "EB Garamond"; font-weight: 400 800; font-style: normal; font-display: swap;
  src: url(fonts/ebgaramond-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: "Golos Text"; font-weight: 400 900; font-style: normal; font-display: swap;
  src: url(fonts/golos-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: "Golos Text"; font-weight: 400 900; font-style: normal; font-display: swap;
  src: url(fonts/golos-cyrillic.woff2) format("woff2-variations"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-style: normal; font-display: swap;
  src: url(fonts/golos-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: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-ext-400.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: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-latin-400.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: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-ext-500.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: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-latin-500.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: "IBM Plex Mono"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-ext-600.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: "IBM Plex Mono"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(fonts/plexmono-latin-600.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; }

/* ---------- tokens. Light by default; dark ("the darkroom") when <html data-theme="dark">: set from the
   Telegram theme in the cabinet and from the phone's setting on the guest page (base.html, tg.js). */
: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;
  --surface: #fff;                       /* a chosen card / raised field */
  --glass: rgba(242,238,230,.92);        /* sticky bars, overlays over the page */
  --glass-0: rgba(242,238,230,0);
  --warn-bg: #fbf1df; --warn-line: #e7b96c; --warn-ink: #8a5a12; --warn: #b7791f;
  --ok-bg: #eef6f0; --ok-line: #9cc9b0; --ok-dot: #4caf7d;
  --shimmer: rgba(255,255,255,.5);
  --grain-blend: multiply; --grain: .5;

  --f-display: "EB Garamond", "Times New Roman", Georgia, serif;
  --f-text: "Golos Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --r: 3px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --gutter: 20px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161412;
  --paper-2: #24211d;
  --sheet: #1d1a17;
  --ink: #f0ebe2;
  --ink-2: #cdc5b8;
  --muted: #968d80;
  --line: #322e29;
  --line-2: #48423a;
  --accent: #e2583d;
  --accent-ink: #f07d64;
  --accent-wash: #3b1f18;
  --ok: #63b98b;
  --surface: #2a2622;
  --glass: rgba(22,20,18,.9);
  --glass-0: rgba(22,20,18,0);
  --warn-bg: #33291a; --warn-line: #7c6230; --warn-ink: #e9bd6c; --warn: #d79a3a;
  --ok-bg: #18291f; --ok-line: #3c6a50; --ok-dot: #5cc08a;
  --shimmer: rgba(255,255,255,.07);
  --grain-blend: screen; --grain: .18;
}

/* ---------- 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: var(--grain); mix-blend-mode: var(--grain-blend);
  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(40px, 10.8vw, 72px)/.98 var(--f-display); letter-spacing: -.02em; text-wrap: balance;
}
.display em, .display-s em { font-style: italic; color: var(--accent); }
.display-s { font: 500 clamp(29px, 7.4vw, 40px)/1.04 var(--f-display); letter-spacing: -.015em; 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 .ico { width: 19px; height: 19px; flex: none; }
.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;
}

/* ---------- 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(28px + env(safe-area-inset-bottom));
  min-height: 100svh; display: flex; flex-direction: column; }
.g > .screen { padding-bottom: 44px; }
.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; }

/* Face frame: ONE component for the picture on the first screen and the selfie camera.
   Idle it is paper with the dashed outline of a face; .live fills it with the camera image. */
.face-frame { --c: var(--ink); --s: 26px; aspect-ratio: 4 / 3; background: var(--paper-2); overflow: hidden; border-radius: var(--r); margin-top: 28px; }
.face-frame .guide {
  position: absolute; left: 50%; top: 46%; height: 66%; aspect-ratio: 3 / 3.9; translate: -50% -50%; border-radius: 50% / 46%;
  border: 1.5px dashed var(--accent); z-index: 1; animation: lock 2.2s var(--ease) .4s both;
}
.face-frame .guide::after { /* shoulders */
  content: ""; position: absolute; left: 50%; top: 108%; width: 210%; aspect-ratio: 2 / 1; translate: -50% 0;
  border: 1.5px dashed var(--line-2); border-bottom: 0; border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.face-frame.live { --c: #fff; --s: 30px; aspect-ratio: 4 / 4.7; background: #0f0e0d; margin-top: 16px; }
.face-frame.live video, .face-frame.live #shot { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.face-frame.live #shot { position: absolute; inset: 0; transform: none; }
.face-frame.live #shot.mirrored { transform: scaleX(-1); }
.face-frame.live #shot[hidden] { display: none; }
.face-frame .scan { display: none; z-index: 2; }
[data-state="work"] .face-frame .scan { display: block; }
[data-state="work"] .face-frame { --c: var(--accent); }
[data-state="work"] .face-frame .guide { box-shadow: none; border-color: rgba(255,255,255,.4); }
/* one layout, three states (data-state on the section): nothing moves when the state changes */
.cam-top { display: flex; justify-content: center; }
.cam-foot { height: 152px; margin-top: 12px !important; display: grid; }
.cam-foot > * { grid-area: 1 / 1; display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; visibility: hidden; }
[data-state="shoot"] .cam-shoot, [data-state="work"] .cam-work { visibility: visible; }
/* the heading sits in the upper part of the frame; the button is halfway between it and the frame's bottom edge */
.cam-msg { position: absolute; inset: 0; z-index: 3; display: none; grid-template-rows: 2fr auto 3fr auto 3fr; justify-items: center; padding: 0 28px; text-align: center; color: #f2eee6; }
.cam-msg h2 { grid-row: 2; }
.cam-msg .btn { grid-row: 4; background: #f2eee6; border-color: #f2eee6; color: var(--ink); }
[data-state="denied"] .cam-msg { display: grid; }
[data-state="denied"] .face-frame .guide, [data-state="denied"] video { display: none; }
#s-camera { padding-bottom: 0; }
.face-frame.live .guide { top: 45%; height: 60%; border-color: rgba(255,255,255,.75); box-shadow: 0 0 0 100vmax rgba(15,14,13,.32); animation: none; }
.face-frame.live .guide::after { display: none; }
.cta { display: grid; gap: 8px; }
.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); }
}
.g-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.f-who { font: 600 15px/1.35 var(--f-text); }
.f-links { display: flex; flex-wrap: wrap; gap: 0 22px; margin-top: 4px; }
.f-links a, .f-links span { font: 500 15px/2.2 var(--f-text); }
.g-foot .fine { margin-top: 10px; }

/* camera */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.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); }

/* working */
.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: 6px; bottom: 6px; padding: 2px 9px; border-radius: 99px; background: rgba(15,14,13,.62); font: 500 10px/1.5 var(--f-mono); letter-spacing: .04em; color: #fff; }
/* main screen: "my photos" (after a search) above all the other photos */
.mine { padding: 22px 0 30px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.mine > * + * { margin-top: 14px; }
.mine-actions { display: flex; gap: 8px; }  /* the buttons share the row; a longer label gets a wider button */
.mine-actions .btn { --h: 48px; flex: 1 1 auto; padding: 0 22px; gap: 9px; font-size: 14.5px; white-space: nowrap; }
.label.sec { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.label.sec b { color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.all-photos { margin-top: 30px !important; }
.no-photos { padding-top: 8px; } .no-photos > * + * { margin-top: 16px; } .no-photos .btn { margin-top: 26px; }
.frame .lk { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px;
  background: var(--accent); color: #fff; font: 600 10px/1.5 var(--f-mono); }
.frame .lk b { font-weight: 600; }
.frame.loading { cursor: default; animation: none; }
.frame.loading::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%);
  background-size: 250% 100%; animation: shimmer 1.6s linear infinite; }
.modal h2:first-of-type { margin-top: 0; }
.ev-title { display: flex; font-size: 12px; line-height: 1.5; color: var(--ink); align-items: baseline; }
.ev-title .dot { translate: 0 -1px; }
/* consent: the text scrolls, the checkbox and the buttons stay put */
.modal.split { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.modal.split .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }
.modal.split { --mx: var(--gutter); }
@media (min-width: 640px) { .modal.split { --mx: 36px; } }
.modal.split .modal-foot { flex: none; margin: 0 calc(var(--mx) * -1); padding: 14px var(--mx) calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.modal.split .check { margin-top: 0; padding: 12px; grid-template-columns: 24px 1fr; gap: 10px; font-size: 12.5px; line-height: 1.4; }
.modal.split .actions { margin-top: 12px; }
.modal.split .fine { margin-top: 10px; }
.modal.split .clauses li:last-child { border-bottom: 0; }
.mine #forget { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.all-photos > * + * { margin-top: 12px; }
#s-main .display { font-size: clamp(34px, 9.2vw, 60px); }
.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(var(--glass-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 { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.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-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
#lb-like[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.lb-top .label { font-size: 13px; letter-spacing: .08em; }
.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: var(--glass); 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: var(--surface); }
.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%, var(--shimmer) 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: var(--glass); 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; }

/* saving to the phone gallery */
.lb-hint { margin: 10px 0 0; font-size: 13px; color: rgba(242,238,230,.7); text-align: center; }
#saver .modal > * + * { margin-top: 14px; }
#saver .progress { margin-top: 18px; }
.block-link { display: block; margin: 6px auto 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); translate: -50% 20px; z-index: 90;
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font: 500 14px/1.35 var(--f-text); text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, translate .25s var(--ease);
}
.toast.show { opacity: 1; translate: -50% 0; }

.gal-more { padding: 26px 0; }

/* language picker */
.lang-pick { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px;
  background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lang-pick.open { display: flex; animation: fade .3s var(--ease); }
.lang-card { width: 100%; max-width: 360px; text-align: center; }
.lang-btns { display: grid; gap: 10px; }
.lang-btns .btn { font-size: 16px; }
.lang-switch { background: none; border: 1px solid var(--line-2); border-radius: 99px; padding: 5px 10px; cursor: pointer;
  font: 600 11px var(--f-mono); letter-spacing: .1em; color: var(--ink); }
.lang-switch:hover { border-color: var(--ink); }
.theme-switch { display: inline-grid; place-items: center; width: 31px; height: 27px; padding: 0; color: var(--ink); }

/* event code (the page behind the photographer's QR) */
.code-field { position: relative; display: block; margin-top: 30px !important; cursor: text; }
.code-cells { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.code-cells i { aspect-ratio: 1 / 1.12; display: grid; place-items: center; background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r);
  font: 500 44px/1 var(--f-display); font-style: normal; font-variant-numeric: lining-nums; transition: border-color .15s, box-shadow .15s; }
.code-cells i.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-wash); }
.code-field input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; }
.code .error { margin-top: 14px; }
.shake .code-cells { animation: shake .35s var(--ease); }
@keyframes shake { 25% { translate: -6px 0; } 50% { translate: 6px 0; } 75% { translate: -3px 0; } }

/* guests add their own photos (service "guests") */
.add-box > * + * { margin-top: 10px; }
.t-add { position: relative; gap: 9px; }
.t-add.busy { pointer-events: none; opacity: .65; }
.ups { padding-top: 4px; }
.ups > * + * { margin-top: 12px; }

/* viewer: icon buttons - share, like, download below; delete (own photos) next to "Закрыть" */
.lb-top-r { display: flex; align-items: center; gap: 14px; }
.lb-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 56px; height: 56px; padding: 0 8px;
  background: none; border: 0; border-radius: 99px; color: #f2eee6; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .12s var(--ease), opacity .2s, color .2s; }
.lb-icon:active { transform: scale(.9); }
.lb-icon svg { width: 28px; height: 28px; flex: none; }
.lb-top .lb-icon { min-width: 40px; height: 40px; padding: 0; }
.lb-top .lb-icon svg { width: 23px; height: 23px; }
.lb-actions { display: flex; justify-content: space-around; align-items: center; }
.lb-like b { font: 600 15px/1 var(--f-text); font-variant-numeric: tabular-nums; }
.lb-like b:empty { display: none; }
#lb-like[aria-pressed="true"] { background: none; border: 0; color: var(--accent); }
#lb-like[aria-pressed="true"] svg { fill: currentColor; }
.lb-icon.busy { opacity: .4; }
.lb-icon.busy::after { content: ""; position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(242,238,230,.25);
  border-top-color: #f2eee6; animation: spin .8s linear infinite; }
.lb-icon.retry { color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* grid tiles: a soft shimmer until the picture is there; moved tiles don't fade in again */
.frame.seen { animation: none; }
.frame[data-id]::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%);
  background-size: 250% 100%; animation: shimmer 1.4s linear infinite; transition: opacity .3s; pointer-events: none; }
.frame.ready::before { opacity: 0; animation: none; }
.frame.broken::after { content: "↻"; position: absolute; inset: 0; display: grid; place-items: center; font: 500 22px var(--f-text); color: var(--muted); }

/* the Qazyr logo (app/static/brand/qazyr.svg) wherever the name stood: as tall as the line around it */
.wordmark img { display: block; height: 1.45em; width: auto; }
.boot-logo img { display: block; height: 34px; width: auto; }
