/* ── Publication page shared styles ─────────────────────────
   Matches the editorial system of Personal Website.html
   ─────────────────────────────────────────────────────────── */

:root {
  --bg:          #f5ede0;
  --bg-alt:      #efe6d5;
  --ink:         #1c1310;
  --ink-2:       #5c4d45;
  --ink-3:       #9c8b82;
  --card:        #fdf8f2;
  --border:      #ddd0c4;
  --accent:      #4b1220;
  --accent-soft: #f5e6e2;
  --accent-2:    #4a6228;
  --serif:       'Playfair Display', Georgia, serif;
  --sans:        'Inter', system-ui, sans-serif;
  --ease:        cubic-bezier(0.23, 1, 0.32, 1);
  --max:         800px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; overflow-x: clip; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 900px 500px at 10% 0%, rgba(75,18,32,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 600px 400px at 90% 0%, rgba(74,98,40,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ── Scroll progress ──────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ── Nav ──────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 237, 224, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-back:hover { color: var(--accent); }

.nav-venue {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 80px 0 64px;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
}

.hero-venue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.venue-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 4px;
}

.venue-pill.alt {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
}

.venue-name {
  font-size: 0.88rem;
  color: var(--ink-3);
  font-weight: 400;
}

.venue-name a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.venue-name a:hover { color: var(--accent); }

.hero-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 36px;
  max-width: 860px;
}

.authors {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.authors-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

.author-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.author-link.me { color: var(--accent); border-bottom-color: rgba(75,18,32,0.3); }
.author-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.author-sep { color: var(--ink-3); font-size: 0.75rem; }

.institution {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-weight: 300;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: all 0.2s var(--ease);
  border: 1.5px solid transparent;
  font-family: var(--sans);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(75,18,32,0.18);
}
.btn-primary:hover { background: #3a0e1a; box-shadow: 0 4px 16px rgba(75,18,32,0.28); transform: translateY(-1px); }

.btn-outline {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

.btn-green {
  background: transparent;
  color: var(--accent-2);
  border-color: var(--accent-2);
}
.btn-green:hover { background: var(--accent-2); color: white; transform: translateY(-1px); }

/* ── Content ──────────────────────────────────────────────── */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 80px;
  padding: 72px 0;
}

/* Single column when no sidebar needed */
.content-single {
  max-width: var(--max);
  padding: 72px 0;
}

.section-block {
  margin-bottom: 56px;
}

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

.block-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.block-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.block-text {
  font-size: 1.02rem;
  color: var(--ink-2);
  line-height: 1.82;
  font-weight: 300;
}

.block-text p { margin-bottom: 16px; }
.block-text p:last-child { margin-bottom: 0; }

.block-text strong {
  color: var(--ink);
  font-weight: 500;
}

/* List */
.contrib-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contrib-list li {
  display: flex;
  gap: 14px;
  font-size: 0.97rem;
  color: var(--ink-2);
  line-height: 1.6;
  font-weight: 300;
}

.contrib-list li::before {
  content: '—';
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.contrib-list li strong { color: var(--ink); font-weight: 500; }

/* Pub links in thesis */
.pub-ref-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pub-ref-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  font-size: 0.92rem;
  color: var(--ink-2);
  font-weight: 300;
  line-height: 1.55;
}

.pub-ref-venue {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 3px;
  height: fit-content;
  white-space: nowrap;
}

/* Video */
.video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 48px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* Image */
.result-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

.img-caption {
  font-size: 0.8rem;
  color: var(--ink-3);
  font-style: italic;
  text-align: center;
  margin-bottom: 48px;
  line-height: 1.5;
}

/* BibTeX */
.bibtex-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.bibtex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.bibtex-lang {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.bibtex-code {
  display: block;
  padding: 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink-2);
  overflow-x: auto;
  white-space: pre;
}

/* Sidebar */
.sidebar {
  padding-top: 4px;
}

.sidebar-block {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-block:first-child { border-top: 1px solid var(--border); }

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.sidebar-value {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.5;
}

.sidebar-value a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
.sidebar-value a:hover { opacity: 0.7; }

/* ── Back to top ──────────────────────────────────────────── */
.btt {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 42px; height: 42px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: all 0.2s var(--ease);
}
.btt.shown { display: flex; }
.btt:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
}
footer p { font-size: 0.82rem; color: var(--ink-3); letter-spacing: 0.06em; }
footer a { color: var(--ink-2); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--accent); }

/* ── Fade-up animations ───────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.fade-up.in { opacity: 1; transform: none; }

/* ── Mobile hamburger ─────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s;
}
.nav-hamburger:hover { background: var(--accent-soft); }
.nav-hamburger span {
  display: block;
  width: 20px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.23,1,0.32,1), opacity 0.2s;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-drawer {
  display: none;
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: rgba(245, 237, 224, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 8px 20px 20px;
  flex-direction: column;
  gap: 2px;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  display: block;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-drawer a:hover { background: var(--accent-soft); color: var(--accent); }
.nav-drawer a:active { background: var(--accent); color: white; }

@media (max-width: 600px) {
  .nav-hamburger { display: flex; }
  .nav-venue { display: none; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; gap: 0; }
  .sidebar { border-top: 1px solid var(--border); padding-top: 40px; margin-top: 0; }
}

@media (max-width: 600px) {
  .nav-inner { padding: 0 16px; }
  .hero { padding: 40px 0 40px; }
  .hero-inner, .content { padding: 0 20px; }
  .hero-title { font-size: 1.65rem; line-height: 1.25; }
  .hero-venue-row { gap: 6px; margin-bottom: 20px; }
  .authors-row { font-size: 0.88rem; }
  .institution { font-size: 0.8rem; }
  .hero-actions { gap: 8px; }
  .btn { padding: 10px 16px; font-size: 0.82rem; }
  .content-grid, .content-single { padding: 40px 0; }
  .section-block { margin-bottom: 40px; }
  .block-label { font-size: 0.68rem; margin-bottom: 12px; }
  .block-text { font-size: 0.97rem; }
  .video-wrap { margin-bottom: 36px; border-radius: 6px; }
  .result-img { border-radius: 6px; }
  .bibtex-code { font-size: 0.72rem; padding: 14px; overflow-x: auto; }
  .pub-ref-list li { grid-template-columns: 1fr; gap: 6px; }
  .sidebar-block { padding: 14px 0; }
  .sidebar-label { font-size: 0.65rem; }
  .sidebar-value { font-size: 0.85rem; }
  /* iOS safe area */
  .nav { padding-top: env(safe-area-inset-top, 0); }
  footer { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0)); }
  .btt { bottom: 20px; right: 16px; }
}

@media (max-width: 380px) {
  .hero-title { font-size: 1.45rem; }
  .btn { padding: 9px 13px; font-size: 0.78rem; }
}
