/* Theoatrix Search — red on yellow on black */

:root {
  --bg:        #08080a;
  --panel:     #101014;
  --panel-2:   #16161c;
  --line:      #24242c;
  --line-soft: #1a1a21;

  --red:       #e11d2e;
  --red-hot:   #ff3143;
  --red-dim:   rgba(225, 29, 46, .16);
  --yellow:    #ffc300;
  --yellow-dim:rgba(255, 195, 0, .14);

  --text:      #f4f4f6;
  --muted:     #8d8d99;
  --muted-2:   #63636f;

  --radius:    0;
  --bar-h:     72px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* `display` on .clear/.more would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: inherit; }

/* ── ambient glow ─────────────────────────────────────────────── */

.glow {
  position: fixed;
  inset: -30vh 0 auto 0;
  height: 90vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(52vw 42vh at 50% 34%, rgba(225, 29, 46, .22), transparent 68%),
    radial-gradient(30vw 26vh at 50% 20%, rgba(255, 195, 0, .10), transparent 70%);
  transition: opacity .45s ease, transform .45s ease;
}
[data-view="results"] .glow { opacity: .45; transform: translateY(-16vh); }

/* ── stage / bar ──────────────────────────────────────────────── */

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* home view: the hero block sits centered in the viewport, not anchored
   near the top — results view keeps its own sticky-bar layout below */
[data-view="home"] .stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  padding: 40px 0;
  transition: padding .35s ease, gap .35s ease;
}

[data-view="results"] .bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  text-align: left;
  padding: 14px 0 14px;
  background: linear-gradient(var(--bg) 78%, rgba(8, 8, 10, .82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

/* grid children default to min-width:auto, which lets the field overflow */
[data-view="results"] .bar > * { min-width: 0; }

/* ── wordmark ─────────────────────────────────────────────────── */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.035em;
  font-size: clamp(38px, 7vw, 62px);
  line-height: 1;
  transition: font-size .35s ease, gap .35s ease;
}

.wordmark .mark {
  position: relative;
  overflow: hidden;
  width: 1.12em;
  height: 1.12em;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 3px rgba(225, 29, 46, .1);
}
.wordmark .mark svg { width: 78%; height: 78%; fill: none; }

/* the real logo covers the fallback glyph; app.js drops it if it 404s */
.mark-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wordmark-text { color: var(--text); }
[data-view="results"] .wordmark { font-size: 22px; gap: 9px; }
[data-view="results"] .wordmark .mark { box-shadow: none; }

.tagline {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 16px;
}
[data-view="results"] .tagline { display: none; }

/* ── search field ─────────────────────────────────────────────── */

.search {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 660px;
}
[data-view="results"] .search { max-width: none; }

.field {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 8px 0 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
[data-view="results"] .field { height: 48px; box-shadow: none; }

.field:focus-within {
  border-color: var(--red);
  background: var(--panel-2);
  box-shadow: 0 0 0 4px var(--red-dim), 0 14px 40px rgba(0, 0, 0, .55);
}
.field.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.field-icon {
  flex: none;
  width: 20px; height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}
.field:focus-within .field-icon { stroke: var(--red); }

#q {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: 500 17px/1 var(--font);
  outline: none;
}
#q::placeholder { color: var(--muted-2); }
#q::-webkit-search-cancel-button { display: none; }

.clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: pointer;
}
.clear svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.clear:hover { background: var(--panel-2); }
.clear:hover svg { stroke: var(--text); }

.go {
  flex: none;
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: var(--red);
  color: #fff;
  font: 700 14.5px/1 var(--font);
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.go:hover { background: var(--red-hot); }
.go:active { transform: scale(.97); }
[data-view="results"] .go { height: 36px; padding: 0 16px; }

/* ── suggestions ──────────────────────────────────────────────── */

.suggest-wrap { position: relative; }

.suggest {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--red);
  border-top: 0;
  border-radius: 0;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .62);
  max-height: min(62vh, 520px);   /* JS tightens this to the space available */
  overflow-y: auto;
  overscroll-behavior: contain;
}

.suggest li { border-radius: 0; }

.sg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.suggest li[aria-selected="true"] { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--red); }
.suggest li:hover { background: var(--panel-2); }

.sg-thumb {
  flex: none;
  width: 62px; height: 36px;
  border-radius: 0;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.sg-thumb.tall { width: 30px; height: 42px; }

.sg-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 0;
  background: var(--yellow-dim);
  color: var(--yellow);
  font-size: 15px;
}
.sg-icon.item { background: rgba(255,255,255,.06); color: var(--muted); }

.sg-body { min-width: 0; flex: 1; }
.sg-title {
  display: block;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-all { color: var(--muted); font-size: 14px; }
.sg-all b { color: var(--text); }

mark {
  background: none;
  color: var(--yellow);
  font-weight: 700;
}

/* ── corpus line ──────────────────────────────────────────────── */

.corpus {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted-2);
}
.corpus b { color: var(--muted); font-weight: 600; }
[data-view="results"] .corpus { display: none; }

/* ── filters ──────────────────────────────────────────────────── */

.results { padding: 22px 0 60px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover { color: var(--text); border-color: #34343f; }
.chip .n { color: var(--muted-2); font-weight: 500; font-variant-numeric: tabular-nums; }

.chip[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.chip[aria-pressed="true"] .n { color: rgba(255, 255, 255, .72); }

.chips.subtle .chip { height: 28px; font-size: 12.5px; padding: 0 11px; }
.chips.subtle .chip[aria-pressed="true"] {
  background: var(--yellow-dim);
  border-color: var(--yellow);
  color: var(--yellow);
}
.chips.subtle .chip[aria-pressed="true"] .n { color: rgba(255, 195, 0, .7); }

.count {
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--muted-2);
}

/* ── hits ─────────────────────────────────────────────────────── */

.hits { margin: 0; padding: 0; list-style: none; }

.hit {
  display: flex;
  gap: 16px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}
.hit:hover { background: var(--panel); }
.hit:hover .hit-title { color: var(--yellow); }

.hit-thumb {
  flex: none;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.hit-thumb.tall { width: 96px; aspect-ratio: 9 / 14; }

.hit-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background: linear-gradient(150deg, var(--panel-2), #0d0d11);
  border: 1px solid var(--line-soft);
  font-size: 26px;
}

.hit-body { min-width: 0; flex: 1; padding-top: 2px; }

.hit-title {
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.32;
  transition: color .15s ease;
}

.hit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted-2);
}
.hit-meta .dot { opacity: .5; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
}
.badge.video { background: var(--red-dim); color: #ff6470; }
.badge.short { background: var(--yellow-dim); color: var(--yellow); }
.badge.guide { background: rgba(120, 200, 255, .12); color: #7cc4ff; }
.badge.item  { background: rgba(255, 255, 255, .06); color: var(--muted); }

.hit-desc {
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hit-url {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}
.more:hover { border-color: var(--red); color: var(--text); }

.empty {
  margin: 44px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.empty b { color: var(--text); }

/* ── footer ───────────────────────────────────────────────────── */

.foot {
  /* no z-index here on purpose: .stage already claims z-index:1 to sit above
     the .glow background, and the suggestion dropdown's z-index:40 lives
     inside that stacking context. Giving .foot an equal z-index would create
     a competing context at the body level — being later in the DOM, it would
     then paint over the dropdown whenever the two visually overlap, no
     matter how high the dropdown's own z-index is set. Leaving .foot
     unpositioned means it just paints in normal document order, correctly
     under .stage's elevated content. */
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12.5px;
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--yellow); }

.foot-left { display: flex; flex-direction: column; gap: 4px; }

/* ── responsive ───────────────────────────────────────────────── */

@media (max-width: 720px) {
  [data-view="results"] .bar { grid-template-columns: 1fr; gap: 10px; }
  [data-view="results"] .wordmark { font-size: 19px; }
  .go { padding: 0 15px; }
  .hit { gap: 12px; padding: 12px 8px; margin: 0 -8px; }
  .hit-thumb, .hit-tile { width: 122px; }
  .hit-thumb.tall { width: 74px; }
  .hit-title { font-size: 15.5px; }
  .hit-desc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── watch / read pages ───────────────────────────────────────── */

[data-view="page"] .bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  text-align: left;
  padding: 14px 0;
  background: linear-gradient(var(--bg) 78%, rgba(8, 8, 10, .82));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
[data-view="page"] .bar > * { min-width: 0; }
[data-view="page"] .wordmark { font-size: 22px; gap: 9px; }
[data-view="page"] .wordmark .mark { box-shadow: none; }
[data-view="page"] .search { max-width: none; }
[data-view="page"] .field { height: 48px; box-shadow: none; }
[data-view="page"] .go { height: 36px; padding: 0 16px; }
[data-view="page"] .glow { opacity: .45; transform: translateY(-16vh); }

.page { padding: 26px 0 64px; }

.player {
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
}
.player-frame { position: relative; aspect-ratio: 16 / 9; }
.player.tall { max-width: 420px; margin-inline: auto; }
.player.tall .player-frame { aspect-ratio: 9 / 16; }

/* a 420px-wide portrait video reads as oversized once the page has real
   width to work with — pull it back in on tablet and up */
@media (min-width: 720px) {
  .player.tall { max-width: 340px; }
}
.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.cover {
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .55);
}
.cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(46vh, 380px);   /* keep the title and blurb above the fold */
  object-fit: cover;
}

.page-head { padding: 22px 2px 0; }

.page-title {
  margin: 0 0 10px;
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.22;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--muted-2);
}
.page-meta .dot { opacity: .5; }

/* ── privacy policy / prose pages ────────────────────────────── */

.policy section {
  max-width: 68ch;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}
.policy section:first-of-type { border-top: 0; }

.policy h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  color: var(--yellow);
}

.policy p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}
.policy p:last-child { margin-bottom: 0; }

.policy a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.policy a:hover { color: var(--yellow); }

.policy code {
  padding: 1px 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  font-size: .92em;
}

.blurb {
  max-width: 68ch;
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  font: 700 14px/1 var(--font);
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--yellow); color: var(--yellow); }
.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.primary:hover { background: var(--red-hot); border-color: var(--red-hot); color: #fff; }

/* prev / next */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 30px;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.pager-link:hover { border-color: var(--red); background: var(--panel); }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-link[hidden] + .pager-link.next { grid-column: 2; }

.pager-dir { font-size: 12px; font-weight: 700; color: var(--red); letter-spacing: .03em; }
.pager-name {
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* rails */

.rail { margin-top: 38px; }

.rail-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.rail-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 0;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.rail-card:hover { background: var(--panel); }
.rail-card:hover .rail-name { color: var(--yellow); }

.rail-thumb {
  flex: none;
  width: 92px;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.rail-thumb.tall { width: 54px; aspect-ratio: 9 / 14; }

.rail-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background: linear-gradient(150deg, var(--panel-2), #0d0d11);
  border: 1px solid var(--line-soft);
  font-size: 20px;
}

.rail-body { min-width: 0; }

.rail-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: color .15s;
}

.rail-meta {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  [data-view="page"] .bar { grid-template-columns: 1fr; gap: 10px; }
  [data-view="page"] .wordmark { font-size: 19px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; text-align: left; }
  .page-head { padding-top: 18px; }
}
