/* =============================================
   TOKENS
   ============================================= */
:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #1a1a18;
  --muted: #6b6b65;
  --border: #e2e0d8;
  --accent: #1a4a8a;
  --accent-lt: #e8eef7;
  --tag-bg: #f0ede6;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'DM Sans', 'Helvetica Neue', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  text-align: justify;
}

/* =============================================
   LAYOUT
   ============================================= */
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
main { padding: 36px 0 56px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.card h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--accent-lt);
  color: var(--accent);
  font-size: .72rem;
  font-family: var(--mono);
  font-weight: 600;
  flex-shrink: 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

/* =============================================
   HERO
   ============================================= */
.hero {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 52px 0 40px;
  text-align: center;
}
.hero-inner { max-width: 900px; }

.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 5px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
  text-transform: uppercase;
}

.tags {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tag {
  background: var(--tag-bg);
  color: var(--muted);
  font-size: .71rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  font-weight: 600;
  line-height: 1.32;
  margin-bottom: 18px;
}

.authors { font-size: .94rem; color: var(--text); margin-bottom: 6px; line-height: 2; }
.authors sup { font-size: .68rem; vertical-align: super; }
.affil-note { font-size: .82rem; color: var(--muted); margin-bottom: 24px; }

.links-bar { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .14s;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: var(--sans);
}
.link-btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.link-btn--primary:hover { background: #0f3570; border-color: #0f3570; }
.link-btn--ghost { background: #fff; color: var(--text); border-color: var(--border); }
.link-btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================
   ABSTRACT
   ============================================= */
#abstract p { font-size: .96rem; color: #2a2a28; text-align: justify; line-height: 1.78; }

/* =============================================
   FIGURES — natural ratio, no forced heights
   ============================================= */
.fig-block { margin-top: 0; }
.fig-block + .fig-block { margin-top: 22px; }

.fig-block-title {
  font-weight: 600;
  font-size: .92rem;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* base figure style — no height constraint */
.fig-natural {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fafaf8;
}

.fig-natural img {
  width: 100%;
  height: auto;      /* natural ratio */
  display: block;
}

figcaption {
  padding: 12px 16px 14px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  text-align: left;
}

/* Row 1: Fig 1 + Fig 3 side by side, each 48% */
.fig-row-13 {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}
.fig-row-13 .fig-natural {
  flex: 1 1 0;
  min-width: 0;
}

/* Row 2: Fig 2 centred at 80% */
.fig-row-2 {
  display: flex;
  justify-content: center;
}
.fig-row-2 .fig-natural {
  width: 80%;
}

/* Centred 60% wrapper — used for dataset + ablation */
.fig-centered {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.fig-centered .fig-natural {
  width: 60%;
}

/* =============================================
   DATASET
   ============================================= */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-box { background: var(--tag-bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px 14px; text-align: center; }
.stat-value { font-family: var(--serif); font-size: 1.75rem; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: .79rem; color: var(--muted); font-weight: 500; }
.dataset-desc { font-size: .94rem; line-height: 1.72; margin-bottom: 14px; color: #2a2a28; }

.schema-title { font-size: .88rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }

.schema-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: 16px; }
.schema-table th { background: #f0ede6; padding: 8px 16px; text-align: left; font-weight: 600; border: 1px solid var(--border); }
.schema-table td { padding: 9px 16px; border: 1px solid var(--border); vertical-align: top; line-height: 1.55; }
.schema-table td:first-child { font-family: var(--mono); font-size: .8rem; color: var(--accent); white-space: nowrap; width: 110px; }
.schema-table td:nth-child(2) { color: var(--muted); font-size: .82rem; white-space: nowrap; width: 70px; }
.schema-table tr:nth-child(even) td { background: #faf9f6; }

.pipeline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
}
.pip-step { flex: 1; min-width: 100px; text-align: center; padding: 6px 8px; }
.pip-icon { font-size: 1.25rem; margin-bottom: 3px; }
.pip-label { font-size: .76rem; font-weight: 600; }
.pip-sub { font-size: .69rem; color: var(--muted); margin-top: 1px; }
.pip-arrow { color: var(--muted); font-size: 1rem; padding: 0 2px; flex-shrink: 0; }

.license-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .86rem;
  line-height: 1.6;
  color: #614700;
  margin-top: 16px;
}
.license-note a { color: #614700; font-weight: 600; }
.license-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* =============================================
   RESULTS TABS
   ============================================= */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 7px 18px; border: none; background: none; cursor: pointer;
  font-family: var(--sans); font-size: .87rem; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .14s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.results-wrap { overflow-x: auto; margin-bottom: 10px; }
.subsection-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.ablation-desc { font-size: .94rem; color: #2a2a28; margin-bottom: 14px; line-height: 1.72; }

.rtable { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rtable th {
  background: #f0ede6; padding: 8px 12px; text-align: center;
  font-weight: 600; border: 1px solid var(--border); white-space: nowrap; font-size: .8rem;
}
.rtable td { padding: 8px 12px; border: 1px solid var(--border); text-align: center; }
.rtable tr:not(.ours):hover td { background: #faf9f6; }
.th-left { text-align: left !important; padding-left: 14px !important; }
.method-col { text-align: left; font-weight: 600; white-space: nowrap; padding-left: 14px; }
.lang-cell {
  background: #f8f6f0; font-size: .72rem; font-weight: 700; color: var(--muted);
  text-align: center; letter-spacing: .05em; text-transform: uppercase;
  writing-mode: vertical-lr; transform: rotate(180deg);
  width: 26px; padding: 4px; border: 1px solid var(--border);
}
.rtable .ours td { background: #e8eef7 !important; font-weight: 700; }
.best { color: var(--accent); font-weight: 700; }
.ul { text-decoration: underline; }
.results-note { font-size: .81rem; color: var(--muted); line-height: 1.6; margin-top: 8px; }

/* =============================================
   AUDIO EXAMPLES — card grid layout
   ============================================= */
.examples-block { margin-bottom: 28px; }
.examples-block h3 { margin-bottom: 14px; font-size: 1.1rem; font-weight: 600; }
.emotion-tables { display: grid; gap: 24px; }
.emotion-table h4 { margin-bottom: 12px; font-size: 1rem; font-weight: 600; }
.table-wrap { }

.table-caption { margin-top: 10px; font-size: .85rem; line-height: 1.55; color: #6b7280; text-align: justify; }
.caption-icon { margin-right: 6px; }
.muted { color: var(--muted); font-size: .95rem; }

/* 2×2 grid of sample cards */
.samples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* individual sample card */
.ex-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

/* emotion pill bar at top */
.ex-emo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--tag-bg);
  border-bottom: 1px solid var(--border);
}
.ex-emo-pill {
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.ex-emo-arrow {
  font-size: .75rem;
  color: var(--muted);
}

/* coloured segmented text */
.ex-text-row {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafaf8;
}
.ex-seg-text {
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text);
}
.ex-seg { font-weight: 600; }
.ex-seg-div { color: var(--muted); margin: 0 3px; font-size: .8rem; }

/* duration highlight */
.dur-hl { color: var(--text); }
.dur-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  background: #FAEEDA;
  color: #633806;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  vertical-align: middle;
}

/* each audio row: label | player */
.ex-audio-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
  min-height: 44px;
}
.ex-audio-row:last-child { border-bottom: none; }

/* ours row — blue highlight */
.ex-audio-row--ours {
  background: #e8eef7;
}
.ex-audio-row--ours .ex-row-label {
  color: var(--accent);
  font-weight: 700;
  border-right-color: #91caff;
}

.ex-row-label {
  padding: 8px 10px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  white-space: nowrap;
  background: transparent;
}

.ex-row-player {
  padding: 6px 10px;
  display: flex;
  align-items: center;
}
.ex-row-player audio {
  width: 100%;
  height: 32px;
}

/* reference row: multiple audios side by side */
.ex-row-player--multi {
  gap: 8px;
  flex-wrap: wrap;
}
.ex-ref-unit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.ex-ref-unit audio {
  width: 100%;
  height: 32px;
}
.ex-ref-tag {
  font-size: .7rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

/* text prompt reference */
.ex-ref-unit--text {
  font-size: .75rem;
  font-style: italic;
  line-height: 1.5;
  padding: 4px 0;
  flex: 1;
}

/* =============================================
   CITATION
   ============================================= */
.citation-lead { font-size: .92rem; color: var(--muted); margin-bottom: 13px; }
.bibtex {
  background: #1a1a18; color: #d4d0c8; border-radius: 10px;
  padding: 20px 22px; font-family: var(--mono); font-size: .81rem;
  line-height: 1.75; overflow-x: auto; position: relative;
}
.bibtex .kw { color: #7ec8e3; }
.bibtex .val { color: #b5d99c; }
.bibtex .key { color: #f9c97a; }
.copy-btn {
  position: absolute; top: 12px; right: 14px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #d4d0c8; border-radius: 6px; padding: 3px 12px;
  font-size: .74rem; cursor: pointer; font-family: var(--sans); transition: background .14s;
}
.copy-btn:hover { background: rgba(255,255,255,.2); }

/* =============================================
   FOOTER
   ============================================= */
.footer { padding: 26px 0 38px; border-top: 1px solid var(--border); background: #fff; color: var(--muted); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; font-size: .84rem;
}

code {
  background: #f1f1f1; padding: 2px 6px; border-radius: 4px;
  font-family: var(--mono); font-size: .85em;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 820px) {
  .hero h1 { font-size: 1.38rem; }
  .card { padding: 20px 18px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
  .section-header { flex-direction: column; align-items: flex-start; }

  /* stack figures vertically on mobile */
  .fig-row-13 { flex-direction: column; }
  .fig-row-2 .fig-natural { width: 100%; }
  .fig-centered .fig-natural { width: 90%; }

  /* stack sample cards on mobile */
  .samples-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .pipeline { flex-direction: column; }
  .pip-arrow { transform: rotate(90deg); }
  .stat-row { grid-template-columns: 1fr 1fr; }
}