/*
 * The scan results page, after the Figma "Paper Bible Companion – 2026", frame
 * Capture (130:1879). Dark only. Tokens carry the Figma's variable names.
 */

@font-face { font-family: 'Aktiv Grotesk App'; src: url('/fonts/AktivGroteskApp-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk App'; src: url('/fonts/AktivGroteskApp-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Aktiv Grotesk App'; src: url('/fonts/AktivGroteskApp-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Untitled Serif'; src: url('/fonts/UntitledSerif.ttf') format('truetype'); font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --canvas-primary: #121212;
  --surface-elevated-primary: #232121;
  --surface-elevated-secondary: #353333;
  --button-primary: #353333;
  --text-primary: #ffffff;
  --text-muted: #bfbdbd;
  --verse-number: #636161;
  --border-primary: #474545;
  --border-image-contrast: rgba(255, 255, 255, 0.15);
  --expressive-teal-50: #002529;
  --expressive-orange-50: #3d1310;
  --photo-ground: #4f473e;
  --highlight: #ffdb57;
  --selection: rgba(10, 132, 255, 0.3); /* the app's systemBlue at 0.3 */

  --size-base: 16px;
  --size-1: 13px;
  --size-2: 11px;

  --top-bar: 54px;
  --strip: 88px;
  --sans: 'Aktiv Grotesk App', system-ui, -apple-system, sans-serif;
  --serif: 'Untitled Serif', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--canvas-primary); color: var(--text-primary); }
body { font-family: var(--sans); font-size: var(--size-base); line-height: 1.25; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #0a84ff; outline-offset: 2px; }
img { display: block; }

/* ------------------------------------------------------------------ top bar */

.top-bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: var(--top-bar);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  /* Solid, since the page now scrolls under it. */
  background: var(--canvas-primary);
  text-align: center;
}
.top-bar__title { font-size: 15px; font-weight: 700; line-height: 20px; }
.top-bar__subtitle { font-size: 12px; line-height: 16px; color: var(--text-muted); }

/* --------------------------------------------------------------- page stage */

.stage-column { padding-top: var(--top-bar); }
.stage {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--photo-ground);
}
.stage__photo { position: absolute; }
.stage__photo img.photo { width: 100%; height: 100%; }
.stage__decoration { position: absolute; pointer-events: none; mix-blend-mode: multiply; }
.stage__decoration img { width: 100%; height: 100%; }

.word-target { position: absolute; border-radius: 2px; }
.word-target[aria-pressed='true'] { background: var(--selection); }

.pin {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.25);
}
/* The glyph at two thirds of the pin, in the app's pin grey (MarkPin glyphGray). */
.pin__glyph {
  width: 16px; height: 16px; background: #636161;
  -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

/* Listen and Compare: two equal buttons under the photo, in the app's button fill. */
.page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 16px 0; }
.page-action {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px;
  border-radius: 40px; background: var(--button-primary);
  font-size: 15px; font-weight: 700;
}
.page-action img { width: 24px; height: 24px; }

/* --------------------------------------------------------------------- feed */

.feed {
  position: relative; z-index: 0;
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px 16px 48px;
}
.section { display: flex; flex-direction: column; min-width: 0; }
.section__heading {
  display: flex; align-items: center; gap: 0; height: 48px; padding: 8px 0;
  font-size: var(--size-base); font-weight: 700; letter-spacing: -0.2px; line-height: 1.25;
  align-self: flex-start;
}
.section__heading img { width: 16px; height: 16px; }
.count-tag {
  position: relative; display: inline-flex; align-items: center; height: 16px; padding: 0 4px; margin: 0 0 0 4px;
  border-radius: 4px; font-size: var(--size-2); font-weight: 400; color: var(--text-muted); letter-spacing: 0;
}
.count-tag::before { content: ''; position: absolute; inset: 0; border-radius: 4px; background: var(--text-muted); opacity: 0.15; }

.row {
  display: flex; gap: 16px; align-items: flex-start;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 0 16px; scroll-padding-inline: 16px;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; flex: none; text-align: left; }

.card { background: var(--surface-elevated-primary); border-radius: 16px; padding: 16px; }

.study-guide { width: 280px; display: flex; flex-direction: column; gap: 8px; }
.study-guide__title { font-weight: 500; }
.study-guide__preview {
  font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.study-guide__source { font-size: var(--size-2); color: var(--text-muted); }

.theme { border-radius: 16px; padding: 16px; font-weight: 500; }

.video { width: 160px; display: flex; flex-direction: column; gap: 8px; }
.video__thumb {
  position: relative; aspect-ratio: 190 / 107; overflow: hidden;
  border: 0.5px solid var(--border-image-contrast); border-radius: 12px;
}
.video__thumb > img.thumb { width: 100%; height: 100%; object-fit: cover; }
.video__play {
  position: absolute; left: 7.5px; bottom: 7.6px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 1000px; background: rgba(0, 0, 0, 0.5);
}
.video__duration {
  position: absolute; right: 7.5px; bottom: 7.6px; height: 16px; padding: 0 4px;
  display: flex; align-items: center; border-radius: 4px; background: rgba(0, 0, 0, 0.5);
  font-size: var(--size-2);
}

.meta { display: flex; gap: 8px; align-items: flex-start; }
.meta > img { width: 32px; height: 32px; flex: none; }
.meta__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meta__title { font-size: var(--size-1); font-weight: 500; }
.meta__detail { font-size: var(--size-2); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.person { width: 140px; align-self: stretch; display: flex; flex-direction: column; gap: 8px; background: var(--surface-elevated-primary); }
.person__name { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__role {
  font-size: var(--size-2); color: var(--text-muted); margin-top: 2px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
/* The app's stand-in portrait: a gradient circle with the name's initial. */
.avatar { display: grid; place-items: center; flex: none; border-radius: 50%; font-size: 20px; font-weight: 500; color: #fff; }

.plan { width: 148px; display: flex; flex-direction: column; gap: 4px; }
/* As the app's plan card: a 148 × 84 image, the name on two lines, "Plan · 4 Days". */
.plan__thumb {
  display: block; width: 148px; height: 84px; object-fit: cover; margin-bottom: 4px;
  border: 0.5px solid var(--border-image-contrast); border-radius: 12px; background: var(--surface-elevated-primary);
}
.plan__thumb--large { width: 100%; height: auto; aspect-ratio: 148 / 84; }
.plan__name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.video .meta__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* annotation cards: "Scanned / Highlight" and "Scanned / Note" */
.annotations { display: flex; flex-direction: column; gap: 16px; }
.annotation { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
.annotation__head { display: flex; align-items: center; gap: 4px; }
.annotation__ref { flex: 1; display: flex; align-items: flex-end; gap: 4px; min-width: 0; }
.annotation__ref strong { font-weight: 500; }
.annotation__ref span, .annotation__when { font-size: var(--size-1); color: var(--text-muted); }
.annotation__when { display: flex; align-items: center; gap: 4px; }
.annotation__when img { width: 16px; height: 16px; }

.verse { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.45; }
.verse sup { font-family: var(--sans); font-size: 11.61px; color: var(--verse-number); vertical-align: baseline; margin-right: 4px; }
.verse mark { color: inherit; background: none; }
/* The app's mark cards (BulkPageDetail decoration): a highlight on its swatch (set
   inline), an underline or a strike in white, a circle as a white box, a note or a
   mark ruled in Border/Primary. */
.mark--highlight { border-radius: 4px; }
.mark--underline { text-decoration: underline; text-decoration-color: #fff; text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
.mark--strikethrough { text-decoration: line-through; text-decoration-color: #fff; text-decoration-thickness: 1.5px; }
.mark--enclosure { outline: 1.5px solid #fff; outline-offset: 1px; border-radius: 4px; }
.mark--note, .mark--mark { text-decoration: underline; text-decoration-color: var(--border-primary); text-decoration-thickness: 1.5px; text-underline-offset: 6px; }

.note { margin-top: 4px; padding: 8px 12px; border-radius: 8px; background: var(--surface-elevated-secondary); }
.note__label { font-size: var(--size-1); color: var(--text-muted); }
.note__text { margin: 2px 0 0; font-size: 16px; line-height: 1.5; }

/* -------------------------------------------------------------------- sheet */

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 85svh; overflow-y: auto;
  background: var(--surface-elevated-primary);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 0.2s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
.sheet__grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--border-primary); margin: 0 auto 8px; }
.sheet__head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.sheet__title { flex: 1; margin: 0; font-size: 17px; font-weight: 700; }
.sheet__close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; background: var(--button-primary); }
.sheet__close img { width: 24px; height: 24px; }
.sheet__body { display: flex; flex-direction: column; gap: 16px; }
.sheet__body p { margin: 0; line-height: 1.5; }
.sheet .card { background: var(--surface-elevated-secondary); }
.muted { color: var(--text-muted); }
.small { font-size: var(--size-1); }
.placeholder-label { font-size: var(--size-2); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 8px 12px;
  border-radius: 40px; background: var(--button-primary); font-size: 12px; font-weight: 700; line-height: 16px;
  color: var(--text-primary); text-decoration: none; align-self: flex-start;
}
.button--prominent { background: #ffffff; color: #121212; height: 44px; padding: 0 20px; font-size: 15px; }

/* ------------------------------------------------------------ not found page */

.missing { max-width: 420px; margin: 20svh auto 0; padding: 0 16px; text-align: center; }
.missing h1 { font-size: 22px; }
.missing p { color: var(--text-muted); line-height: 1.5; }

/* ------------------------------------------------------------------ desktop */

@media (min-width: 768px) {
  .layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); gap: 24px;
    max-width: 1200px; margin: 0 auto; padding: var(--top-bar) 24px 0;
  }
  .stage-column {
    position: sticky; top: calc(var(--top-bar) + 8px); align-self: start;
    display: flex; flex-direction: column; height: calc(100svh - var(--top-bar) - 24px);
    padding-top: 0;
  }
  .stage { flex: 1; min-height: 0; }
  .page-actions { padding: 16px 0 0; }
  .feed { padding: 8px 0 48px; }
  .row { margin: 0; padding: 0; }
  .scrim { background: rgba(0, 0, 0, 0.35); }
  .sheet {
    left: auto; top: 0; right: 0; bottom: 0; width: 420px; max-height: none;
    border-radius: 24px 0 0 24px; padding: 16px 20px 24px;
    animation-name: sheet-in;
  }
  @keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
  .sheet__grabber { display: none; }
}
