:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #111827;
  --text: #121826;
  --muted: #667085;
  --line: #d9dee8;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #101828;
  color: white;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 24px;
  align-items: start;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0;
}

.footer-brand {
  display: grid;
  gap: 6px;
}

.footer-brand strong {
  font-size: 1.02rem;
}

.footer-brand span {
  color: #98a2b3;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 18px;
  color: #d0d5dd;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px max(16px, calc((100vw - 1160px) / 2));
  background: rgba(247, 248, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  font-weight: 800;
  font-size: 1.05rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #344054;
  font-size: 0.95rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: #344054;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.button.ghost {
  background: white;
  color: var(--accent);
}

.button.small {
  min-height: 36px;
  padding: 0 14px;
}

.button.full {
  width: 100%;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 28px;
  align-items: stretch;
  min-height: 430px;
  padding: 42px;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(17, 24, 39, 0.92), rgba(15, 118, 110, 0.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: white;
}

.hero-copy {
  align-self: center;
  max-width: 720px;
}

.hero h1,
.page-title h1,
.detail-main h1,
.watch-sidebar h1 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
}

.hero p {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
}

.featured-panel,
.purchase-panel,
.form-panel,
.content-card,
.table-wrap,
.admin-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.featured-panel {
  align-self: end;
  padding: 24px;
  color: var(--text);
}

.pill,
.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section,
.page-title {
  margin-top: 44px;
}

.page-title {
  max-width: 780px;
}

.page-title.compact {
  margin-top: 12px;
}

.page-title h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.row-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.content-card {
  overflow: hidden;
}

.cover {
  aspect-ratio: 16 / 9;
  background: #1f2937;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 800;
}

.card-body {
  display: flex;
  min-height: 270px;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.card-body h3 {
  margin: 0;
  font-size: 1.18rem;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

.summary-toggle {
  color: var(--muted);
}

.summary-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 10;
}

.summary-toggle summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.summary-preview-toggle {
  display: block;
  flex: 1;
}

.summary-preview-toggle summary {
  width: fit-content;
}

.summary-toggle summary::marker,
.summary-toggle summary::-webkit-details-marker {
  display: none;
}

.summary-toggle summary::after {
  content: "+";
  margin-left: 8px;
  color: #667085;
}

.summary-toggle[open] summary {
  border-color: #a6d8d2;
  background: #effcf8;
}

.summary-toggle[open] summary::after {
  content: "-";
}

.summary-toggle p {
  margin-top: 10px;
  color: var(--muted);
  white-space: pre-line;
}

.summary-preview-toggle p {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

.summary-preview-toggle:not([open]) p {
  display: none;
}

.summary-preview-toggle[open] + .meta-row {
  margin-top: 4px;
}

.summary-preview:has(+ .summary-preview-toggle[open]) {
  display: none;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 700;
}

.meta-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #f9fafb;
}

.meta-row.large {
  margin: 24px 0;
}

.muted {
  color: var(--muted);
}

.small-text {
  font-size: 0.88rem;
}

.lead {
  color: #344054;
  font-size: 1.18rem;
  white-space: pre-line;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.detail-main,
.purchase-panel {
  padding: 28px;
}

.purchase-panel {
  position: sticky;
  top: 86px;
}

.purchase-panel h2 {
  margin: 0 0 16px;
  font-size: 2rem;
}

.segment-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.segment-list.public {
  padding-left: 0;
  list-style: none;
}

.segment-list li,
.segment-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.segment-list a.active {
  border-color: var(--accent);
  background: #effcf8;
}

.watch-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.watch-sidebar {
  position: sticky;
  top: 86px;
}

.watch-sidebar h1 {
  margin-bottom: 22px;
  font-size: 1.7rem;
}

.watch-content-meta {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.watch-content-meta strong {
  color: var(--accent);
  font-size: 1.2rem;
}

.watch-meta-label {
  color: #344054;
  font-size: 0.82rem;
  font-weight: 800;
}

.watch-content-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: pre-line;
}

.purchased-note {
  margin: 10px 0 0;
  text-align: center;
}

.player-area {
  min-width: 0;
}

.video-frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #111827;
  box-shadow: var(--shadow);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: start;
  margin-top: 64px;
}

.form-panel,
.admin-form {
  padding: 24px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: #344054;
  font-weight: 700;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
}

textarea.input {
  resize: vertical;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-text {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.current-cover {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.current-cover img {
  width: min(320px, 100%);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.error-text {
  margin: -8px 0 12px;
  color: var(--danger);
  font-size: 0.9rem;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px 14px;
}

.flash.success {
  border-color: #abefc6;
  color: var(--success);
}

.flash.error {
  border-color: #fecdca;
  color: var(--danger);
}

.legal-page {
  max-width: 920px;
  margin: 18px auto 0;
}

.legal-header {
  margin-bottom: 24px;
}

.legal-header h1 {
  margin: 0;
  line-height: 1.08;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.legal-header p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
}

.legal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.legal-table {
  display: grid;
  gap: 0;
  margin: 0;
}

.legal-table div {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.legal-table div:first-child {
  padding-top: 0;
}

.legal-table div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.legal-table dt {
  color: #344054;
  font-weight: 800;
}

.legal-table dd {
  margin: 0;
  color: var(--text);
}

.legal-document {
  display: grid;
  gap: 18px;
}

.legal-document h2 {
  margin: 10px 0 0;
  font-size: 1.18rem;
}

.legal-document h2:first-child {
  margin-top: 0;
}

.legal-document p,
.legal-document ul {
  margin: 0;
}

.legal-document ul {
  padding-left: 1.3rem;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.admin-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 20px;
}

.admin-stats strong {
  display: block;
  font-size: 2rem;
}

.table-wrap {
  margin-top: 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

small {
  color: var(--muted);
}

@media (max-width: 820px) {
  .site-header,
  .nav {
    align-items: flex-start;
  }

  .site-header {
    flex-direction: column;
  }

  .nav {
    flex-wrap: wrap;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .hero,
  .detail-layout,
  .watch-layout,
  .auth-shell,
  .two-col,
  .legal-table div {
    grid-template-columns: 1fr;
  }

  .legal-panel {
    padding: 22px;
  }

  .hero {
    padding: 28px;
  }

  .purchase-panel,
  .watch-sidebar {
    position: static;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }
}
