/* Malek ALmughrabi Photography — Face Finder
   Layout: a darkroom gallery. One dark world (photos read best on black),
   a centred 1120px column, contact-sheet grids with frame numbers,
   brass hairlines instead of boxes. */
:root {
  --ink: #0d0c0b;          /* darkroom black, warm */
  --ink-2: #141311;        /* raised surface */
  --ink-3: #1b1916;        /* card / empty frame */
  --ink-4: #26231e;        /* hover */
  --line: rgba(214, 186, 132, .15);
  --line-2: rgba(214, 186, 132, .34);
  --paper: #ece5d8;        /* fibre-paper white */
  --paper-2: #cbc2b2;
  --mute: #958c7e;
  --brass: #cdb07a;        /* the one accent */
  --brass-2: #e8d3a4;
  --brass-ink: #1b150b;
  --safelight: #e0664e;    /* errors, REC dot */
  --ok: #a3c99f;

  --f-latin: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --f-arabic: "Markazi Text", "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
  --f-body: "IBM Plex Sans Arabic", "IBM Plex Sans", -apple-system, "Segoe UI", Tahoma, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --f-head: var(--f-arabic);

  --t-xs: 11px; --t-s: 13px; --t-m: 15px; --t-l: 18px;
  --t-xl: clamp(22px, 3.2vw, 28px);
  --t-2xl: clamp(32px, 5.4vw, 48px);
  --t-3xl: clamp(40px, 8vw, 76px);

  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}
html[lang="en"] { --f-head: var(--f-latin); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--ink); color: var(--paper);
  font: 400 var(--t-m)/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--brass); color: var(--brass-ink); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* film grain: a fixed, static texture */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07;
  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 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
main { position: relative; z-index: 1; flex: 1; }

/* ---------- top bar & brand ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: linear-gradient(var(--ink) 30%, rgba(13, 12, 11, .82));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; direction: ltr; }
.brand-mark { width: 34px; height: 34px; color: var(--brass); flex: none; }
.brand-text { display: grid; line-height: 1; gap: 6px; }
.brand-name { font: 500 15px/1 var(--f-latin); letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.brand-sub { font: 400 9.5px/1 var(--f-mono); letter-spacing: .46em; text-transform: uppercase; color: var(--brass); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px; background: transparent;
  font: 500 12px/1 var(--f-mono); letter-spacing: .08em; color: var(--paper-2); cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--brass); color: var(--paper); }
@media (max-width: 380px) { .brand-name { font-size: 13px; letter-spacing: .14em; } .brand-mark { width: 30px; height: 30px; } }

/* ---------- type ---------- */
.eyebrow { font: 500 var(--t-xs)/1.4 var(--f-mono); letter-spacing: .28em; text-transform: uppercase; color: var(--brass); margin: 0 0 14px; }
html[lang="ar"] .eyebrow { letter-spacing: .06em; font-family: var(--f-body); font-size: 12.5px; }
.display { font-family: var(--f-head); font-weight: 600; font-size: var(--t-3xl); line-height: 1.04; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
html[lang="ar"] .display { line-height: 1.12; letter-spacing: 0; }
.h2 { font-family: var(--f-head); font-weight: 600; font-size: var(--t-2xl); line-height: 1.1; margin: 0; text-wrap: balance; }
.h3 { font-family: var(--f-head); font-weight: 600; font-size: var(--t-xl); line-height: 1.2; margin: 0; }
html[lang="en"] .display, html[lang="en"] .h2, html[lang="en"] .h3 { font-weight: 400; }
.lead { font-size: var(--t-l); color: var(--paper-2); max-width: 58ch; margin: 0; text-wrap: pretty; }
.muted { color: var(--mute); }
.small { font-size: var(--t-s); }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- buttons ---------- */
.btn {
  --h: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h); padding: 0 24px; border-radius: 12px; border: 1px solid transparent;
  font: 500 16px/1.2 var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .25s var(--ease), border-color .25s, color .25s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: linear-gradient(180deg, var(--brass-2), var(--brass) 70%); color: var(--brass-ink); box-shadow: 0 10px 30px -12px rgba(205, 176, 122, .55), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-primary:hover { background: linear-gradient(180deg, #f1dfb7, #d6bb86 70%); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--paper); }
.btn-ghost:hover { border-color: var(--brass); background: rgba(205, 176, 122, .06); }
.btn-quiet { background: transparent; color: var(--paper-2); --h: 44px; padding: 0 14px; }
.btn-quiet:hover { color: var(--paper); background: rgba(255,255,255,.04); }
.btn-sm { --h: 40px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
.btn-danger { background: transparent; border-color: rgba(224, 102, 78, .45); color: #f0a291; }
.btn-danger:hover { background: rgba(224, 102, 78, .1); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.stack > .btn { flex: 1 1 220px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.field > span { font-size: var(--t-s); color: var(--paper-2); }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--ink-2); color: var(--paper); outline: none;
  transition: border-color .2s, background .2s;
}
.input::placeholder { color: #6f675c; }
.input:focus { border-color: var(--brass); background: var(--ink-3); }
.input.ltr-input { direction: ltr; text-align: left; font-family: var(--f-mono); font-size: 13.5px; }

/* ---------- home hero ---------- */
.hero { padding-block: clamp(40px, 9vw, 96px) clamp(32px, 6vw, 64px); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero-iris { width: 100%; max-width: 360px; justify-self: center; aspect-ratio: 1; color: var(--brass); }
.code-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; max-width: 560px; }
.code-form .input { flex: 1 1 240px; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-iris { max-width: 200px; order: -1; justify-self: start; }
}

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); margin-block: 8px 72px; }
.step { padding: 24px 0 0; display: grid; gap: 8px; align-content: start; padding-inline-end: 24px; }
.step + .step { border-inline-start: 1px solid var(--line); padding-inline-start: 24px; }
.step-n { font: 500 12px/1 var(--f-mono); color: var(--brass); letter-spacing: .14em; }
.step h3 { margin: 0; font: 600 var(--t-l)/1.3 var(--f-body); }
.step p { margin: 0; color: var(--mute); font-size: var(--t-s); }
@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; }
  .step, .step + .step { border-inline-start: 0; padding-inline: 0; padding-block: 18px; border-bottom: 1px solid var(--line); }
}

.events-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 72px; }
.event-card { display: grid; gap: 10px; text-decoration: none; }
.event-card .ph { aspect-ratio: 4 / 3; border-radius: var(--r-m); overflow: hidden; background: var(--ink-3); }
.event-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.event-card:hover img { transform: scale(1.04); }
.event-card b { font: 600 var(--t-l)/1.3 var(--f-body); }

/* ---------- event view ---------- */
.event-head { padding-block: 22px 8px; }
.event-hero {
  position: relative; border-radius: var(--r-l); overflow: hidden; background: var(--ink-3);
  min-height: clamp(260px, 46vw, 460px); display: grid; align-items: end; isolation: isolate;
}
.event-hero .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 0; transition: opacity 1.2s var(--ease), transform 6s var(--ease); transform: scale(1.06); }
.event-hero .cover.loaded { opacity: 1; transform: scale(1); }
.event-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(13,12,11,0) 25%, rgba(13,12,11,.55) 60%, rgba(13,12,11,.96)); }
.event-meta { padding: clamp(20px, 4vw, 40px); display: grid; gap: 10px; }
.event-meta .display { font-size: clamp(34px, 6.4vw, 64px); }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font: 500 12.5px/1.4 var(--f-mono); letter-spacing: .06em; color: var(--paper-2); }
html[lang="ar"] .meta-row { font-family: var(--f-body); letter-spacing: 0; font-size: 14px; }
.meta-row span { display: inline-flex; align-items: center; gap: 8px; }
.meta-row span + span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--brass); margin-inline-end: 10px; }

.finder {
  margin-top: -1px; padding: clamp(22px, 4vw, 36px) 0 8px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 40px; align-items: end;
}
.finder .lead { font-size: var(--t-m); }
.finder .btn-row { min-width: min(100%, 420px); }
.privacy { display: flex; align-items: center; gap: 10px; font-size: var(--t-s); color: var(--mute); margin-top: 14px; }
.privacy svg { width: 18px; height: 18px; color: var(--brass); flex: none; }
@media (max-width: 760px) { .finder { grid-template-columns: 1fr; } }

.skeleton { background: linear-gradient(90deg, var(--ink-3), var(--ink-4), var(--ink-3)); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.preview-badge { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: 12px; font-size: var(--t-s); color: var(--paper-2); }
.preview-badge b { color: var(--brass); font-weight: 600; }

/* ---------- results / contact sheet ---------- */
.results { padding-block: 26px 64px; display: grid; gap: 22px; }
.results-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.results-head .h2 { font-size: clamp(30px, 5vw, 44px); }
.query-strip { display: flex; align-items: center; gap: 10px; }
.query-face { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 1px solid var(--brass); }
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
@media (max-width: 520px) { .sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.frame {
  position: relative; margin: 0; border-radius: 6px; overflow: hidden; background: var(--ink-3);
  cursor: zoom-in; border: 0; padding: 0; display: block; width: 100%; text-align: start;
}
.frame img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; opacity: 0; transition: opacity .5s var(--ease), transform .8s var(--ease); }
.frame img.loaded { opacity: 1; }
.frame:hover img { transform: scale(1.03); }
.frame .fn {
  position: absolute; inset-inline: 0; bottom: 0; padding: 22px 9px 7px; direction: ltr; text-align: left;
  font: 500 10px/1 var(--f-mono); letter-spacing: .1em; color: rgba(236, 229, 216, .82);
  background: linear-gradient(transparent, rgba(0,0,0,.7)); display: flex; justify-content: space-between; gap: 8px;
}
.frame .fn i { font-style: normal; color: var(--brass); }
.maybe-block { border-top: 1px dashed var(--line-2); padding-top: 22px; display: grid; gap: 14px; }
.maybe-block .sheet .frame { outline: 1px dashed rgba(205,176,122,.35); outline-offset: -1px; }
.empty { display: grid; gap: 14px; justify-items: start; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--ink-2); }
.empty ul { margin: 0; padding-inline-start: 20px; color: var(--paper-2); }
span.query-face { display: block; flex: none; background-color: var(--ink-3); background-repeat: no-repeat; }

/* after the photos: keep the link · book a session */
.after { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; margin-top: 14px; }
.after:not(:has(> .after-card:not([hidden]))) { display: none; }
.after-card {
  position: relative; overflow: hidden; display: grid; gap: 12px; align-content: start; justify-items: start;
  padding: clamp(22px, 3.4vw, 32px); border: 1px solid var(--line); border-radius: var(--r-l); background: var(--ink-2);
}
.after-card > :not(.book-mark) { position: relative; }
.after-card p { margin: 0; max-width: 46ch; }
.after-card .btn-row { margin-top: 6px; }
.after-ico { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; color: var(--brass); }
.after-ico svg { width: 20px; height: 20px; }
.after-card.book { border-color: var(--line-2); background: radial-gradient(120% 110% at 100% 0%, rgba(205, 176, 122, .14), transparent 58%), var(--ink-2); }
html[dir="rtl"] .after-card.book { background: radial-gradient(120% 110% at 0% 0%, rgba(205, 176, 122, .14), transparent 58%), var(--ink-2); }
.after-card.book .eyebrow { margin: 0; }
.book-mark { position: absolute; top: -46px; inset-inline-end: -46px; width: 172px; height: 172px; color: var(--brass); opacity: .08; pointer-events: none; }
.book-mark svg { display: block; width: 100%; height: 100%; }

/* ---------- camera ---------- */
.camera { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; overflow: hidden; }
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera video.mirror { transform: scaleX(-1); }
.cam-oval {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  width: min(66vw, 46vh, 340px); aspect-ratio: 3 / 4; border-radius: 50%;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .52); border: 1.5px solid rgba(236, 229, 216, .55);
  transition: border-color .3s;
}
.cam-oval.ok { border-color: var(--brass-2); }
.cam-brackets { position: absolute; inset: -18px; }
.cam-brackets i { position: absolute; width: 22px; height: 22px; border: 2px solid var(--brass); }
.cam-brackets i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.cam-brackets i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.cam-brackets i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.cam-brackets i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.cam-top, .cam-bottom { position: absolute; inset-inline: 0; z-index: 2; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.cam-top { top: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 14px); display: flex; justify-content: space-between; align-items: center; }
.hud { font: 500 11px/1 var(--f-mono); letter-spacing: .16em; color: rgba(255,255,255,.8); display: flex; gap: 14px; align-items: center; direction: ltr; }
.hud .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--safelight); box-shadow: 0 0 10px var(--safelight); }
.hud .dot.ok { background: var(--brass-2); box-shadow: 0 0 10px var(--brass); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.22); background: rgba(0,0,0,.35); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.icon-btn svg { width: 20px; height: 20px; }
.cam-bottom { bottom: 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); display: grid; gap: 18px; justify-items: center; }
.cam-hint { font-size: 16px; font-weight: 500; text-shadow: 0 1px 12px rgba(0,0,0,.8); min-height: 1.5em; text-align: center; }
.cam-controls { width: 100%; max-width: 420px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; }
.shutter { width: 80px; height: 80px; border-radius: 50%; border: 3px solid rgba(255,255,255,.9); background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.shutter::after { content: ""; width: 64px; height: 64px; border-radius: 50%; background: #f4efe6; transition: transform .12s, background .3s; }
.shutter:active::after { transform: scale(.88); }
.shutter.ready { border-color: var(--brass-2); }
.shutter.ready::after { background: var(--brass-2); }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; }
.cam-flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.86); text-align: center; }
.cam-msg > div { display: grid; gap: 16px; justify-items: center; max-width: 340px; }

/* ---------- busy (shutter animation) ---------- */
.busy { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(9, 8, 7, .95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 24px; }
.busy-in { display: grid; gap: 22px; justify-items: center; text-align: center; }
.busy-iris { width: min(60vw, 250px); aspect-ratio: 1; }
.busy-title { font-family: var(--f-head); font-weight: 600; font-size: 28px; line-height: 1.2; margin: 0; }
html[lang="en"] .busy-title { font-weight: 400; }
.busy-sub { font: 500 11px/1.5 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--mute); direction: ltr; }
.bar { width: min(70vw, 280px); height: 2px; background: var(--ink-4); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--brass); transition: width .3s var(--ease); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 70; background: #060504; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lb-top, .lb-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.lb-top { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); padding-bottom: 10px; }
.lb-bottom { padding-top: 12px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); justify-content: center; }
.lb-count { font: 500 12px/1 var(--f-mono); letter-spacing: .14em; color: var(--paper-2); direction: ltr; }
.lb-stage { position: relative; overflow: hidden; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.lb-stage img { position: absolute; inset: 0; margin: auto; max-width: calc(100% - 24px); max-height: 100%; object-fit: contain; transition: transform .25s var(--ease), opacity .25s; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-prev { inset-inline-start: 12px; } .lb-next { inset-inline-end: 12px; }
html[dir="rtl"] .lb-nav svg { transform: scaleX(-1); }
@media (hover: none) { .lb-nav { display: none; } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink-4); border-top-color: var(--brass); animation: spin .8s linear infinite; position: absolute; inset: 0; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sheet (bottom panel) & toast ---------- */
.panel-wrap { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; justify-items: center; background: rgba(0,0,0,.55); }
.panel { width: min(100%, 520px); background: var(--ink-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 26px var(--gutter-r) calc(env(safe-area-inset-bottom, 0px) + 22px) var(--gutter); display: grid; gap: 16px; }
.panel .bar { width: 100%; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); z-index: 90;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: .35s var(--ease);
  background: var(--paper); color: var(--ink); padding: 12px 20px; border-radius: 999px; font-weight: 500; font-size: 14px;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,.7); max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.err { background: #f3c4b8; }

/* ---------- footer ---------- */
.foot { position: relative; z-index: 1; border-top: 1px solid var(--line); margin-top: 40px; }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding-block: 26px calc(env(safe-area-inset-bottom, 0px) + 26px); font-size: var(--t-s); color: var(--mute); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot-links a { text-decoration: none; color: var(--paper-2); }
.foot-links a:hover { color: var(--brass-2); }

/* ---------- error / state ---------- */
.state { padding-block: 72px; display: grid; gap: 18px; justify-items: start; max-width: 620px; }
.state .ico { width: 56px; height: 56px; color: var(--brass); }

/* =================== STUDIO =================== */
.studio-tag { font: 500 10px/1 var(--f-mono); letter-spacing: .3em; color: var(--brass-ink); background: var(--brass); padding: 5px 8px 4px; border-radius: 4px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { height: 38px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--paper-2); cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { color: var(--paper); }
.tab[aria-current="page"] { background: var(--ink-3); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.studio main { padding-block: 26px 80px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 22px; }
.page-head .h2 { font-size: clamp(28px, 4vw, 38px); }
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(18px, 3vw, 28px); display: grid; gap: 16px; min-width: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title h3 { margin: 0; font: 600 var(--t-l)/1.3 var(--f-body); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; }

.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ev-card { display: grid; grid-template-rows: auto 1fr; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; text-align: start; padding: 0; cursor: pointer; transition: border-color .25s, transform .25s var(--ease); }
.ev-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.ev-cover { aspect-ratio: 16 / 9; background: var(--ink-3) center / cover no-repeat; position: relative; }
.ev-cover .mark-ph { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; color: var(--line-2); }
.ev-body { padding: 16px 18px 18px; display: grid; gap: 8px; align-content: start; }
.ev-body b { font: 600 17px/1.3 var(--f-body); }
.ev-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 500 11.5px/1.4 var(--f-mono); color: var(--mute); direction: ltr; justify-content: flex-end; }
html[dir="rtl"] .ev-stats { justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line-2); color: var(--paper-2); width: fit-content; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); border-color: rgba(163, 201, 159, .4); }
.pill.run { color: var(--brass-2); border-color: var(--line-2); }
.pill.warn { color: #f0b39f; border-color: rgba(224, 102, 78, .4); }

.seg { display: inline-grid; grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; }
.seg button { height: 40px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--paper-2); cursor: pointer; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink-4); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }

.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-m); padding: 28px; text-align: center; display: grid; gap: 10px; justify-items: center;
  background: rgba(205, 176, 122, .03); transition: background .2s, border-color .2s;
}
.drop.over { background: rgba(205, 176, 122, .09); border-color: var(--brass); }
.drop svg { width: 34px; height: 34px; color: var(--brass); }
.note { font-size: var(--t-s); color: var(--mute); }
.note.err { color: #f0a291; }
.note.ok { color: var(--ok); }
.thumbs-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.thumbs-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--ink-3); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.stat { padding: 14px 16px; display: grid; gap: 4px; }
.stat + .stat { border-inline-start: 1px solid var(--line); }
.stat b { font: 500 22px/1.1 var(--f-mono); font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
.stat span { font-size: 12px; color: var(--mute); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat:nth-child(3) { border-inline-start: 0; } .stat:nth-child(n+3) { border-top: 1px solid var(--line); } }
.progress { height: 6px; border-radius: 6px; background: var(--ink-4); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brass), var(--brass-2)); transition: width .4s var(--ease); }
.live { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
.live canvas { width: 100%; height: auto; border-radius: 10px; background: var(--ink-3); display: block; }
@media (max-width: 640px) { .live { grid-template-columns: 1fr; } }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 14px 10px; }
.person { display: grid; gap: 6px; justify-items: center; background: none; border: 0; padding: 0; cursor: pointer; color: var(--paper-2); }
.avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--ink-3); box-shadow: 0 0 0 1px var(--line-2); transition: box-shadow .2s; }
.person:hover .avatar { box-shadow: 0 0 0 2px var(--brass); }
.avatar img { position: absolute; max-width: none; }
.person small { font: 500 11.5px/1 var(--f-mono); }

.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox .input { flex: 1; min-width: 0; }
.qr-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.qr-holder { width: 200px; height: 200px; border-radius: 16px; overflow: hidden; background: #f4efe6; display: grid; place-items: center; }
.qr-holder canvas, .qr-holder svg { width: 100% !important; height: 100% !important; display: block; }
@media (max-width: 560px) { .qr-box { grid-template-columns: 1fr; } .qr-holder { width: 100%; max-width: 260px; height: auto; aspect-ratio: 1; } }
.steps-v { counter-reset: s; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps-v li { counter-increment: s; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps-v li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font: 500 13px/1 var(--f-mono); color: var(--brass); }
.steps-v li > div { display: grid; gap: 8px; min-width: 0; }
.kbd { font-family: var(--f-mono); font-size: 12.5px; background: var(--ink); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.modal-wrap { position: fixed; inset: 0; z-index: 75; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(100%, 980px); max-height: calc(100dvh - 32px); overflow: auto; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: clamp(18px, 3vw, 28px); display: grid; gap: 16px; }
.sheet-sm { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.sheet-sm .frame img { aspect-ratio: 1; }
details.adv summary { cursor: pointer; color: var(--paper-2); font-size: var(--t-s); }
.range { width: 100%; accent-color: var(--brass); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
