/* ===== EgoSOS project page — sky blue & black ===== */
:root {
  --ink: #0b0b0c;          /* all text */
  --sky: #0ea5e9;          /* bright accent (fills, gradient) */
  --sky-text: #0369a1;     /* accent text on white */
  --sky-strong: #0284c7;   /* links, hover */
  --sky-bg: #e0f2fe;       /* tints */
  --sky-bg2: #f0f9ff;      /* section background */
  --line: #cfe8f8;         /* borders */
  --pink: #c2175b;         /* only for the figure's query-time dot */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(3, 105, 161, .06), 0 6px 18px rgba(3, 105, 161, .07);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.65;
  color: var(--ink); background: #fff;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--sky-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--sky-bg); color: var(--ink); padding: .08em .35em; border-radius: 5px; }
sup { font-size: .68em; line-height: 0; }

.container { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 24px; }
.container.wide { max-width: 1120px; }

/* ===== Top navigation ===== */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s ease;
}
.topnav.scrolled { border-bottom-color: var(--line); }
.topnav-inner { max-width: 1120px; margin: 0 auto; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 800; letter-spacing: -.01em; color: var(--ink); font-size: 17px; opacity: 0; transition: opacity .2s ease; }
.topnav.scrolled .brand { opacity: 1; }
.brand:hover { text-decoration: none; }
.navlinks { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap; padding: 6px 10px; border-radius: 999px; }
.navlinks a:hover { background: var(--sky-bg2); color: var(--sky-text); text-decoration: none; }
.navlinks a.active { background: var(--sky-bg); color: var(--sky-text); }

/* ===== Hero ===== */
.hero { text-align: center; padding: 44px 0 28px; }
.title { margin: 0 0 22px; }
.title-main {
  display: block; font-size: clamp(44px, 7vw, 68px); font-weight: 800; letter-spacing: -.035em; line-height: 1.15;
  padding-bottom: .06em;
  background: linear-gradient(90deg, #0b0b0c 0%, #0b0b0c 42%, var(--sky) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-sub { display: block; margin: 14px auto 0; max-width: 760px; font-size: clamp(20px, 2.6vw, 27px); font-weight: 600; letter-spacing: -.015em; line-height: 1.3; color: var(--ink); }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; font-size: 16.5px; max-width: 820px; margin: 0 auto; }
.author { white-space: nowrap; }
.author a { color: var(--ink); border-bottom: 1px solid var(--sky); }
.author a:hover { text-decoration: none; color: var(--sky-text); }
.affils { margin-top: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 26px; font-size: 19px; font-weight: 600; }
.note { margin: 6px 0 0; font-size: 14px; }
.logos { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 16px 38px; margin-top: 20px; }
.logos img { width: auto; }
.logos .logo-meta { height: 26px; }
.logos .logo-kaist { height: 32px; transform: translateY(6px); }  /* align the wordmark, not the swoosh, with the others */
.logos .logo-postech { height: 18px; }

.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 26px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 600; border: 1.5px solid var(--ink);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn:hover { background: var(--sky-strong); border-color: var(--sky-strong); text-decoration: none; transform: translateY(-1px); }
.btn-soon { background: #fff; color: var(--ink); cursor: default; border-color: var(--line); }
.btn-soon:hover { background: #fff; border-color: var(--line); transform: none; }
.btn-soon em { font-style: normal; font-weight: 600; font-size: 12.5px; color: var(--sky-text); }

.tldr {
  margin: 30px auto 0; max-width: 780px; text-align: left; padding: 16px 20px; border-radius: var(--radius);
  background: var(--sky-bg2); border: 1px solid var(--line); border-left: 4px solid var(--sky); font-size: 16.5px;
}
.tldr strong { margin-right: 6px; color: var(--sky-text); }

/* ===== Sections ===== */
.section { padding: 56px 0; }
.section.alt { background: var(--sky-bg2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#overview { padding-top: 8px; }
.kicker { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sky-text); }
.section-title { margin: 0 0 14px; font-size: clamp(25px, 3.2vw, 32px); font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.sub-title { margin: 40px 0 8px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.lead { color: var(--ink); }
.tag { display: inline-block; padding: 0 .45em; border-radius: 6px; font-weight: 600; font-size: .92em; line-height: 1.5; background: var(--sky-bg); color: var(--sky-text); }

/* ===== Figures ===== */
.figure { margin: 26px 0; }
.figure img { width: 100%; border-radius: 10px; background: #fff; }
.section.alt .figure img { box-shadow: var(--shadow); padding: 10px; }
.figure figcaption { margin: 12px auto 0; max-width: 880px; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.figure figcaption strong { color: var(--ink); }
.zoomable { cursor: zoom-in; }
.fig-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; }
.fig-grid .figure { margin: 10px 0 0; }
.fig-grid .figure img { border: 1px solid var(--line); padding: 10px; }

/* ===== Stats & findings ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 10px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: center; background: #fff; }
.stat .num { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--sky-text); }
.stat .lbl { display: block; margin-top: 6px; font-size: 13.5px; line-height: 1.35; color: var(--ink); }

.findings { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.findings li { padding: 14px 16px; border-radius: 12px; background: var(--sky-bg2); border: 1px solid var(--line); font-size: 15px; line-height: 1.55; }
.findings li strong { display: block; font-size: 15.5px; margin-bottom: 2px; }

.abstract-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.abstract-box summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.abstract-box summary::-webkit-details-marker { display: none; }
.abstract-box summary::before { content: "+"; font-weight: 700; width: 14px; text-align: center; color: var(--sky-text); }
.abstract-box[open] summary::before { content: "−"; }
.abstract-box summary:hover { color: var(--sky-text); }
.abstract-box p { margin: 0; padding: 0 18px 16px; font-size: 15px; line-height: 1.65; }

/* ===== Task grid ===== */
.figure.stream { margin-top: 18px; }
.figure.stream img { padding: 10px; }
.qdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); margin: 0 2px 0 4px; vertical-align: 0; }
.open-full { margin-left: 6px; font-weight: 600; }
.taskgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 6px; }
.tcard { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--sky); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tcard.span3 { grid-column: span 3; }
.tcard.span2 { grid-column: span 2; }
.tcard header { margin-bottom: 10px; }
.tcard h3 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.tcard .tstep { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--sky-text); }
.tcard img { width: 100%; border-radius: 8px; border: 1px solid var(--line); }
/* QA crops: one common scale so every card shows the same text size.
   The scale is set by the narrowest card (R3/Self/Requested, 636 px wide at source). */
.taskgrid { container-type: inline-size; }
.tcard img.qa {
  width: 100%;
  width: calc(var(--nw) * ((100cqw - 80px) / 3 - 18px) / 636);
  max-width: 100%; margin: 0 auto;
}
.tcard p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.5; }
.tcard p.when { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--sky-bg2); border: 1px solid var(--line); }
.when-k { display: inline-flex; align-items: center; margin-right: 8px; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap; }
.when-k .qdot { margin: 0 0 0 5px; box-shadow: 0 0 0 1.5px #fff; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding-left: 42px; font-size: 15.5px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 13.5px; display: grid; place-items: center;
}

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
table.results { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.results th, table.results td { padding: 9px 12px; text-align: center; white-space: nowrap; }
table.results .left { text-align: left; }
table.results thead th { font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); background: var(--sky-bg2); vertical-align: bottom; }
table.results thead th small { display: block; font-weight: 500; font-size: 11.5px; }
table.results thead th.grp { color: var(--sky-text); font-weight: 700; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
table.results tbody tr { border-bottom: 1px solid #e8f4fc; }
table.results tbody tr:last-child { border-bottom: none; }
table.results tbody tr:hover td { background: var(--sky-bg2); }
table.results tr.group td { text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--sky-text); background: #f5fbff !important; padding-top: 7px; padding-bottom: 7px; }
table.results tr.ref td { font-style: italic; }
table.results td.b1 { font-weight: 800; }
table.results td.b2 { text-decoration: underline; text-underline-offset: 3px; }
table.results td.bo { background: var(--sky-bg); }
table.results tr:hover td.bo { background: #cdeafd; }
table.results tr.hl td { background: var(--sky-bg); }
table.results tr.hl:hover td { background: #cdeafd; }
table.results .d { display: inline-block; margin-left: 5px; font-size: 11.5px; font-weight: 700; }
table.results .d.up { color: var(--sky-text); }
table.results .d.dn { color: var(--ink); }
.pill { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; font-style: normal; vertical-align: 1px; }
table.compact td, table.compact th { padding: 9px 14px; }
.table-note { margin: 12px 4px 0; font-size: 13.8px; line-height: 1.55; }
.bo-key { background: var(--sky-bg); padding: 0 5px; border-radius: 4px; }

/* ===== Analysis ===== */
.analysis { display: grid; gap: 10px; margin-top: 22px; }
.analysis p { margin: 0; display: flex; align-items: baseline; gap: 12px; font-size: 16px; }
.badge { flex: none; display: inline-block; min-width: 86px; text-align: center; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--ink); }

/* ===== BibTeX ===== */
.bibtex { position: relative; margin-top: 12px; }
.bibtex pre {
  margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: var(--radius);
  background: #0b0b0c; color: #e6f4ff; font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; border-left: 4px solid var(--sky);
}
.bibtex pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.copy {
  position: absolute; top: 10px; right: 10px; z-index: 1; font: 600 12.5px var(--sans); color: #fff;
  background: var(--sky-strong); border: none; border-radius: 8px; padding: 5px 11px; cursor: pointer;
}
.copy:hover { background: var(--sky); }

/* ===== Footer ===== */
.footer { padding: 34px 0 46px; border-top: 1px solid var(--line); text-align: center; font-size: 14px; }
.footer p { margin: 2px 0; }
.footer .muted { font-size: 13px; }

/* ===== Lightbox ===== */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(3, 18, 30, .9); display: flex; align-items: center; justify-content: center; padding: 28px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.lb-close { position: absolute; top: 14px; right: 18px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .14); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.lb-close:hover { background: var(--sky-strong); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .fig-grid { grid-template-columns: 1fr; }
  .taskgrid { grid-template-columns: 1fr 1fr; }
  .tcard.span3 { grid-column: span 2; }
  .tcard.span2 { grid-column: span 1; }
  .tcard img.qa { width: calc(var(--nw) * ((100cqw - 16px) / 2 - 34px) / 636); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 18px; }
  .topnav-inner { padding: 0 14px; }
  .brand { display: none; }
  .hero { padding-top: 28px; }
  .authors { font-size: 15px; gap: 0 12px; }
  .affils { font-size: 17px; gap: 4px 18px; }
  .logos { gap: 12px 24px; }
  .logos .logo-meta { height: 21px; }
  .logos .logo-kaist { height: 26px; transform: translateY(5px); }
  .logos .logo-postech { height: 14px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .findings { grid-template-columns: 1fr; }
  .taskgrid { grid-template-columns: 1fr; }
  .tcard.span3, .tcard.span2 { grid-column: auto; }
  .tcard img.qa { width: calc(var(--nw) * (100cqw - 34px) / 978); }
  .analysis p { flex-direction: column; gap: 4px; }
  .section { padding: 42px 0; }
  .section.alt .figure img, .fig-grid .figure img, .figure.stream img { padding: 4px; }
  table.results { font-size: 14px; }
  table.results th, table.results td { padding: 8px 9px; }
  table.results .left { position: sticky; left: 0; background: #fff; z-index: 1; }
  table.results thead .left { background: var(--sky-bg2); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ===== Data construction stages ===== */
.stages { list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stages li { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--sky); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stages .stage-n { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--sky-text); }
.stages h3 { margin: 0 0 4px; font-size: 16.5px; font-weight: 700; }
.stages p { margin: 0; font-size: 14.5px; line-height: 1.5; }
#data .figure img { border: 1px solid var(--line); padding: 10px; }
@media (max-width: 760px) { .stages { grid-template-columns: 1fr; } }
