/* Dooop project page: light academic layout with a dark-mode variant. */
/* Layout constants shared by both palettes. */
:root {
  --radius: 10px;
  --max: 1100px;
  --gutter: 16px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --swatch-pipeline: #c4e1b4;
  --swatch-pipeline-line: #000000;
  --swatch-maroon: #861f41;
  --swatch-maroon-line: #861f41;
}

/* Palette "Pipeline" (default): colors of the paper pipeline figures.
   Always light and white, also when the OS asks for dark mode. */
:root,
:root[data-palette="pipeline"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f6f6f6;
  --section-alt-bg: #ffffff;
  --section-rule: 1px solid #e2e2e2;
  --surface: #ffffff;
  --text: #151515;
  --muted: #5f5f5f;
  --line: #e2e2e2;
  --line-strong: #bdbdbd;
  --accent: #3a6631;
  --accent-soft: #e7f2e0;
  --accent-text: #ffffff;
  --placeholder: #ececec;
  --figure-bg: #ffffff;
  --shadow: none;
  --hover-bg: var(--accent-soft);
  --hover-text: #151515;
  --sel-bg: #c4e1b4;
  --sel-text: #151515;
  --sel-border: #bdbdbd;
  --sel-underline: transparent;
  --cur-bg: #c4e1b4;
  --cur-text: #151515;
  --cur-border: #bdbdbd;
  --card-accent: #c4e1b4;
  --card-accent-width: 5px;
  --bar: #c4e1b4;
  --bar-teacher: #bdbdbd;
  --fab-bg: #c4e1b4;
  --fab-text: #151515;
  --fab-border: #bdbdbd;
  --spot-dim: rgba(255, 255, 255, 0.62);
  --spot-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  --zoom-glow: 0 0 0 6px #c4e1b4;
}

/* Palette "Maroon": the earlier Virginia Tech maroon theme, values unchanged. */
:root[data-palette="maroon"] {
  color-scheme: light dark;
  --bg: #faf8f5;
  --bg-alt: #f4f1ec;
  --section-alt-bg: var(--bg-alt);
  --section-rule: 0 solid transparent;
  --surface: #ffffff;
  --text: #1f1d1b;
  --muted: #635c55;
  --line: #e5e0d8;
  --line-strong: #e5e0d8;
  --accent: #861f41;
  --accent-soft: #f7ecf0;
  --accent-text: #ffffff;
  --placeholder: #ede9e3;
  --figure-bg: #ffffff;
  --shadow: 0 1px 2px rgba(31, 29, 27, 0.05), 0 6px 18px rgba(31, 29, 27, 0.05);
  --hover-bg: var(--accent-soft);
  --hover-text: var(--accent);
  --sel-bg: var(--accent-soft);
  --sel-text: var(--accent);
  --sel-border: var(--accent);
  --sel-underline: var(--accent);
  --cur-bg: var(--accent);
  --cur-text: var(--accent-text);
  --cur-border: var(--accent);
  --card-accent: var(--line);
  --card-accent-width: 1px;
  --bar: var(--accent);
  --bar-teacher: var(--muted);
  --fab-bg: var(--accent);
  --fab-text: var(--accent-text);
  --fab-border: var(--accent);
  --spot-dim: rgba(250, 248, 245, 0.62);
  --spot-shadow: 0 18px 48px rgba(31, 29, 27, 0.28), 0 4px 12px rgba(31, 29, 27, 0.12);
  --zoom-glow: 0 0 0 0 transparent;
}

@media (prefers-color-scheme: dark) {
  :root[data-palette="maroon"] {
    --bg: #161414;
    --bg-alt: #1b1918;
    --surface: #221f1e;
    --text: #ece7e2;
    --muted: #a9a19a;
    --line: #3a3532;
    --line-strong: #3a3532;
    --accent: #d46a8c;
    --accent-soft: #2f1e24;
    --accent-text: #161414;
    --placeholder: #2c2826;
    --figure-bg: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
    --spot-dim: rgba(22, 20, 20, 0.62);
    --spot-shadow: 0 18px 48px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}

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

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--sans);
  line-height: 1.25;
  margin: 0 0 0.6em;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.2rem;
  margin-top: 2.2em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.narrow-left {
  max-width: 760px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-text);
  padding: 8px 14px;
  border-radius: 6px;
  font-family: var(--sans);
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

/* Sticky nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
}

.topnav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 52px;
}

.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.topnav ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.topnav ul::-webkit-scrollbar {
  display: none;
}

.topnav li a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.95rem;
}

.topnav li a:hover {
  color: var(--hover-text);
  background: var(--hover-bg);
}

.topnav li a.is-current {
  color: var(--sel-text);
  background: var(--sel-bg);
}

/* Palette switcher */
.palette-switch {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.palette-switch button {
  font: inherit;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.palette-switch button + button {
  border-left: 1px solid var(--line);
}

.palette-switch button[aria-pressed="true"] {
  background: var(--sel-bg);
  color: var(--sel-text);
  font-weight: 600;
}

.palette-switch button:focus-visible {
  outline-offset: -3px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
}

.swatch-pipeline {
  background: var(--swatch-pipeline);
  border: 1.5px solid var(--swatch-pipeline-line);
}

.swatch-maroon {
  background: var(--swatch-maroon);
  border: 1.5px solid var(--swatch-maroon-line);
}

/* Header */
.page-header {
  padding: 56px 0 32px;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 720px;
  margin: 0 auto 12px;
}

.authors {
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.affiliation {
  font-family: var(--sans);
  color: var(--muted);
  margin: 2px 0 20px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.btn-icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  margin-right: -2px;
}

.btn small {
  font-weight: 400;
  font-size: 0.8rem;
}

.btn.is-disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-toggle {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-toggle:hover {
  background: var(--accent-soft);
}

/* Hero reel */
.hero {
  padding: 8px 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}

.reel {
  margin: 0;
}

.reel-frame {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.reel-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  font-family: var(--sans);
}

.reel-label {
  font-weight: 700;
  color: var(--accent);
  min-width: 4.5em;
}

.reel-prompt {
  color: var(--muted);
}

.reel-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.9rem;
}

.reel-steps li {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.reel-steps li.is-active {
  border-color: var(--sel-border);
  background: var(--sel-bg);
  color: var(--sel-text);
  font-weight: 600;
}

/* Sections */
.section {
  padding: 56px 0;
}

.section.alt {
  background: var(--section-alt-bg);
  border-top: var(--section-rule);
  border-bottom: var(--section-rule);
}

.lede,
.note {
  color: var(--muted);
  max-width: 760px;
}

.note {
  font-size: 0.95rem;
}

/* Key numbers */
.stats {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stats li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: var(--card-accent-width) solid var(--card-accent);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-value {
  font-family: var(--sans);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.stat-value small {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}

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

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: flex-end;
  margin: 20px 0;
  font-family: var(--sans);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.field > span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select {
  font: inherit;
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
  width: 420px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.segmented button {
  font: inherit;
  font-size: 0.95rem;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  min-width: 44px;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button[aria-checked="true"] {
  background: var(--sel-bg);
  color: var(--sel-text);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--sel-underline);
}

.segmented button:focus-visible {
  outline-offset: -3px;
}

/* Media and fallback */
.media {
  background: var(--placeholder);
  position: relative;
}

.square {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
}

.square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  background: var(--placeholder);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
}

.figure .img-fallback {
  position: static;
  min-height: 160px;
}

/* Side-by-side viewer */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 760px;
}

.pair figure {
  margin: 0;
}

.pair figcaption {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 8px;
}

.prompt-line {
  font-style: italic;
  margin-top: 14px;
}

/* Overlay */
.overlay-wrap {
  max-width: 420px;
}

.overlay img {
  position: absolute;
  inset: 0;
}

.overlay-top {
  opacity: 0.5;
}

.slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.slider input {
  width: 100%;
  accent-color: var(--accent);
}

.slider-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Figures */
.figure {
  margin: 32px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.figure-link {
  display: block;
  background: var(--figure-bg);
  border-radius: 8px;
  padding: 12px;
}

.figure img {
  width: 100%;
}

.figure figcaption {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 12px;
}

/* Tables */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table.data {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

table.data th,
table.data td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

table.data thead th {
  font-weight: 600;
  color: var(--muted);
  vertical-align: bottom;
  white-space: normal;
  min-width: 52px;
}

table.data tbody th[scope="row"] {
  text-align: left;
  font-weight: 400;
}

table.data .group-row th {
  text-align: left;
  font-style: italic;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text);
}

table.data .teacher-row {
  background: var(--accent-soft);
}

table.data b {
  color: var(--accent);
}

/* Compute bars */
.bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 16px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
}

.section:not(.alt) .bar-track {
  background: var(--placeholder);
}

.bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bar);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.bar-row.teacher .bar-fill {
  background: var(--bar-teacher);
}

.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill {
    transition: none;
  }
}

/* Gallery */
.gallery {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.gallery button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  font: inherit;
}

.gallery button:hover {
  border-color: var(--accent);
}

.gallery .media {
  aspect-ratio: 1 / 1;
}

.gallery .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery .tile-text {
  display: block;
  padding: 8px 10px 10px;
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.35;
}

.gallery .tile-cat {
  display: block;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 2px;
}

/* Footer and floating back-to-top */
.page-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-family: var(--sans);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--fab-border);
  background: var(--fab-bg);
  color: var(--fab-text);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  z-index: 40;
}

.to-top[hidden] {
  display: none;
}

/* Responsive */
@media (max-width: 760px) {
  .palette-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .palette-switch button {
    padding: 7px 9px;
  }

  .topnav-inner {
    gap: 10px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .page-header {
    padding: 36px 0 24px;
  }

  .links {
    gap: 8px;
  }

  .links .btn {
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .links .btn small {
    font-size: 0.75rem;
  }

  .section {
    padding: 40px 0;
  }

  .pair {
    gap: 10px;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .bar-row {
    grid-template-columns: 92px minmax(0, 1fr) 46px;
    gap: 8px;
  }

  .segmented button {
    padding: 8px 10px;
  }
}

/* Method animations: paper figure with a spotlight and a magnified region */
.anim {
  margin: 32px 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.anim-title {
  margin: 0 0 12px;
}

.anim-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-family: var(--sans);
}

.anim-step-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.anim-step-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.spot-wrap {
  position: relative;
  margin-top: 16px;
}

.spot-stage {
  position: relative;
  overflow: hidden;
  background: var(--figure-bg);
  border-radius: 8px;
}

.spot-base {
  display: block;
  width: 100%;
  height: auto;
}

.spot-ring {
  position: absolute;
  border-radius: 6px;
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px var(--spot-dim);
  pointer-events: none;
}

.spot-zoom {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  background: var(--figure-bg);
  border-radius: 10px;
  outline: 2px solid var(--accent);
  box-shadow: var(--zoom-glow), var(--spot-shadow);
  pointer-events: none;
}

.spot-zoom-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.spot-zoom-inner img {
  position: absolute;
  max-width: none;
  height: auto;
}

.spot-ring,
.spot-zoom,
.spot-zoom-inner img {
  transition: left 0.4s ease, top 0.4s ease, width 0.4s ease, height 0.4s ease;
}

.anim.no-anim .spot-ring,
.anim.no-anim .spot-zoom,
.anim.no-anim .spot-zoom-inner img {
  transition: none;
}

.anim-caption {
  min-height: 3.4em;
  margin: 16px 0 10px;
  font-size: 1.05rem;
}

.anim-chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--sans);
}

.anim-chips button {
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.anim-chips button:hover {
  color: var(--accent);
}

.anim-chips button[aria-current="step"] {
  border-color: var(--cur-border);
  background: var(--cur-bg);
  color: var(--cur-text);
  font-weight: 600;
}

/* Mobile: no overlay; the magnified region is a full-width card below the figure. */
.anim.is-mobile .spot-zoom {
  position: relative;
  left: auto;
  top: auto;
  width: auto;
  margin-top: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: var(--shadow);
}

.anim.is-mobile .spot-zoom-inner {
  margin-left: auto;
  margin-right: auto;
}

.spot-hint {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .spot-ring,
  .spot-zoom,
  .spot-zoom-inner img {
    transition: none;
  }
}

@media (max-width: 760px) {
  .anim {
    padding: 14px;
  }
}
