@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(/static/fonts/plex-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(/static/fonts/plex-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(/static/fonts/plex-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: Plex; font-weight: 400; font-display: swap; src: url(/static/fonts/plex-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 500; font-display: swap; src: url(/static/fonts/plex-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: Plex; font-weight: 700; font-display: swap; src: url(/static/fonts/plex-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --bg: #0f0d0a; --panel: #19160f; --line: #2c261c; --text: #f4efe6; --muted: #a99f8c;
  --accent: #e3ab5d; --accent-ink: #1b1305; --green: #7cc59b;
  --radius: 18px; --pad: clamp(18px, 5vw, 40px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.75 Plex, system-ui, -apple-system, "SF Arabic", Tahoma, sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 var(--pad); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: 13px;
        background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px;
       border-radius: 99px; font-weight: 700; font-size: 17px; text-decoration: none; border: 0; cursor: pointer;
       background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn[disabled] { opacity: .45; cursor: default; }

/* ---------- cover ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
              animation: drift 24s ease-out both; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
               background: linear-gradient(180deg, rgba(15,13,10,.55) 0%, rgba(15,13,10,0) 30%, rgba(15,13,10,.35) 55%, var(--bg) 96%); }
@keyframes drift { from { transform: scale(1.12); } to { transform: scale(1); } }
.topbar { position: absolute; top: 0; inset-inline: 0; display: flex; justify-content: space-between; align-items: center;
          padding: max(14px, env(safe-area-inset-top)) var(--pad) 0; font-size: 14px; }
.topbar .brand { font-weight: 700; letter-spacing: .2px; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.hero-text { width: 100%; padding: 0 var(--pad) max(34px, env(safe-area-inset-bottom)); max-width: 860px; margin: 0 auto; }
.kicker { color: var(--accent); font-weight: 500; font-size: 15px; margin: 0; }
.hero h1 { font-size: clamp(42px, 12vw, 76px); line-height: 1.15; margin: 4px 0 6px; font-weight: 700; text-shadow: 0 2px 24px rgba(0,0,0,.5); }
.hero .sub { font-size: 19px; margin: 0; }
.hero .age { margin: 14px 0 26px; color: var(--muted); font-size: 15px; }
.scroll-hint { display: block; margin-top: 18px; font-size: 14px; color: var(--muted); text-decoration: none; }

section { padding: 44px 0 6px; }
h2 { font-size: 24px; margin: 0 0 14px; }
.story p { font-size: 19px; margin: 0 0 10px; }
.note { font-size: 14px; color: var(--muted); border-inline-start: 3px solid var(--accent); padding-inline-start: 12px; margin-top: 18px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 34px; line-height: 1.2; color: var(--accent); font-weight: 700; }
.stat span { font-size: 15px; color: var(--muted); }

.chapters { display: grid; gap: 14px; }
.chapter { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; text-decoration: none;
           background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.chapter img { width: 112px; height: 112px; object-fit: cover; border-radius: 12px; }
.chapter .n { color: var(--accent); font-size: 13px; font-weight: 500; }
.chapter h3 { margin: 0; font-size: 19px; line-height: 1.4; }
.chapter p { margin: 2px 0 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.chapter::after { content: "‹"; position: absolute; inset-inline-end: 14px; top: 50%; translate: 0 -50%; font-size: 26px; color: var(--muted); }

.ghosts { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.ghost-card { flex: 0 0 auto; width: 150px; }
.ghost-card img { width: 150px; height: 112px; object-fit: cover; border-radius: 12px; filter: grayscale(.7) contrast(.9); opacity: .7; }
.ghost-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 6px; }

.tell-card { background: radial-gradient(120% 140% at 100% 0%, #2a2214 0%, var(--panel) 60%); border: 1px solid var(--line);
             border-radius: var(--radius); padding: 22px; }
.tell-card ul { margin: 6px 0 18px; padding-inline-start: 20px; color: var(--muted); }
.mic { font-size: 30px; }

footer { padding: 46px 0 max(40px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
footer p { margin: 2px 0; }
.dev { color: #d98b5f; }

/* ---------- gallery ---------- */
.bar { position: sticky; top: 0; z-index: 5; background: rgba(15,13,10,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
       border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 10px var(--pad) 6px; }
.bar-row a { text-decoration: none; font-size: 15px; color: var(--muted); white-space: nowrap; }
.bar-row h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--pad) 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .ghosts::-webkit-scrollbar { display: none; }
.chips a { flex: 0 0 auto; padding: 5px 14px; border-radius: 99px; border: 1px solid var(--line); font-size: 14px; text-decoration: none; color: var(--muted); }
.chips a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }

.ch { padding: 26px 0 10px; scroll-margin-top: 110px; }
.ch header { padding: 0 var(--pad) 12px; max-width: 1400px; margin: 0 auto; }
.ch h2 { margin: 0; font-size: 21px; }
.ch header p { margin: 0; font-size: 14px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; max-width: 1400px; margin: 0 auto; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 var(--pad); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--panel); }
.tile.big { grid-column: span 2; grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
@media (hover: hover) { a.tile:hover img { transform: scale(1.04); } }
.tile .badge { position: absolute; bottom: 6px; inset-inline-start: 6px; display: inline-flex; align-items: center; gap: 4px;
               padding: 2px 8px; border-radius: 99px; font-size: 12px; background: rgba(0,0,0,.55); direction: ltr; }
.tile .badge::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent #fff; }
.tile.missing img { filter: grayscale(.8) blur(1px); opacity: .45; }
.tile.missing span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: 13px; line-height: 1.5; padding: 6px; }

/* ---------- lightbox ---------- */
.pswp { direction: ltr; --pswp-bg: #000; }
.pswp__caption { position: absolute; bottom: 0; inset-inline: 0; padding: 18px 16px max(16px, env(safe-area-inset-bottom));
                 text-align: center; direction: rtl; font: 400 14px/1.6 Plex, system-ui, sans-serif; color: #e9e3d8;
                 background: linear-gradient(transparent, rgba(0,0,0,.6)); pointer-events: none; }
.pswp__button--save svg { fill: none; }
.toast { position: fixed; bottom: 90px; left: 50%; translate: -50% 0; z-index: 100000; padding: 10px 18px; border-radius: 99px;
         background: rgba(30,26,20,.95); color: var(--text); font: 500 15px Plex, system-ui, sans-serif; direction: rtl;
         opacity: 0; transition: opacity .25s; pointer-events: none; }
.toast.on { opacity: 1; }

/* ---------- tell / sign-in ---------- */
.center { min-height: 100svh; display: grid; place-content: center; text-align: center; padding: var(--pad); }
.big-mic { width: 120px; height: 120px; margin: 0 auto 24px; border-radius: 50%; display: grid; place-content: center; font-size: 52px;
           background: radial-gradient(circle, #3a2c14 0%, #1d170e 70%); border: 1px solid var(--line);
           box-shadow: 0 0 0 10px rgba(227,171,93,.06), 0 0 0 22px rgba(227,171,93,.03); }
.steps { display: grid; gap: 10px; margin: 26px auto; max-width: 420px; text-align: start; }
.steps div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.steps b { color: var(--accent); margin-inline-end: 8px; }

/* ---------- tell the story ---------- */
.small { font-size: 13px; }
.tell section { padding-top: 26px; }
.targets { display: flex; flex-wrap: wrap; gap: 8px; }
.targets button, .link { font: inherit; color: inherit; background: none; cursor: pointer; }
.targets button { padding: 7px 16px; border-radius: 99px; border: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.targets button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 14px; max-height: 52vh; overflow-y: auto; border-radius: 12px; }
@media (min-width: 700px) { .picker { grid-template-columns: repeat(7, 1fr); } }
.picker button { padding: 0; border: 0; aspect-ratio: 1; cursor: pointer; background: var(--panel); }
.picker img { width: 100%; height: 100%; object-fit: cover; }
.chosen { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.chosen:empty { display: none; }
.chosen img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; }
.link { border: 0; padding: 0; color: var(--accent); display: block; margin-top: 4px; font-size: 14px; }
.rec { text-align: center; }
.hints { list-style: none; padding: 0; margin: 0 auto 26px; max-width: 420px; color: var(--muted); }
.hints li::before { content: "◂ "; color: var(--accent); }
.mic-btn { --lvl: 0; position: relative; width: 132px; height: 132px; border-radius: 50%; border: 0; cursor: pointer; font-size: 54px;
           background: radial-gradient(circle, #3a2c14 0%, #1d170e 72%); box-shadow: 0 0 0 1px var(--line); }
.mic-btn .ring { position: absolute; inset: -14px; border-radius: 50%; border: 2px solid var(--accent); opacity: .15;
                 transform: scale(calc(1 + var(--lvl) * .35)); transition: transform .08s linear, opacity .2s; }
.recording .mic-btn { background: radial-gradient(circle, #6b2318 0%, #2a120c 72%); }
.recording .mic-btn .ring { opacity: .8; border-color: #e0664f; }
.state { margin: 18px 0 0; }
.timer { margin: 2px 0 0; font-size: 26px; font-weight: 500; direction: ltr; min-height: 1.4em; color: var(--accent); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
audio { width: 100%; margin-top: 10px; }
.mine { display: grid; gap: 12px; }
.story { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.story-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.story-head img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.story-head b { display: block; font-size: 15px; line-height: 1.5; }
.story-head small { color: var(--muted); font-size: 13px; }
.status { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #2b261c; color: var(--muted); white-space: nowrap; }
.status.ready { background: #3a2f17; color: var(--accent); }
.status.approved { background: #183526; color: var(--green); }
.status.failed { background: #3b1c16; color: #e98d78; }
.transcript { margin: 12px 0 0; font-size: 16px; }
.form { display: grid; gap: 10px; margin-top: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field textarea, .field input { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
                                border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.form .row { justify-content: flex-start; }

/* ---------- voices on the cover ---------- */
.voices { display: grid; gap: 12px; }
.voice { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.voice blockquote { margin: 0; font-size: 18px; line-height: 1.8; }
.voice blockquote::before { content: "«"; color: var(--accent); }
.voice blockquote::after { content: "»"; color: var(--accent); }
.voice figcaption { display: flex; gap: 10px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 14px; }
.voice figcaption img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.pswp__caption b { color: var(--accent); font-weight: 500; }

.report-box { margin: 10px 0 30px; border-color: #4a3a1c; }
.story-head.plain { grid-template-columns: 1fr auto; }
.row.start { justify-content: flex-start; }
.list-title { margin-top: 10px; }
.people { color: var(--muted); font-size: 16px; }
.people b { color: var(--text); font-weight: 500; }

/* ---------- narrate while browsing ---------- */
.viewer-wrap { position: relative; margin-top: 14px; }
.viewer { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 16px;
          background: #000; aspect-ratio: 4 / 3; max-height: 60vh; overscroll-behavior-x: contain; }
.viewer::-webkit-scrollbar { display: none; }
.viewer .slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.viewer img { width: 100%; height: 100%; object-fit: contain; }
.viewer-nav { position: absolute; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border-radius: 50%; border: 0;
              background: rgba(0,0,0,.45); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; direction: ltr; unicode-bidi: isolate; }
.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }
.viewer-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.viewer-meta span:last-child { direction: ltr; white-space: nowrap; }
.browse-hint { margin: 10px 0 0; font-size: 14px; color: var(--accent); }
.targets button[disabled] { opacity: .5; }
.strip { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.strip img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.per-photo { display: grid; gap: 10px; }
.per-photo .pp { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: start; }
.per-photo .pp img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.pswp__caption q { display: block; color: #d9d1c3; quotes: none; }
