/* DockAnywhere — warm CoWVLA-adapted styles */

:root {
  --bg: #efe8dc;
  --panel: rgba(255, 250, 243, 0.82);
  --panel-strong: rgba(255, 248, 239, 0.96);
  --line: rgba(21, 41, 31, 0.12);
  --ink: #15291f;
  --muted: #5d6c62;
  --accent: #9a4f1e;
  --accent-soft: rgba(154, 79, 30, 0.14);
  --forest: #234635;
  --focus-ring: #234635;
  --shadow: 0 18px 50px rgba(39, 38, 32, 0.08);
  --shadow-sm: 0 6px 18px rgba(39, 38, 32, 0.06);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --max-width: 1180px;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Legacy aliases retained for any stray references */
  --text: var(--ink);
  --text-muted: var(--muted);
  --border: var(--line);
}

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

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

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  background:
    radial-gradient(circle at top left, rgba(192, 107, 45, 0.14), transparent 26%),
    radial-gradient(circle at 80% 12%, rgba(35, 70, 53, 0.14), transparent 28%),
    linear-gradient(180deg, #f3ecdf 0%, var(--bg) 46%, #f7f2ea 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(21, 41, 31, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 41, 31, 0.03) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 88%);
          mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 88%);
}

img { max-width: 100%; display: block; }

/* Focus rings */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 20;
  width: min(calc(100% - 40px), var(--max-width));
  margin: 18px auto 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.7);
  -webkit-backdrop-filter: blur(18px);
          backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(39, 38, 32, 0.05);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--panel-strong); }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 22px;
}

.header-brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.header-brand span { color: var(--accent); }

.header-nav { display: flex; gap: 18px; }
.header-nav a {
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 180ms ease;
}
.header-nav a:hover { color: var(--accent); }

/* ── Section panels ── */
.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

section {
  position: relative;
  width: min(calc(100% - 40px), var(--max-width));
  margin: 28px auto;
  padding: clamp(28px, 4.5vw, 52px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-lg) + 4px);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 90px;
}

section::after {
  content: "";
  position: absolute;
  inset: auto -10% -52% auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192, 107, 45, 0.18), transparent 68%);
  pointer-events: none;
}

section:nth-of-type(even) {
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.85), rgba(244, 237, 226, 0.9)),
    var(--panel);
}

.section-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 1rem;
}

.subsection-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
  margin: 2.5rem 0 0.5rem;
}

.section-body {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 72ch;
  margin-bottom: 1.5rem;
}

.section-body strong { color: var(--ink); }

.table-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: clamp(40px, 6vw, 72px) clamp(28px, 5vw, 56px);
}

.hero-venue {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 16px;
  margin-bottom: 1.4rem;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3.4vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 auto 1.75rem;
  max-width: none;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-authors {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 auto 0.4rem;
  line-height: 1.8;
  max-width: none;
}

.hero-authors a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease, color 180ms ease;
}
.hero-authors a:hover { color: var(--accent); border-color: var(--accent); }

.hero-affil {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 auto 2rem;
  max-width: 60ch;
}

/* Buttons */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 auto 2.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid rgba(35, 70, 53, 0.18);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(154, 79, 30, 0.45);
  background: rgba(255, 244, 233, 0.98);
  color: var(--accent);
}

.btn-primary {
  background: var(--forest);
  color: #f5eee3;
  border-color: rgba(21, 41, 31, 0.4);
}
.btn-primary:hover {
  background: var(--ink);
  color: #f5eee3;
  border-color: rgba(21, 41, 31, 0.6);
}

/* Hero metric cards */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 960px;
  margin: 0 auto;
  text-align: left;
}

.metric-card {
  display: grid;
  gap: 6px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.metric-card.accent {
  background: linear-gradient(135deg, rgba(35, 70, 53, 0.97), rgba(21, 41, 31, 0.95));
  color: #f5eee3;
  border-color: rgba(21, 41, 31, 0.4);
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.metric-card.accent .metric-label { color: rgba(245, 238, 227, 0.78); }

.metric-value {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 2.8vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.metric-card.accent .metric-value { color: #f5eee3; }

.metric-value .unit {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 2px;
}

.metric-value.metric-value-text {
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.metric-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}
.metric-card.accent .metric-desc { color: rgba(245, 238, 227, 0.85); }

/* ── Abstract two-column layout ── */
.abstract-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
  gap: 32px;
  align-items: start;
  margin-top: 0.5rem;
}

.abstract-grid .section-body {
  max-width: none;
  margin-bottom: 0;
}

.abstract-grid .keypoints {
  grid-template-columns: 1fr;
  margin-top: 0;
}

/* ── Keypoints ── */
.keypoints {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 2rem;
}

.keypoint {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
}

.keypoint::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 22px;
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
}

.keypoint-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  margin: 16px 0 6px;
}

.keypoint-body {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Figure ── */
.figure-wrap {
  margin: 2rem 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
}

.figure-wrap img {
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius-md) - 6px);
  border: 1px solid rgba(21, 41, 31, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.figure-caption {
  margin: 14px 6px 4px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

.figure-caption strong { color: var(--ink); }

/* ── Method blocks ── */
.method-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 2rem;
}

.method-block {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.method-block:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.method-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.method-block-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.25;
}

.method-block-body {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.65;
}

.method-block-body em {
  color: var(--ink);
  font-style: italic;
}

/* ── KPI row ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 1.5rem 0 2.5rem;
}

.kpi-card {
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
}

.kpi-number {
  font-family: var(--serif);
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}

.kpi-sublabel {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 10px;
}

/* ── Comparison table ── */
.table-wrap {
  margin: 1.25rem 0 2rem;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead th {
  font-family: var(--serif);
  padding: 6px 12px 14px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
thead th:nth-child(2) { text-align: left; }

tbody td {
  padding: 12px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}
tbody td:first-child { color: var(--ink); }
tbody td:nth-child(2) { text-align: left; color: var(--ink); font-weight: 500; }

tbody tr.highlight-row td {
  background: rgba(154, 79, 30, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.table-section-header td {
  background: rgba(35, 70, 53, 0.06);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--forest);
  text-align: left;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.best { color: var(--accent); font-weight: 700; }

/* ── Citation ── */
.citation-block {
  position: relative;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow-sm);
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--ink);
  overflow-x: auto;
}

.citation-block code {
  font-family: inherit;
  white-space: pre;
  display: block;
}

.copy-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 239, 0.98);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.copy-btn:hover { color: var(--accent); border-color: rgba(154, 79, 30, 0.45); }
.copy-btn.copied { color: var(--forest); border-color: rgba(35, 70, 53, 0.45); }

/* ── Footer ── */
.site-footer {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 28px auto 48px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}
.site-footer a { color: var(--ink); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--accent); }
.footer-sub {
  margin-top: 6px;
  font-size: 0.8rem;
}

/* ── Reveal animation ── */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms ease, transform 600ms ease;
}

html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
}

html.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1080px) {
  .hero-title { max-width: none; }
}

@media (max-width: 760px) {
  section {
    width: min(calc(100% - 24px), var(--max-width));
    padding: 24px;
    border-radius: var(--radius-lg);
  }

  .site-header {
    top: 8px;
    width: min(calc(100% - 24px), var(--max-width));
    border-radius: 22px;
  }

  .header-inner {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .header-nav {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .header-nav a { white-space: nowrap; }

  .hero-cards { grid-template-columns: 1fr; }
  .method-blocks { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .abstract-grid { grid-template-columns: 1fr; gap: 22px; }

  .btn { flex: 1 1 auto; justify-content: center; }

  .site-footer {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .copy-btn { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  html.js .reveal,
  html.js .reveal.visible {
    opacity: 1 !important;
    transform: none !important;
  }
}
