/* ============================================================
   Calibri Paper HTML — styles.css
   Palette: ocean_depths
   ============================================================ */

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

:root {
  --bg: #EDF2F7;
  --surface: #FFFFFF;
  --primary: #0D3B66;
  --secondary: #1B6B93;
  --accent: #14919B;
  --text: #0A1628;
  --muted: #6B8299;
  --line: #C8D6E0;
  --hero-bg-start: #0D3B66;
  --hero-bg-end: #145E75;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(13, 59, 102, 0.08);
  --shadow-md: 0 4px 16px rgba(13, 59, 102, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.18);
  --container: 1100px;
  --container-narrow: 760px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

mark {
  background: rgba(20, 145, 155, 0.13);
  border-radius: 3px;
  padding: 0 3px;
  color: inherit;
}

em { font-style: italic; }
strong { font-weight: 700; }
pre, code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; font-size: 0.875rem; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow { max-width: var(--container-narrow); }

/* ---------- Section backgrounds ---------- */
.section-pale  { background: var(--bg);     padding: 80px 0; }
.section-white { background: var(--surface); padding: 80px 0; }

/* ---------- Section headings ---------- */
.section-heading {
  color: var(--primary);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
}

.subsection-heading {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 32px 0 12px;
}

.subsection-intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 24px; }

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 59, 102, 0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 52px;
}

.nav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.section-hero {
  position: relative;
  background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  padding: 80px 0 72px;
  overflow: hidden;
}

.hero-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  mix-blend-mode: overlay;
  opacity: 0.12;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: 0.03em;
}

.section-hero h1 {
  color: #fff;
  margin-bottom: 16px;
}

.hero-authors {
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.hero-affiliation {
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
}

.hero-claim {
  background: rgba(255,255,255,0.07);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  color: rgba(255,255,255,0.9);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.hero-links { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-outline {
  display: inline-block;
  border: 1.5px solid rgba(255,255,255,0.6);
  color: rgba(255,255,255,0.9) !important;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  text-decoration: none;
}

.hero-figure { display: flex; flex-direction: column; }
.hero-figure img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.hero-figure figcaption {
  color: rgba(255,255,255,0.65);
  font-size: 0.8rem;
  font-style: italic;
  margin-top: 10px;
  text-align: center;
  line-height: 1.5;
}

/* ---------- Abstract ---------- */
.abstract-text {
  border-left: 4px solid var(--accent);
  padding-left: 24px;
  font-size: 1.05rem;
  line-height: 1.8;
  font-style: italic;
  color: var(--text);
  margin-bottom: 40px;
}

.contribution-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.contribution-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--accent);
}

.contribution-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.contribution-stat {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.contribution-label {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Two-column grid ---------- */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* ---------- Hypothesis / Blockquote ---------- */
.hypothesis {
  background: var(--bg);
  border-left: 6px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 20px 20px 20px 24px;
  font-style: italic;
  font-weight: 600;
  font-size: 1rem;
  color: var(--primary);
  margin: 24px 0;
  line-height: 1.6;
}

/* ---------- Granularity cards ---------- */
.granularity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.granularity-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  border-top: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.granularity-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.granularity-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  display: block;
}

.granularity-card h4 {
  color: var(--primary);
  margin-bottom: 10px;
}

.granularity-card p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Math block ---------- */
.math-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---------- Figure ---------- */
figure {
  margin: 0;
}

figure img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.5;
}

.figure-centered {
  max-width: 820px;
  margin: 0 auto 48px;
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.data-table caption {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  text-align: left;
  margin-bottom: 8px;
  caption-side: bottom;
}

.data-table thead th {
  background: var(--primary);
  color: #fff;
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
  border: none;
}

.data-table tbody td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:hover td { background: #EDF2F7; }

.baseline-row td { color: var(--muted); }
.calibri-row td { font-weight: 600; background: rgba(20, 145, 155, 0.05); }

.best-cell {
  background: rgba(20, 145, 155, 0.15) !important;
  font-weight: 700;
  color: var(--primary);
}

.nfe-improved { color: #2E7D32; font-weight: 700; }
.table-note { font-size: 0.83rem; color: var(--muted); font-style: italic; margin-top: 8px; }

/* ---------- Results tables grid ---------- */
.results-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

/* ---------- Inference grid ---------- */
.inference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  border-top: 4px solid var(--accent);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.stat-sub { display: block; font-size: 0.75rem; color: var(--muted); }

/* ---------- Table figure grid ---------- */
.table-figure-grid {
  align-items: start;
}

/* ---------- Takeaways card ---------- */
.takeaways-card {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  border-left: 6px solid var(--primary);
  margin-top: 32px;
}

.takeaways-title {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.takeaways-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.takeaways-list li {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  padding-left: 6px;
}

.takeaways-list li::marker { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--primary);
  padding: 64px 0;
  color: rgba(255,255,255,0.85);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

.footer-heading {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.citation-block {
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: rgba(255,255,255,0.88);
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-copy {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy:hover { background: #0e7a83; }

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.footer-links a {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover { color: #fff; }

.footer-ack {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
  margin-bottom: 0;
}

/* ---------- Animations ---------- */
.animate-fadein {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  transition-delay: var(--delay, 0ms);
}

.animate-fadein.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .animate-fadein {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid,
  .two-col-grid,
  .granularity-grid,
  .results-tables-grid,
  .inference-grid,
  .footer-grid { grid-template-columns: 1fr; }

  .contribution-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }

  .section-pale, .section-white { padding: 56px 0; }
  .section-hero { padding: 56px 0; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .container { padding: 0 16px; }
  h1 { font-size: 1.5rem; }
  .section-pale, .section-white { padding: 40px 0; }
}

/* AI Explanation UI */
.flecto-note, .flecto-callout, .flecto-card, .flecto-panel {
  position: relative;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.flecto-note::before, .flecto-callout::before, .flecto-card::before, .flecto-panel::before {
  content: "🤖 AI explanation";
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5em;
}
.flecto-note {
  border-left: 3px solid #60a5fa;
  background: rgba(96, 165, 250, 0.08);
}
.flecto-callout {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.flecto-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.flecto-panel {
  background: rgba(30,30,50,0.8);
  border: 1px solid rgba(100,100,200,0.3);
}
.flecto-note h4, .flecto-callout h4, .flecto-card h4, .flecto-panel h4 {
  margin: 0.5em 0 0.3em;
  font-size: 1rem;
  color: #0D3B66;
}
.flecto-card ul, .flecto-panel ul { padding-left: 1.5em; }
