:root {
  color-scheme: light;
  --ink: #16201f;
  --muted: #5f6c68;
  --line: #dce4df;
  --panel: #ffffff;
  --soft: #eef5f1;
  --accent: #0f766e;
  --accent-strong: #0b4d48;
  --gold: #b7791f;
  --rose: #b42318;
  --shadow: 0 24px 70px rgba(27, 44, 40, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), rgba(183, 121, 31, 0.08) 42%, transparent 72%),
    #f7faf8;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

.lede {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.repo-link,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.copy-button {
  white-space: nowrap;
}

.copy-button.is-copied {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.demo-layout {
  display: grid;
  grid-template-columns: 260px minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.case-rail,
.viewer,
.caption-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.case-rail {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.rail-header strong {
  color: var(--ink);
}

.case-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.case-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 13px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.case-button:hover,
.case-button[aria-selected="true"] {
  border-color: rgba(15, 118, 110, 0.3);
  background: var(--soft);
}

.case-button strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.case-button span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.viewer {
  overflow: hidden;
}

.video-panel {
  background: #101615;
}

video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 68vh;
  object-fit: contain;
  background: #101615;
}

.viewer-meta {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.case-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.caption-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 68vh);
  overflow: hidden;
}

.caption-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.caption {
  overflow: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.caption-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.caption-section:first-child {
  padding-top: 0;
}

.caption-section:last-child {
  border-bottom: 0;
}

.caption-heading {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
}

.caption p,
.caption li {
  color: #2f3a37;
  font-size: 15px;
  line-height: 1.72;
}

.caption p {
  margin-bottom: 12px;
}

.caption ul {
  margin: 0;
  padding-left: 18px;
}

.timestamp {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  border-radius: 6px;
  padding: 1px 6px 2px;
  background: rgba(183, 121, 31, 0.15);
  color: #7a4b11;
  font-size: 13px;
  font-weight: 900;
}

mark {
  border-radius: 4px;
  padding: 0 2px;
  background: rgba(180, 35, 24, 0.15);
  color: inherit;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .demo-layout {
    grid-template-columns: 240px 1fr;
  }

  .caption-panel {
    grid-column: 1 / -1;
    grid-template-rows: auto minmax(360px, 60vh);
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 720px);
    padding-top: 22px;
  }

  .hero,
  .viewer-meta,
  .caption-toolbar {
    display: grid;
  }

  .repo-link,
  .copy-button {
    width: 100%;
  }

  .demo-layout {
    grid-template-columns: 1fr;
  }

  .case-rail {
    position: static;
  }

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

  .case-button {
    min-height: 128px;
  }

  .search-box {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 38px;
  }

  .case-list {
    grid-template-columns: 1fr;
  }

  .case-button {
    min-height: 0;
  }
}
