@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;500;700&family=Fraunces:wght@300;600&display=swap');

:root {
  --bg: #0a0e1a;
  --bg-2: #11172a;
  --bg-3: #161d33;
  --ink: #e8ecf5;
  --dim: #6b7694;
  --accent: #ff4d6d;
  --cyan: #4dd4ff;
  --gold: #ffd66b;
  --green: #4dff91;
  --purple: #b47dff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 999; background: var(--accent); color: #0a0e1a; padding: 10px 16px; font-size: 12px; text-decoration: none; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.skip-link:focus { left: 12px; top: 12px; outline: 2px solid #fff; outline-offset: 2px; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

/* ── HUD frame ─────────────────────────────────── */
.frame {
  position: fixed; inset: 0;
  pointer-events: none;
  padding: 24px 28px;
  display: flex; flex-direction: column;
  justify-content: space-between;
  z-index: 10;
}
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.bottom { display: flex; justify-content: flex-end; align-items: flex-end; gap: 20px; }

.title {
  font-family: 'Fraunces', serif;
  font-weight: 300; font-size: 28px;
  line-height: 1; letter-spacing: -0.02em;
}
.title em { font-style: italic; color: var(--accent); }
.subtitle {
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.25em; color: var(--dim); margin-top: 8px;
}
.meta {
  text-align: right; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--dim); line-height: 1.8;
}
.meta b { color: var(--cyan); font-weight: 500; }

.legend {
  font-size: 24px; line-height: 1.9; color: var(--dim); max-width: 420px;
  position: fixed; top: 140px; right: 28px;
  text-align: right;
}
.legend .op { color: var(--ink); font-size: 28px; margin-bottom: 6px; }
.legend .op span { color: var(--gold); }
.tick {
  display: inline-block; width: 21px; height: 21px;
  border-radius: 3px; vertical-align: middle; margin-right: 8px;
}

/* ── Buttons ───────────────────────────────────── */
.controls { pointer-events: auto; display: flex; gap: 8px; }
.btn {
  font-family: inherit; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.18em;
  background: transparent; color: var(--ink);
  border: 1px solid #2a3148; padding: 10px 16px;
  cursor: pointer; transition: all .2s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: var(--accent); border-color: var(--accent);
  color: #0a0e1a; font-weight: 700;
}
.btn.primary:hover { background: #ff6b85; color: #0a0e1a; }
.btn.active { border-color: var(--gold); color: var(--gold); }

/* ── Corner brackets ───────────────────────────── */
.corner {
  position: fixed; width: 14px; height: 14px;
  border: 1px solid var(--dim); pointer-events: none; z-index: 20;
}
.corner.tl { top: 16px; left: 16px; border-right: none; border-bottom: none; }
.corner.tr { top: 16px; right: 16px; border-left: none; border-bottom: none; }
.corner.bl { bottom: 16px; left: 16px; border-right: none; border-top: none; }
.corner.br { bottom: 16px; right: 16px; border-left: none; border-top: none; }

/* ── Presenter: narration overlay (centered on screen) ─ */
.presenter-bar {
  position: fixed; bottom: 80px; left: 0; right: 0; z-index: 30;
  display: flex; flex-direction: column;
  align-items: center;
  pointer-events: none;
  opacity: 0; transition: opacity .3s ease;
}
.presenter-bar.visible { opacity: 1; }
/* Initial "Press Play to start" state — centered CTA on the screen. */
.presenter-bar.initial {
  top: 50%; bottom: auto;
  transform: translateY(-50%);
}
.presenter-bar.initial .presenter-narration {
  font-size: 28px; font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 12px rgba(0,0,0,.85);
  animation: pr-initial-pulse 2.2s ease-in-out infinite;
}
@keyframes pr-initial-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
.presenter-narration {
  max-width: 650px; padding: 14px 24px;
  background: none;
  border: none;
  font-size: 28px; line-height: 1.5;
  color: rgba(200,210,230,.9); font-weight: 400;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
  text-align: center;
  pointer-events: auto;
  margin-bottom: 8px;
}
.presenter-step {
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--dim);
  white-space: nowrap;
}

/* ── Presenter: crop guide (9:16 for Shorts) ───── */
.crop-guide {
  position: fixed; inset: 0; z-index: 25;
  pointer-events: none; display: none;
}
.crop-guide.visible { display: block; }
.crop-guide-left,
.crop-guide-right {
  position: fixed; top: 0; bottom: 0;
  background: rgba(0,0,0,.75);
  border: none;
}
.crop-guide-border {
  position: fixed; top: 0; bottom: 0;
  border-left: 1px dashed var(--accent);
  border-right: 1px dashed var(--accent);
  pointer-events: none;
}

/* ── Home page ─────────────────────────────────── */
.home-header {
  padding: 60px 40px 40px;
  max-width: 1100px; margin: 0 auto;
}
.home-header h1, .home-header .hero-slogan {
  font-family: 'Fraunces', serif;
  font-weight: 300; font-size: 42px;
  letter-spacing: -0.03em;
}
.home-header h1 em, .home-header .hero-slogan em { font-style: italic; color: var(--accent); }
.home-header p {
  font-size: 13px; color: var(--dim);
  margin-top: 12px; line-height: 1.7; max-width: 600px;
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px; padding: 20px 40px 60px;
  max-width: 1100px; margin: 0 auto;
}
@media (max-width: 600px) {
  .topic-grid { grid-template-columns: 1fr; gap: 14px; padding: 16px 16px 40px; }
}
.topic-card {
  background: var(--bg-2);
  border: 1px solid #1e2640;
  padding: 0; overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
  text-decoration: none; color: inherit;
  display: block;
}
.topic-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}
.topic-card-body { padding: 20px 22px; }
.topic-card-body h3 {
  font-family: 'Fraunces', serif;
  font-weight: 300; font-size: 18px;
  letter-spacing: -0.01em; margin-bottom: 8px;
}
.topic-card-body h3 em { font-style: italic; color: var(--accent); }
.topic-card-body p {
  font-size: 11px; color: var(--dim);
  line-height: 1.7;
}
.topic-card-tag {
  display: inline-block; font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--cyan); margin-top: 12px;
  border: 1px solid #1e2640; padding: 4px 10px;
}

/* ── Mobile & tablet responsive HUD ────────────── */
@media (max-width: 768px) {
  .frame { padding: 14px 16px; }
  .title { font-size: 20px; }
  .subtitle { font-size: 10px; letter-spacing: 0.2em; margin-top: 6px; }
  .meta { font-size: 10px; letter-spacing: 0.15em; line-height: 1.6; }
  .legend {
    font-size: 13px; line-height: 1.6; max-width: 180px;
    top: 90px; right: 16px;
  }
  .legend .op { font-size: 14px; margin-bottom: 3px; }
  .tick { width: 12px; height: 12px; margin-right: 5px; }

  /* TikTok/Instagram-style action-button stack on the right edge.
     Each control is a 48px circular icon with an UPPERCASE text label
     rendered directly below it (matches the action buttons on swipe.html). */
  .controls {
    position: fixed;
    right: calc(12px + env(safe-area-inset-right, 0px));
    top: 50%;
    transform: translateY(-50%);
    bottom: auto; left: auto;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 0;
    flex-wrap: nowrap;
    z-index: 40;
  }
  .btn,
  .btn.primary {
    /* Button itself is a transparent column (icon circle on top, label below). */
    width: 56px;
    min-width: 56px;
    height: auto;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 0;
    font-weight: 400;
    letter-spacing: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--ink);
  }
  .btn:hover,
  .btn.primary:hover { background: transparent; border-color: transparent; color: var(--ink); }
  .btn::before {
    content: attr(data-icon);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(10, 14, 26, 0.65);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 20px;
    line-height: 1;
    letter-spacing: 0;
    color: var(--ink);
  }
  .btn::after {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
    line-height: 1;
  }
  .btn.primary::before {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0e1a;
  }
  .btn.active::before {
    border-color: var(--gold);
    color: var(--gold);
  }

  /* Narration centered across the bottom, clear of the right button stack. */
  .presenter-bar {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: calc(80px + env(safe-area-inset-right, 0px));
  }
  .presenter-narration {
    max-width: 92vw; padding: 10px 14px;
    font-size: 15px; line-height: 1.4;
  }
  .presenter-step { font-size: 10px; letter-spacing: 0.15em; }
}

@media (max-width: 480px) {
  .frame { padding: 10px 12px; }
  .title { font-size: 16px; }
  .subtitle { font-size: 9px; margin-top: 4px; }
  .meta { font-size: 9px; line-height: 1.5; }
  .legend {
    font-size: 11px; line-height: 1.5; max-width: 140px;
    top: 70px; right: 12px;
  }
  .legend .op { font-size: 12px; }
  .tick { width: 10px; height: 10px; margin-right: 4px; }
  .presenter-bar {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    right: calc(72px + env(safe-area-inset-right, 0px));
  }
  .presenter-narration {
    max-width: 100%; padding: 8px 12px;
    font-size: 13px; line-height: 1.35;
  }
  .presenter-step { font-size: 9px; }

  /* Tighter right-edge button stack for phones. */
  .controls {
    right: calc(10px + env(safe-area-inset-right, 0px));
    gap: 12px;
  }
  .btn { width: 52px; min-width: 52px; }
  .btn::before {
    width: 44px; height: 44px;
    font-size: 18px;
  }
  .btn::after { font-size: 9px; letter-spacing: 0.05em; }
}
