/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:          #FAF6F0;
  --bg-card:     #F3EDE3;
  --bg-active:   #F5E6C8;
  --border:      #D4C8B0;
  --text:        #1A100A;
  --text-muted:  #5C4A32;
  --accent:      #B5622A;
  --accent-soft: #E8C99A;
  --mark-bg:     #F5E6C8;
  --mark-text:   #7A3A10;

  --font-serif:  'Playfair Display', Georgia, serif;
  --font-body:   'Source Serif 4', Georgia, serif;

  --radius:      6px;
  --shadow:      0 2px 8px rgba(46, 34, 24, 0.08);
  --transition:  0.15s ease;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.player-page {
  height: 100vh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header h1 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
  text-align: center;
}

.back-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.back-link:hover { color: var(--accent); }

/* ── Player layout ──────────────────────────────────────────────────────── */
.player-layout {
  display: grid;
  grid-template-columns: 1fr 520px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.video-column {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  gap: 1rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.interview-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

video {
  width: 100%;
  border-radius: var(--radius);
  background: #1a1008;
  box-shadow: var(--shadow);
}

.video-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.copy-link-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  letter-spacing: 0.01em;
}
.copy-link-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Transcript column ──────────────────────────────────────────────────── */
.transcript-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.transcript-search {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  outline: none;
  width: 100%;
}
.transcript-search::placeholder { color: var(--text-muted); }
.transcript-search:focus { background: var(--bg-card); }

.transcript-panel {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem 0;
  scroll-behavior: smooth;
}

/* ── Segments ───────────────────────────────────────────────────────────── */
.transcript-list {
  list-style: none;
}

.segment {
  display: flex;
  gap: 0.75rem;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), border-color var(--transition);
  line-height: 1.5;
}

.segment:hover {
  background: var(--bg-card);
}

.segment.active {
  background: var(--bg-active);
  border-left-color: var(--accent);
}

.segment-time {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 0.2rem;
  min-width: 2.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.segment-text {
  font-size: 1.2rem;
  color: #1A100A;
}

.segment.active .segment-text {
  font-weight: 400;
}

.segment-anchor {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.25rem;
  margin-left: auto;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  border-radius: 3px;
}

.segment:hover .segment-anchor {
  opacity: 1;
}

.segment-anchor:hover {
  color: var(--accent);
}

.no-results {
  padding: 1.5rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Error ──────────────────────────────────────────────────────────────── */
.error-message {
  margin: 2rem auto;
  max-width: 480px;
  padding: 1rem 1.5rem;
  background: #fdf0e8;
  border: 1px solid #e0b898;
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.9rem;
}

/* ── Homepage ───────────────────────────────────────────────────────────── */
.home-header {
  text-align: center;
  padding: 3rem 2rem 2rem;
  border-bottom: 1px solid var(--border);
}

.home-header h1 {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 0.6rem;
}

.home-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.global-search-wrap {
  max-width: 560px;
  margin: 1.5rem auto 0;
}

.global-search {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.global-search:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(181, 98, 42, 0.1);
}
.global-search::placeholder { color: var(--text-muted); }

.search-results {
  max-width: 560px;
  margin: 0 auto;
  padding: 0.5rem 0 1rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
  border-radius: var(--radius);
}
.search-result-item:hover { background: var(--bg-card); }

.search-result-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  letter-spacing: 0.01em;
}

.search-result-quote {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.5;
}

.search-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding: 0.5rem 0.5rem 0.75rem;
}

.search-no-results {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 1.5rem 0.5rem;
  font-style: italic;
}

.interview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.interview-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition), transform var(--transition);
}
.interview-card:hover {
  box-shadow: 0 4px 16px rgba(46, 34, 24, 0.14);
  transform: translateY(-2px);
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-active);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.card-thumbnail-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #E8DDD0, #D4C4A8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.card-body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.card-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.card-description {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  margin-top: 0.3rem;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  body.player-page {
    height: auto;
    overflow: auto;
  }

  .player-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .video-column {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    overflow-y: visible;
  }

  .transcript-column {
    height: 60vh;
    min-height: 300px;
  }
}
