/* ===== GDF project page — styles ===== */
/* Theme variables. Palette inherited from the main site (neutral grays + the
   site primary blue) so the project pages match clintonenwerem.com. No bespoke
   per-project accent. */
:root {
  --bg-primary: #fff;
  --bg-secondary: #f0f0f0;
  --bg-card: #fff;
  --bg-card-img: #f6f6f6;
  --text-primary: #444444;
  --text-secondary: #5a5a5a;
  --text-muted: #717171;
  --text-caption: #505050;
  --border-color: #dbdbdb;
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --link-color: hsl(210, 80%, 35%);
  --accent: hsl(210, 80%, 35%);
  --accent-strong: hsl(210, 80%, 28%);
  --accent-light: #e7eef6;
  --code-bg: #f2f2f2;
  --table-bg: #fff;
  --table-border: #dbdbdb;
  --table-hover: #eef2f7;
  --table-stripe: #f7f7f7;
  --table-text: #444444;
  --footer-text: #888;
  --gradient-start: hsl(210, 80%, 35%);
  --gradient-end: hsl(210, 80%, 28%);
  --gdf-blue: #2b6cb0;
  --gdf-gray: #6e6b78;
}

[data-theme="dark"] {
  --bg-primary: #22272e;
  --bg-secondary: #2d333b;
  --bg-card: #2d333b;
  --bg-card-img: #262c33;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-caption: #d4d4d8;
  --border-color: #444c56;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.6);
  --link-color: hsl(210, 70%, 65%);
  --accent: hsl(210, 70%, 65%);
  --accent-strong: hsl(210, 70%, 72%);
  --accent-light: #2b3440;
  --code-bg: #1c222880;
  --table-bg: #2d333b;
  --table-border: #444c56;
  --table-hover: #343b44;
  --table-stripe: #2a3038;
  --table-text: #f4f4f5;
  --footer-text: #8b93a0;
  --gradient-start: hsl(210, 70%, 65%);
  --gradient-end: hsl(210, 70%, 58%);
  --gdf-blue: #7cb4f0;
  --gdf-gray: #b0acbb;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.section { background-color: var(--bg-primary); }
.has-background-light { background-color: var(--bg-secondary) !important; }

.title, .subtitle { color: var(--text-primary) !important; }
.content p, .content li { color: var(--text-secondary); }
.content a { color: var(--link-color); }
.has-text-info { color: var(--accent) !important; }
.has-text-muted { color: var(--text-muted) !important; }

code { background-color: var(--code-bg); color: var(--text-primary); }

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Hero */
.hero { background-color: var(--bg-primary); }
.hero.teaser { background-color: var(--bg-primary); }

.publication-title { font-family: 'Google Sans', sans-serif; }
.publication-authors { font-family: 'Google Sans', sans-serif; }
.publication-authors a { color: var(--link-color) !important; }
.author-block { display: inline-block; }

.title-logo {
  height: 0.92em;
  width: auto;
  vertical-align: -0.14em;
  margin-right: 0.32em;
  border-radius: 0.18em;
}

/* GDF brand wordmark — gradient sourced from the icon. */
.gdf-brand {
  font-variant: small-caps;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gdf-plain {
  font-variant: small-caps;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.gdf-blue { color: var(--gdf-blue); font-weight: 600; }
.gdf-gray { color: var(--gdf-gray); font-weight: 600; }

/* Highlighted R-A-M-V-E initials in the title backronym. */
.acronym-letter { color: var(--accent); }

.link-block a { margin-top: 5px; margin-bottom: 5px; }

/* Teaser */
.teaser .hero-body { padding-top: 0; padding-bottom: 3rem; }
.teaser { font-family: 'Google Sans', sans-serif; }
.teaser-figure {
  max-width: 880px;
  margin: 0 auto;
}
.teaser-caption,
.results-figure figcaption,
.method-figure figcaption {
  font-size: 0.9rem;
  color: var(--text-caption);
  margin-top: 0.8rem;
  text-align: justify;
  hyphens: auto;
}

/* Time-lapse strip: reach/close/contact/lift frames from the tabletop run. */
.gdf-timelapse {
  display: flex;
  gap: 12px;
  margin-top: 0.9rem;
}
.gdf-tl-frame {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}
.gdf-tl-frame img {
  width: 100%;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-img);
}
.gdf-tl-frame figcaption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-caption);
}
.gdf-tl-chip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.gdf-tl-chip--blue { background: var(--blue, #1253b4); }
.gdf-tl-chip--orange { background: var(--orange, #bf360c); }
.gdf-tl-chip--ok { background: var(--ok, #2e7d32); }
.gdf-tl-chip--lift { background: var(--lift, #7c4d97); }

/* Placeholder boxes for figures / videos. Dashed, branded, accessible. */
.placeholder {
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-light), transparent 80%);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
}
.placeholder--teaser { aspect-ratio: 16 / 7; width: 100%; }
.placeholder--wide   { aspect-ratio: 16 / 6; width: 100%; margin-top: 1.5rem; }
.placeholder--square { aspect-ratio: 1 / 1;  width: 100%; }
.placeholder--vid    { aspect-ratio: 4 / 3;  width: 100%; border-radius: 6px; }
.placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
}
.placeholder-inner i { font-size: 2rem; opacity: 0.85; }
.placeholder-inner span { font-size: 0.9rem; opacity: 0.9; }
.placeholder-meta { font-size: 0.75rem; opacity: 0.7; font-weight: 500; }

.placeholder-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 1rem;
}

/* Method cards */
.method-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  height: 100%;
  box-shadow: var(--shadow-md);
  border-top: 3px solid var(--accent);
}
.method-card .icon { margin-bottom: 0.75rem; }
.method-card h4 { margin-bottom: 0.5rem !important; }
.method-card p { font-size: 0.9rem; color: var(--text-secondary); }
.method-steps { margin-top: 1rem; }

.method-figure { margin-top: 2rem; }

/* Results layout helpers */
.key-takeaways .method-card { border-top-color: var(--accent-strong); }

/* Tables */
.table { background-color: var(--table-bg); color: var(--text-primary); }
.table th { color: var(--text-primary) !important; border-color: var(--table-border) !important; }
.table td { color: var(--table-text); border-color: var(--table-border) !important; }
/* Bold follows the surrounding (theme-aware) text colour, not Bulma's fixed
   #363636 (which is invisible against the dark-mode background). */
strong, b { color: inherit; }
.table td strong, .table th strong { color: inherit; }
.table tbody tr:nth-child(even) { background-color: var(--table-stripe); }
.table.is-hoverable tbody tr:hover { background-color: var(--table-hover) !important; }
.table tbody tr.is-highlight { background-color: var(--accent-light); }
.table tbody tr.is-highlight td { color: var(--text-primary); }
.table .is-best { font-weight: 700; color: var(--accent); }
.table tbody tr.is-highlight td.is-best { color: var(--accent-strong); }

/* Key results callout */
.key-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 980px;
  margin: 1.5rem auto;
}
.key-result {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1.2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--accent);
}
.key-result .kr-value {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.key-result .kr-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.3rem; }

/* Demos: compact hw-pair layout reused from EDF — pairs read side-by-side */
.hw-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 1rem auto 0.25rem;
  padding: 0 1rem;
  box-sizing: border-box;
  width: 100%;
}
.hw-pair-grid--featured {
  grid-template-columns: repeat(3, 1fr);
  max-width: 1100px;
}
.hw-pair-card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 14px 14px 16px;
}
.hw-pair-name { text-align: center; font-weight: 700; font-size: 1rem; margin-bottom: 10px; }
.hw-pair-vids { display: flex; gap: 10px; }
.hw-cell { flex: 1; text-align: center; position: relative; }
.hw-vid {
  width: 100%;
  display: block;
  border-radius: 6px;
  background: var(--bg-card-img);
  cursor: zoom-in;
}
.hw-cell::after, .zoom-badge {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background-color: rgba(0, 0, 0, 0.55);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='%23ffffff' d='M500.3 443.7l-119.7-119.7c-15.03 11.5-32.07 20.31-50.32 26.41l119 119c6.25 6.25 14.41 9.376 22.56 9.376s16.31-3.125 22.56-9.376C512.8 457.1 512.8 456.2 500.3 443.7zM207.1 351.1c79.41 0 143.1-64.59 143.1-143.1S286.5 64 207.1 64S64 128.6 64 207.1S128.6 351.1 207.1 351.1zM112 184h71.1V112h47.1v71.1H304v47.1h-72v72h-47.1V232H112V184z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.95;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.hw-cell:hover::after { opacity: 1; transform: scale(1.08); background-color: rgba(0, 0, 0, 0.85); }
.hw-ort { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-top: 5px; }

/* Section-level zoom hint pill */
.zoom-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 4px 12px;
  margin: 0.6rem auto 0.2rem;
  width: auto;
}
.zoom-hint .zoom-hint-icon {
  width: 1.6em;
  height: 1.6em;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.3em;
}

/* Lightbox */
.zoomable { cursor: zoom-in; }
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  padding: 4vmin;
  cursor: zoom-out;
}
.lightbox-overlay.is-open { display: flex; }
.lightbox-overlay video, .lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #fff;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 24px;
  font-size: 2.2rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.85;
}
.lightbox-close:hover { opacity: 1; }

/* BibTeX */
#BibTeX pre { background-color: var(--code-bg); color: var(--text-primary); }

/* Bulma dark-mode button overrides */
[data-theme="dark"] .button.is-dark {
  background-color: #1d1a28;
  border-color: #2c2740;
  color: var(--text-primary);
}
[data-theme="dark"] .button.is-dark:hover {
  background-color: #2c2740;
  color: #fff;
}

/* Footer */
.footer { padding: 2rem 1.5rem; background-color: var(--bg-primary); }
.footer .content p, .footer .content a { color: var(--footer-text); }
.footer a { color: var(--link-color); }

/* ---- Text alignment contract ---- */
p, .subtitle, .content { text-align-last: auto; }
.content p, p.subtitle, .subtitle p { text-align: justify; hyphens: auto; }
.method-card.has-text-centered > p { text-align: justify; hyphens: auto; }

/* ---- Cross-page mobile hardening ---- */
body { overflow-x: hidden; }
img, video { max-width: 100%; height: auto; }
.table-container { -webkit-overflow-scrolling: touch; }

@media (max-width: 768px) {
  .section { padding-left: 1rem; padding-right: 1rem; }
  .hero .title.is-1, .hero .title.is-2, .publication-title {
    font-size: clamp(1.4rem, 5.5vw, 2rem);
    line-height: 1.2;
  }
  .hero .subtitle, .publication-authors {
    font-size: 0.95rem;
    word-break: normal;
    overflow-wrap: break-word;
  }
  .publication-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  .publication-links .link-block { display: inline-block; }

  /* Tables */
  .table.is-narrow td, .table.is-narrow th {
    padding: 0.35em 0.5em;
    font-size: 0.85rem;
  }

  /* BibTeX block: horizontal scroll, never page-overflow. */
  pre, pre code {
    white-space: pre;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.78rem;
    max-width: 100%;
  }

  /* Footer column */
  .footer .columns > .column.is-8 { flex: 0 0 100%; max-width: 100%; }

  /* Teaser time-lapse strip: keep the four-across sequence, shrink gutters. */
  .gdf-timelapse { gap: 6px; }
  .gdf-tl-frame figcaption { font-size: 0.68rem; gap: 4px; margin-top: 0.3rem; }
  .gdf-tl-chip { width: 7px; height: 7px; }

  /* Demos comparison grid: keep columns, shrink gutters (skill §2.f.5). */
  .hw-pair-grid { gap: 10px; padding: 0 8px; }
  .hw-pair-grid--featured { gap: 8px; padding: 0 6px; }
  .hw-pair-card { padding: 8px 6px 10px; border-radius: 8px; }
  .hw-pair-name { font-size: 0.82rem; margin-bottom: 6px; }
  .hw-pair-vids { gap: 4px; }
  .hw-ort { font-size: 0.65rem; margin-top: 3px; }

  /* Zoom hint pill */
  .zoom-hint { font-size: 0.7rem; padding: 3px 9px; gap: 0.25rem; }
  .zoom-hint .zoom-hint-icon { width: 1.05em; height: 1.05em; vertical-align: -0.2em; }

  /* Results 3-up belief strip: keep columns. */
  .placeholder-row { gap: 0.4rem; }

  /* Lightbox */
  .lightbox-overlay { padding: 2vmin; }
  .lightbox-overlay video, .lightbox-overlay img { max-width: 96vw; max-height: 82vh; }
  .lightbox-close {
    top: 8px;
    right: 12px;
    font-size: 1.8rem;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
  }

  /* Key takeaways: Bulma's .columns will stack here; that's fine — three
     short cards stacked on a phone reads cleanly and is not a comparison gallery. */
}

@media (max-width: 420px) {
  .section { padding-left: 0.75rem; padding-right: 0.75rem; }
  /* Single column at the narrowest sizes (these are independent stat callouts,
     not a comparison gallery — collapse is correct here per skill §2.f.5 heuristic). */
  .key-results { grid-template-columns: 1fr; max-width: 360px; }
  .publication-links .button { padding-left: 0.9em; padding-right: 0.9em; }
  .table.is-narrow td, .table.is-narrow th {
    padding: 0.3em 0.4em;
    font-size: 0.78rem;
  }
  .gdf-timelapse { gap: 4px; }
  .gdf-tl-frame figcaption { font-size: 0.6rem; gap: 3px; }
  .gdf-tl-chip { width: 6px; height: 6px; }
  .hw-pair-grid { gap: 6px; padding: 0 4px; }
  .hw-pair-grid--featured { gap: 5px; padding: 0 4px; }
  .hw-pair-card { padding: 5px 4px 7px; }
  .hw-pair-name { font-size: 0.72rem; }
  .hw-pair-vids { gap: 3px; }
  .hw-cell::after, .zoom-badge {
    width: 18px;
    height: 18px;
    background-size: 10px 10px;
    top: 4px;
    right: 4px;
  }
  .hw-ort { font-size: 0.58rem; }
}
