:root {
  --bg-0: #04141a;
  --bg-1: #0b2026;
  --panel: rgba(5, 20, 26, 0.8);
  --panel-strong: rgba(7, 26, 34, 0.94);
  --panel-soft: rgba(10, 34, 42, 0.72);
  --ink: #ecf7f5;
  --ink-soft: rgba(236, 247, 245, 0.72);
  --line: rgba(184, 228, 223, 0.18);
  --line-strong: rgba(184, 228, 223, 0.34);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --focus-a: #4ddbd1;
  --focus-b: #f7b955;
  --focus-c: #8de5e0;
  --sans: "Manrope", sans-serif;
  --display: "Syne", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

body[data-palette="amber"] {
  --focus-a: #f7b955;
  --focus-b: #f6844d;
  --focus-c: #f8d9a8;
}

body[data-palette="teal"] {
  --focus-a: #60e0bb;
  --focus-b: #bce98d;
  --focus-c: #d6faea;
}

body[data-palette="slate"] {
  --focus-a: #a9c4d0;
  --focus-b: #7de4e8;
  --focus-c: #d4e3ed;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 12% 10%, rgba(247, 185, 85, 0.18), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(77, 219, 209, 0.2), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(96, 224, 187, 0.12), transparent 34%),
    linear-gradient(170deg, var(--bg-0), var(--bg-1));
}

.backdrop,
.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.backdrop {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.03), transparent 0.4rem),
    radial-gradient(circle at 72% 64%, rgba(255, 255, 255, 0.025), transparent 0.35rem);
  background-size: 10rem 10rem, 12rem 12rem;
  opacity: 0.36;
}

.scanline {
  opacity: 0.1;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.3) 0,
    rgba(255, 255, 255, 0.3) 1px,
    transparent 1px,
    transparent 4px
  );
}

.page-shell {
  width: min(1260px, calc(100% - 2rem));
  margin-inline: auto;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 360px);
  gap: 1.25rem;
  padding: 1.4rem 0 1rem;
}

.eyebrow,
.section-label,
.section-note,
.stat-label,
.meta-badge,
.action-link,
.frame-theme,
.frame-mission,
.video-item-duration {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow,
.section-label,
.section-note,
.lede,
.focus-description {
  color: var(--ink-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  line-height: 0.98;
}

h1 {
  margin-top: 0.2rem;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  max-width: 9ch;
}

.lede {
  max-width: 60ch;
  margin: 0.8rem 0 0;
  font-size: 1rem;
}

.header-stats {
  display: grid;
  gap: 0.8rem;
}

.stat-card,
.panel,
.video-dialog {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stat-card {
  padding: 0.95rem 1rem;
  border-radius: 20px;
  background: rgba(10, 30, 38, 0.72);
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.stat-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.7rem;
  font-weight: 800;
}

.stat-value-small {
  font-size: 0.95rem;
  line-height: 1.35;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 340px;
  gap: 1rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  border-radius: 28px;
}

.focus-panel {
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 1rem;
  animation: rise 460ms ease;
}

.focus-media {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(140deg, rgba(77, 219, 209, 0.16), rgba(247, 185, 85, 0.1));
}

.focus-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-button {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(4, 20, 26, 0.76);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.focus-copy {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.focus-meta-row,
.chip-row,
.tone-tags,
.focus-actions,
.action-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.meta-badge,
.chip-button,
.tone-chip,
.action-link,
.ghost-button {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.meta-badge,
.tone-chip {
  margin: 0;
  padding: 0.42rem 0.65rem;
  font-size: 0.72rem;
}

.focus-story {
  margin: 0;
  font-size: 1.05rem;
  color: var(--focus-c);
}

.focus-description {
  margin: 0;
  line-height: 1.6;
}

.metric-panel {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.metric-card {
  padding: 0.8rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.metric-label {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.metric-value {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--display);
  font-size: 1.9rem;
}

.chip-button,
.action-link,
.ghost-button {
  padding: 0.65rem 0.85rem;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.chip-button {
  font-family: var(--mono);
  font-size: 0.74rem;
}

.chip-button.active,
.frame-card.active,
.video-item.active {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24), 0 0 36px rgba(77, 219, 209, 0.12);
}

.control-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.8rem;
}

.field > span {
  font-size: 0.92rem;
}

input,
select,
button {
  font: inherit;
}

input[type="search"],
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  padding: 0.85rem 0.9rem;
}

input::placeholder {
  color: rgba(236, 247, 245, 0.42);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
}

.accent-button {
  background: linear-gradient(135deg, rgba(77, 219, 209, 0.18), rgba(247, 185, 85, 0.14));
  border-color: rgba(255, 255, 255, 0.22);
}

.status-note {
  margin: 0.7rem 0 0;
  min-height: 2.6rem;
  line-height: 1.45;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
}

.video-list {
  display: grid;
  gap: 0.65rem;
}

.video-item {
  width: 100%;
  text-align: left;
  padding: 0.9rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
}

.video-item-head,
.frame-head,
.frame-subhead {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.video-item-head,
.frame-head {
  align-items: baseline;
}

.video-item-title {
  font-size: 0.96rem;
}

.video-item-meta {
  display: block;
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.stack-section {
  margin-top: 1.1rem;
}

.similar-grid,
.frame-grid {
  display: grid;
  gap: 0.85rem;
}

.similar-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.frame-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.frame-card {
  width: 100%;
  padding: 0;
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  min-height: 260px;
  transform: translateY(10px);
  opacity: 0;
  animation: card-rise 480ms ease forwards;
}

.frame-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.74));
}

.frame-title {
  font-size: 1rem;
}

.frame-year {
  color: rgba(255, 255, 255, 0.76);
}

.frame-subhead {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
}

.frame-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tone-chip {
  background: rgba(255, 255, 255, 0.08);
}

.video-dialog {
  width: min(880px, calc(100% - 1rem));
  padding: 1rem;
  border-radius: 28px;
  background: rgba(4, 20, 26, 0.96);
  color: var(--ink);
}

.video-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.dialog-head p {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

#videoPlayer {
  width: 100%;
  display: block;
  border-radius: 20px;
  background: #000;
}

.empty-state {
  padding: 2rem;
  border-radius: 24px;
  border: 1px dashed var(--line-strong);
  color: var(--ink-soft);
  text-align: center;
}

@keyframes rise {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes card-rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1100px) {
  .page-header,
  .hero-layout,
  .focus-panel {
    grid-template-columns: 1fr;
  }

  .similar-grid,
  .frame-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-media {
    min-height: 320px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100%, calc(100% - 1rem));
  }

  .page-header {
    padding-top: 1rem;
  }

  h1 {
    font-size: clamp(2.4rem, 15vw, 4rem);
  }

  .header-stats,
  .metric-grid,
  .similar-grid,
  .frame-grid {
    grid-template-columns: 1fr;
  }

  .focus-panel,
  .control-panel,
  .frame-card,
  .video-item,
  .stat-card,
  .metric-card {
    border-radius: 20px;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}
