/* ============================================================
   GraphiXS project page
   Visual language matched to yilmazdoga.net (Linux Biolinum,
   dark-by-default + light toggle, purple->red->orange gradient).
   ============================================================ */

@font-face {
  font-family: 'Linux Biolinum';
  src: url('../assets/fonts/LinBiolinum_R.woff2') format('woff2'),
       url('../assets/fonts/LinBiolinum_R.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --main-bg-color: rgb(10, 10, 10);
  --main-txt-color: rgb(240, 240, 240);
  --muted-txt-color: rgba(240, 240, 240, 0.62);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.10);
  --hairline: rgba(255, 255, 255, 0.10);
  --warning-color: rgb(255, 35, 35);
  --hover-color: linear-gradient(90deg, rgb(131, 58, 180), rgb(253, 29, 29), rgb(252, 176, 69));
  --nav-bg: rgba(10, 10, 10, 0.7);
  --nav-border: rgba(255, 255, 255, 0.08);
  --nav-underline: rgba(255, 255, 255, 0.35);
  --scroll-thumb: rgba(255, 255, 255, 0.2);
  --code-bg: rgba(255, 255, 255, 0.04);

  --font-size-body: 1.11rem;
  --font-size-heading: 1.4rem;
  --nav-height: 56px;
  --page-width: clamp(320px, 92vw, 980px);
}

:root[data-theme="light"] {
  --main-bg-color: rgb(247, 247, 248);
  --main-txt-color: rgb(22, 22, 24);
  --muted-txt-color: rgba(22, 22, 24, 0.62);
  --card-bg: rgba(0, 0, 0, 0.02);
  --card-border: rgba(0, 0, 0, 0.12);
  --hairline: rgba(0, 0, 0, 0.10);
  --nav-bg: rgba(247, 247, 248, 0.7);
  --nav-border: rgba(0, 0, 0, 0.10);
  --nav-underline: rgba(0, 0, 0, 0.35);
  --scroll-thumb: rgba(0, 0, 0, 0.25);
  --code-bg: rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 12px); }

body {
  margin: 0;
  padding: 0;
  font-family: 'Linux Biolinum', Georgia, 'Times New Roman', serif;
  font-size: var(--font-size-body);
  line-height: 1.5;
  background-color: var(--main-bg-color);
  color: var(--main-txt-color);
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a {
  color: var(--main-txt-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* gradient text on hover — the site signature */
.grad-hover:hover,
.top-nav a:hover,
.top-nav .nav-brand:hover,
.authors a:hover,
.section-body a:hover,
.footer a:hover {
  background: var(--hover-color);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grad-text {
  background: var(--hover-color);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------------- top navigation ---------------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  font-size: 1.2rem;
  height: var(--nav-height);
  box-sizing: border-box;
}

.top-nav .nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
}

.top-nav a { text-decoration: none; color: var(--main-txt-color); }
.top-nav .nav-brand { font-weight: 600; letter-spacing: 0.2px; }
.top-nav .nav-links { display: flex; gap: 18px; align-items: center; }
.top-nav .nav-links a { opacity: 0.9; padding: 8px 2px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; margin: 0; padding: 8px;
  color: var(--main-txt-color); cursor: pointer; line-height: 0;
  border-radius: 6px; -webkit-tap-highlight-color: transparent;
}
.theme-toggle svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle:hover { color: rgb(252, 176, 69); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------------- page container ---------------- */
.page {
  width: var(--page-width);
  margin: 0 auto;
  padding-top: calc(var(--nav-height) - 20px);
  padding-bottom: 8vh;
}

/* ---------------- header / hero ---------------- */
.hero { text-align: center; padding: 3.2rem 0 1.2rem; }

.hero .wordmark {
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1;
  margin: 0 0 0.6rem;
}

.hero .paper-title {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 600;
  line-height: 1.28;
  max-width: 30ch;
  margin: 0.4rem auto 1.3rem;
}

.hero .venue {
  font-size: 1.05rem;
  color: var(--muted-txt-color);
  margin: 0 0 1.4rem;
}
.hero .venue strong { color: var(--main-txt-color); font-weight: 600; }

.authors {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.15rem 1.2rem; margin: 0 auto 0.5rem; max-width: 46rem;
  font-size: 1.16rem;
}
.authors .author { white-space: nowrap; }
.authors a { text-decoration: none; }
.authors sup { font-size: 0.7em; color: var(--muted-txt-color); }

.affils {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.2rem 1.1rem; margin: 0.35rem auto 0.2rem; max-width: 44rem;
  font-size: 0.98rem; color: var(--muted-txt-color);
}
.affils sup { color: var(--main-txt-color); }
.corresponding { font-size: 0.9rem; color: var(--muted-txt-color); margin-top: 0.25rem; }

/* ---------------- buttons ---------------- */
.button-row {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.6rem; margin: 1.8rem auto 0;
}

.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.42em 1.15em;
  text-align: center; text-decoration: none;
  font-size: 1.04rem;
  cursor: pointer;
  background-color: transparent;
  color: var(--main-txt-color);
  border: 2px solid var(--main-txt-color);
  border-radius: 10px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.btn svg { width: 1.05em; height: 1.05em; fill: currentColor; }
/* hover: gradient border (rounded, via border-box) + gradient label — no lift or squaring */
.btn:not(.todo):hover {
  border-color: transparent;
  background:
    linear-gradient(var(--main-bg-color), var(--main-bg-color)) padding-box,
    var(--hover-color) border-box;
}
.btn:not(.todo):hover .btn-label {
  background: var(--hover-color);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* placeholder / not-yet-available buttons */
.btn.todo {
  border-color: var(--card-border);
  color: var(--muted-txt-color);
  cursor: not-allowed;
}
.btn.todo .tag {
  font-size: 0.68em; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--card-border); border-radius: 5px;
  padding: 0.05em 0.4em; opacity: 0.8;
}

/* ---------------- sections ---------------- */
section { margin: 3.4rem 0; scroll-margin-top: calc(var(--nav-height) + 12px); }

.eyebrow {
  font-size: 0.82rem; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600; margin: 0 0 0.35rem;
}

.section-title {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 700; margin: 0 0 1rem; line-height: 1.15;
  display: inline-block; /* let the gradient span just the heading text */
}

.section-body { font-size: var(--font-size-body); }
.section-body p { margin: 0 0 1rem; }
.subhead { font-size: 1.24rem; font-weight: 600; margin: 2.2rem 0 0.6rem; }
.lead { font-size: 1.18rem; }

/* abstract */
.abstract-body { text-align: justify; hyphens: auto; }

.contrib-list { margin: 0.6rem 0 0; padding-left: 0; list-style: none; }
.contrib-list li { position: relative; padding-left: 1.6rem; margin-bottom: 0.6rem; }
.contrib-list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 0.7rem; height: 0.7rem; border-radius: 2px;
  background: var(--hover-color);
}

/* ---------------- figures / videos ---------------- */
figure { margin: 1.2rem 0; }

/* centered, size-constrained figures */
.fig-clip { max-width: 600px; margin: 1.5rem auto; }

.media-frame {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  line-height: 0;
}
.media-frame img,
.media-frame video { width: 100%; height: auto; display: block; }

figcaption {
  font-size: 0.98rem; color: var(--muted-txt-color);
  margin-top: 0.6rem; line-height: 1.45; text-align: left;
}
figcaption b, figcaption strong { color: var(--main-txt-color); font-weight: 600; }

/* teaser slightly emphasized */
.teaser figcaption { text-align: center; }

/* grid of small videos (settings) */
.media-grid {
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.media-grid figure { margin: 0; }
.media-grid .label {
  font-size: 0.95rem; font-weight: 600; margin: 0.5rem 0 0.1rem; text-align: center;
}
.media-grid .sub { font-size: 0.86rem; color: var(--muted-txt-color); text-align: center; }

/* two-up compare (with / without prior, linear / high-order) */
.compare-pair { display: grid; gap: 0.9rem; grid-template-columns: 1fr 1fr; }
.compare-pair figure { margin: 0; }
.compare-pair .cap-tag {
  display: inline-block; font-size: 0.86rem; font-weight: 600;
  margin: 0.5rem 0 0; padding: 0.1em 0.6em; border-radius: 6px;
  border: 1px solid var(--card-border);
}
.compare-pair .off { color: var(--muted-txt-color); }
.compare-pair .on {
  border-color: transparent;
  background: var(--hover-color);
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  border-image: var(--hover-color) 1;
}
.pair-center { text-align: center; }

/* hairline separator between the three priors */
.prior-sep { border: none; border-top: 1px solid var(--hairline); margin: 1.6rem 0; }

/* ---------------- A/B slider ---------------- */
.ab-slider {
  position: relative; width: 100%; overflow: hidden;
  border: 1px solid var(--card-border); border-radius: 12px;
  background: #000; touch-action: none; cursor: ew-resize; line-height: 0;
  user-select: none; -webkit-user-select: none;
}
.ab-slider video { display: block; width: 100%; height: auto; }
/* bottom layer establishes the slider size */
.ab-slider .ab-bottom { position: relative; }
.ab-slider .ab-bottom video { width: 100%; height: auto; display: block; }
/* top layer is clipped to a fraction of the width; its inner keeps full width so it stays aligned */
.ab-slider .ab-top {
  position: absolute; top: 0; left: 0; bottom: 0; width: 50%; overflow: hidden;
  border-right: 2px solid rgba(255,255,255,0.9);
}
.ab-slider .ab-top .ab-inner { position: absolute; top: 0; left: 0; }
.ab-slider .ab-top .ab-inner video { width: 100%; height: auto; display: block; }

.ab-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 40px; margin-left: -20px; cursor: ew-resize;
  display: flex; align-items: center; justify-content: center;
}
.ab-handle .grip {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10,10,10,0.75); backdrop-filter: blur(4px);
  border: 2px solid #fff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
.ab-handle .grip svg { width: 20px; height: 20px; fill: #fff; }

.ab-label {
  position: absolute; top: 12px; padding: 0.15em 0.7em;
  font-size: 0.92rem; font-weight: 600; color: #fff; line-height: 1.2;
  background: rgba(10,10,10,0.6); border-radius: 6px; backdrop-filter: blur(3px);
  pointer-events: none;
}
.ab-label.left { left: 12px; }
.ab-label.right { right: 12px; }
.ab-label .ours { color: rgb(252, 176, 69); }

/* ---------------- gallery ---------------- */
.gallery { margin-top: 0.8rem; }
.gallery + .gallery { margin-top: 2rem; }
.gallery .g-head { font-size: 1.02rem; font-weight: 600; margin-bottom: 0.6rem; }
/* center a gallery that fits without scrolling (e.g. the 3-tile Upgrading strip) */
.gallery-center .g-head { text-align: center; }
.gallery-center .g-scroll { justify-content: center; }
.gallery .g-head .setting { color: var(--muted-txt-color); font-weight: 400; }
.g-scroll {
  display: grid; gap: 0.7rem; grid-auto-flow: column;
  grid-auto-columns: 220px;
  overflow-x: auto; padding-bottom: 0.6rem;
  scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent;
}
.g-scroll::-webkit-scrollbar { height: 6px; }
.g-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
.g-item { text-align: center; }
.g-item img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--card-border); display: block;
}
.g-item .g-label { font-size: 0.85rem; margin-top: 0.35rem; color: var(--muted-txt-color); }
.g-item.ours img { border-color: rgb(252, 176, 69); }
.g-item.ours .g-label { color: rgb(252, 176, 69); font-weight: 600; }
.g-item.gt img { border-color: rgba(255,255,255,0.5); }
:root[data-theme="light"] .g-item.gt img { border-color: rgba(0,0,0,0.4); }

/* ---------------- results explorer ---------------- */
.explorer { margin-top: 1.4rem; }

.exp-controls { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.3rem; }
.exp-group { min-width: 0; }
.exp-group-label {
  font-size: 0.78rem; letter-spacing: 0.10em; text-transform: uppercase;
  font-weight: 600; color: var(--muted-txt-color); margin-bottom: 0.5rem;
}
.exp-btns { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }

/* the Setting axis groups its chips under small sub-labels, split by hairlines */
.exp-subgroup {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  padding-right: 0.9rem; border-right: 1px solid var(--hairline);
}
.exp-subgroup:last-child { border-right: 0; padding-right: 0; }
.exp-sublabel { font-size: 0.8rem; color: var(--muted-txt-color); }

/* chips — compact .btn-like toggles */
.exp-chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: inherit; font-size: 0.94rem; line-height: 1.1;
  padding: 0.34em 0.8em; cursor: pointer;
  background: transparent; color: var(--main-txt-color);
  border: 1.5px solid var(--card-border); border-radius: 9px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.exp-chip:hover { border-color: var(--nav-underline); }
.exp-chip.ours { color: rgb(252, 176, 69); border-color: rgba(252, 176, 69, 0.4); }
.exp-chip.gt { border-color: rgba(255, 255, 255, 0.35); }
:root[data-theme="light"] .exp-chip.gt { border-color: rgba(0, 0, 0, 0.3); }
/* active (selected) — rounded gradient border via border-box, like .btn:hover */
.exp-chip.active {
  border-color: transparent; font-weight: 600;
  background:
    linear-gradient(var(--main-bg-color), var(--main-bg-color)) padding-box,
    var(--hover-color) border-box;
}
/* todo (missing combo) — dashed + muted, unless it is the current selection */
.exp-chip.todo:not(.active) {
  color: var(--muted-txt-color); border-color: var(--card-border); border-style: dashed;
}
.exp-chip .tag {
  font-size: 0.66em; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--card-border); border-radius: 5px;
  padding: 0.05em 0.4em; opacity: 0.85; color: var(--muted-txt-color);
}

/* viewer — reuses the .ab-slider, with an overlay for missing combinations */
.exp-figure { margin: 0; }
.exp-viewer { position: relative; }
.exp-viewer .ab-slider { width: 100%; }
.exp-todo {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 1.5rem;
  border: 1px dashed var(--card-border); border-radius: 12px;
  background: var(--card-bg); color: var(--muted-txt-color);
  font-size: 1.04rem; line-height: 1.55;
}
.exp-todo[hidden] { display: none; }
.exp-todo b { color: var(--main-txt-color); }
.exp-caption { margin-top: 0.75rem; font-size: 0.95rem; color: var(--muted-txt-color); }
.exp-caption .ours { color: rgb(252, 176, 69); font-weight: 600; }

/* ---------------- poster ---------------- */
.poster-wrap { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.poster-wrap a.media-frame { display: block; transition: transform 0.15s ease; }
.poster-wrap a.media-frame:hover { transform: translateY(-2px); }

/* ---------------- citation / bibtex ---------------- */
.cite-formatted {
  border-left: 3px solid transparent; border-image: var(--hover-color) 1;
  padding-left: 1rem; margin: 0 0 1.4rem; color: var(--main-txt-color);
}
.bibtex-wrap { position: relative; }
.bibtex-wrap pre {
  margin: 0; padding: 1.1rem 1.1rem; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--card-border);
  border-radius: 10px; font-size: 0.92rem; line-height: 1.5;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--main-txt-color);
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  font-family: inherit; font-size: 0.9rem;
  padding: 0.25em 0.8em; border-radius: 8px; cursor: pointer;
  background: var(--main-bg-color); color: var(--main-txt-color);
  border: 1.5px solid var(--card-border);
}
.copy-btn:hover { border-color: rgb(252, 176, 69); color: rgb(252, 176, 69); }
.copy-btn.copied { color: rgb(252, 176, 69); }

/* ---------------- footer ---------------- */
.footer {
  border-top: 1px solid var(--hairline);
  margin-top: 4rem; padding: 2.2rem 0 1rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.4rem;
  font-size: 0.98rem; color: var(--muted-txt-color);
}
.footer a { color: var(--main-txt-color); text-decoration: none; }
.footer .foot-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer .foot-qr { display: flex; align-items: center; gap: 0.8rem; }
.footer .foot-qr img { width: 74px; height: 74px; border-radius: 8px; background: #fff; padding: 4px; }
.footer .foot-qr span { max-width: 12rem; line-height: 1.3; }

/* ---------------- responsive ---------------- */
@media (max-width: 720px) {
  :root { --font-size-body: 1.06rem; }
  .compare-pair { grid-template-columns: 1fr; }
  .authors { font-size: 1.08rem; gap: 0.15rem 0.9rem; }
  .top-nav { font-size: 1.05rem; }
  .top-nav .nav-inner { padding: 0 14px; }
  .top-nav .nav-links { gap: 12px; }
  .footer { flex-direction: column; align-items: flex-start; }
  /* let Setting sub-groups stack cleanly instead of butting against hairlines */
  .exp-subgroup { border-right: 0; padding-right: 0; flex-basis: 100%; }
}

@media (max-width: 460px) {
  .hero { padding-top: 2rem; }
  .btn { font-size: 0.98rem; padding: 0.4em 0.9em; }
  .nav-links .nav-hide-sm { display: none; }
  .exp-chip { font-size: 0.88rem; padding: 0.3em 0.7em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .poster-wrap a.media-frame { transition: none; }
}
