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

:root {
  --bg: #faf8f4;
  --bg-alt: #f0ece4;
  --text: #2c2a26;
  --text-muted: #6b6560;
  --accent: #8b4513;
  --accent-light: #c49a6c;
  --border: #d4cfc6;
  --annotation-bg: #fdf6ec;
  --annotation-border: #e8d5b5;
  --speaker-reporter: #4a6741;
  --speaker-adam: #5b3a29;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* === Header === */
.site-header {
  background: var(--text);
  color: var(--bg);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.site-header .subtitle {
  font-size: 1rem;
  color: var(--accent-light);
  font-style: italic;
}

.site-header .tape-label {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.3rem 1rem;
  border: 1px solid var(--accent-light);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-light);
}

/* === Context Section === */
.context-section-wrapper {
  max-width: 750px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
}

.context-section {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--annotation-bg);
  border: 1px solid var(--annotation-border);
  border-radius: 3px;
}

.context-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.context-section p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.context-section p:last-child {
  margin-bottom: 0;
}

/* === Tape Navigation === */
.tape-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tape-nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: max-content;
}

.tape-btn {
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
  min-width: 2.2rem;
  text-align: center;
}

.tape-btn:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.tape-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.tape-sep {
  width: 1px;
  height: 1.2rem;
  background: var(--border);
  margin: 0 0.15rem;
}

/* === Main Content === */
.content {
  max-width: 750px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* === Tape Header === */
.tape-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tape-header h2 {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--accent);
}

.pdf-download {
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  border-radius: 2px;
  transition: all 0.15s;
  white-space: nowrap;
}

.pdf-download:hover {
  background: var(--accent);
  color: var(--bg);
}

/* === Transcript Area === */
.transcript-area {
  min-height: 300px;
}

.transcript-area .loading {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem;
  font-style: italic;
}

/* === Speaker Segments === */
.segment {
  margin-bottom: 1.5rem;
}

.segment-speaker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}

.segment-speaker.interviewer {
  color: var(--speaker-reporter);
}

.segment-speaker.subject {
  color: var(--speaker-adam);
}

.segment-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-left: 0.5rem;
  font-family: "Courier New", monospace;
}

.segment-text {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* === Footer Navigation === */
.tape-footer-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.nav-arrow {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.nav-arrow:hover:not(:disabled) {
  background: var(--bg-alt);
}

.nav-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .site-header h1 {
    font-size: 1.5rem;
  }

  .tape-nav {
    padding: 0.5rem 0.5rem;
  }

  .tape-btn {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
    min-width: 1.8rem;
  }

  .tape-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
}
