/* EDDY project page — light academic theme inspired by Nerfies / CLoSD. */

:root {
  --fg: #1a1a1a;
  --fg-muted: #5a5a5a;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --border: #e5e7eb;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --max-width: 1080px;
  --narrow-width: 760px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Sans", "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

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

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 72px 0 48px;
  background:
    radial-gradient(circle at 20% 0%, rgba(31, 111, 235, 0.06), transparent 50%),
    radial-gradient(circle at 80% 0%, rgba(255, 138, 0, 0.05), transparent 55%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.title {
  font-family: "Castoro", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.25;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

.brand {
  font-weight: 700;
  background: linear-gradient(120deg, #1f6feb, #f97316);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.02em;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.author a { color: var(--fg); }
.author a:hover { color: var(--accent); }
.author sup { color: var(--accent); font-size: 0.7em; }

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}
.affiliations sup { color: var(--accent); }

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: #1a1a1a;
  color: #fff;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid #1a1a1a;
  transition: background 120ms ease, transform 120ms ease;
}
.badge:hover {
  background: #2d2d2d;
  border-bottom-color: transparent;
  transform: translateY(-1px);
}
.badge-icon { font-size: 1rem; }
.badge-disabled {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
  cursor: not-allowed;
}
.badge-disabled:hover { background: transparent; transform: none; }

/* ---------- Sections ---------- */
.section {
  padding: 56px 0;
}
.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

h2 {
  font-family: "Castoro", Georgia, serif;
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.lede {
  color: var(--fg);
  font-size: 1.02rem;
  margin: 0 0 28px;
  max-width: 880px;
}

p { margin: 0 0 14px; }

.muted { color: var(--fg-muted); font-weight: 400; font-size: 0.92em; }

/* ---------- Image loading (shimmer + fade-in) ---------- */
.img-wrap {
  position: relative;
  overflow: hidden;
  background: #e8eaed;
}

.img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.55) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: img-shimmer 1.4s ease-in-out infinite;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 1;
}

.img-wrap.loaded::after {
  opacity: 0;
  animation: none;
}

.img-wrap img {
  display: block;
  width: 100%;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.img-wrap.loaded img {
  opacity: 1;
}

@keyframes img-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ---------- Teaser figure ---------- */
.teaser {
  margin: 0;
  text-align: center;
}
.teaser img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.teaser figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.55;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.teaser-methods {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}
.teaser-method {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.teaser-method-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: left;
}
.teaser-method-prompt {
  font-weight: 400;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--fg-muted);
}
.teaser-method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.teaser-method-grid .img-wrap {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ---------- Simulation ---------- */
.sim-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.sim-panel {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
}

.sim-panel figcaption {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.sim-panel canvas {
  display: block;
  width: 280px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  background: #fbfbfd;
  border-radius: 6px;
}

.sim-stat {
  margin: 8px 2px 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sim-stat strong {
  color: var(--fg);
  font-weight: 600;
}
.stat-n {
  color: var(--fg-muted);
  font-size: 0.75rem;
}
.stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
}
.stat-badge--win  { background: rgba(31,111,235,0.10); color: var(--accent); }
.stat-badge--lose { background: var(--bg-alt);          color: var(--fg-muted); border: 1px solid var(--border); }
.stat-badge--tie  { background: var(--bg-alt);          color: var(--fg-muted); border: 1px solid var(--border); }

.sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.sim-controls button {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 0.92rem;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.sim-controls button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.sim-controls button:active { transform: translateY(1px); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--fg-muted);
  user-select: none;
  cursor: pointer;
  margin-left: 4px;
}
.toggle input { accent-color: var(--accent); }

.sim-math {
  margin-top: 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.sim-math summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--fg);
}
.sim-math[open] summary { margin-bottom: 8px; }

/* ---------- BibTeX ---------- */
.bibtex {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ---------- Gallery ---------- */
#gallerySlides {
  overflow: hidden;
}
.gallery-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}
.gallery-slide {
  flex: 0 0 100%;
  min-width: 0;
}

.gallery-meta {
  margin-top: 14px;
  text-align: center;
}
.gallery-prompt {
  font-style: italic;
  font-size: 1rem;
  color: var(--fg-muted);
}

.gallery-cols {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}
.gallery-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gallery-col-label {
  font-weight: 600;
  font-size: 0.85rem;
  text-align: left;
}
.gallery-img-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.gallery-img-grid .img-wrap {
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid var(--border);
}

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

.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
}
.gallery-arrow {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font-size: 1.05rem;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease;
}
.gallery-arrow:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.gallery-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}
.gallery-dot {
  appearance: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-muted);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.gallery-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}

/* ---------- Footer ---------- */
.footer {
  padding: 32px 0 48px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .hero { padding: 56px 0 36px; }
  .section { padding: 40px 0; }
  .sim-grid { grid-template-columns: 1fr; }
  .gallery-cols { flex-direction: row; flex-wrap: nowrap; gap: 6px; }
  .gallery-img-grid { grid-template-columns: 1fr; gap: 2px; }
  .gallery-img-grid .img-wrap { aspect-ratio: 4/3; }
  .gallery-col { gap: 4px; }
  .gallery-meta { margin-top: 6px; }
  .gallery-nav { margin-top: 10px; }
}
