/* CM² · HiCM²: Memory-Augmented Dense Video Captioning (series page)
   Same family as the ReQuest and TimeTraveler pages.
   Palette: Kyung Hee's two official colors, Kyung Hee Red (#A40F16) and Kyung Hee Blue (#0D326F). */

:root {
  --paper: #fafaf7;
  --card: #ffffff;
  --ink: #16233d;
  --soft: #4b586c;
  --faint: #8590a0;
  --line: #e2e1da;
  --wash: #f2f1ec;

  --khu: #a40f16;          /* Kyung Hee Red */
  --khublue: #0d326f;      /* Kyung Hee Blue */
  --red-tint: #f8ebeb;
  --blue-tint: #e9eef7;

  --duo: linear-gradient(90deg, var(--khu) 0%, var(--khublue) 100%);
  --radius: 10px;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  font-size: 16.5px; line-height: 1.65; -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4 { font-family: "Spectral", Georgia, serif; font-weight: 600; line-height: 1.15; margin: 0; }
a { color: inherit; }
.wrap { max-width: 1000px; margin: 0 auto; padding-left: 22px; padding-right: 22px; }
.duo-text { background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(250, 250, 247, .93); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.nav::before { content: ""; display: block; height: 3px; background: var(--duo); }
.nav-inner { display: flex; align-items: center; gap: 20px; height: 54px; }
.wordmark { font-family: "Spectral", Georgia, serif; font-weight: 700; font-size: 20px; text-decoration: none; white-space: nowrap; padding-top: .18em; line-height: 1.2; }
.nav-links { margin-left: auto; display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--soft); text-decoration: none; white-space: nowrap; padding: 4px 0; }
.nav-links a:hover { color: var(--ink); }

/* hero */
.hero { padding-top: 56px; padding-bottom: 18px; text-align: center; }
.venue { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); border-radius: 999px; padding: 3px 14px; font-size: 13.5px; font-weight: 500; }
.venue-row { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.venue-logos { display: inline-flex; align-items: center; gap: 12px; }
.venue-logo { height: 42px; width: auto; display: block; }
.venue-chip { display: inline-flex; align-items: center; background: #1a407f; border-radius: 8px; padding: 7px 12px; }
.venue-chip img { height: 34px; width: auto; display: block; }
.hero h1 { margin: 20px auto 6px; max-width: 880px; }
.hero h1 .name { display: block; font-size: clamp(40px, 6.2vw, 64px); font-weight: 700; line-height: 1.1; padding-top: .16em; margin-top: -.16em; padding-bottom: 4px; }
.hero h1 .title { display: block; margin-top: 10px; font-size: clamp(22px, 3.1vw, 32px); font-weight: 600; line-height: 1.22; }
.hero .subline { margin: 16px auto 0; max-width: 680px; color: var(--soft); font-size: 17px; }

.authors { margin-top: 28px; font-size: 17px; }
.authors .row { max-width: 820px; margin: 0 auto; }
.authors a { text-decoration: none; border-bottom: 1px solid var(--line); }
.authors a:hover { border-bottom-color: var(--ink); }
sup { font-size: 11px; color: var(--soft); }
sup.k { color: var(--khu); font-weight: 600; }
sup.e { color: var(--soft); font-weight: 600; }
.affils { margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; font-size: 14.5px; color: var(--soft); }
.inst { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); padding: 4px 14px 4px 6px; }
.inst .dot { width: 18px; height: 18px; border-radius: 999px; flex: none; }
.inst.khu .dot { background: var(--khu); box-shadow: inset 0 0 0 3px var(--khublue); }
.inst.etri .dot { background: #c9d0db; box-shadow: inset 0 0 0 3px #6b7a91; }
.marks { margin-top: 8px; font-size: 13px; color: var(--faint); }

/* sections */
section { padding-top: 46px; padding-bottom: 6px; scroll-margin-top: 72px; }
section h2, .h2 { font-size: 29px; margin-bottom: 18px; text-align: center; }
section h2::after, .h2::after { content: ""; display: block; width: 44px; height: 3px; margin: 12px auto 0; border-radius: 2px; background: var(--duo); }
h3.sub-title { font-size: 21px; max-width: 940px; margin: 34px auto 6px; text-align: center; }
p.sub-lead { max-width: 680px; margin: 0 auto 6px; text-align: center; color: var(--soft); font-size: 15.5px; }
.prose { max-width: 720px; margin: 0 auto; }
.prose p { margin: 0 0 16px; }
.prose b { font-weight: 600; }

figure { margin: 24px auto; max-width: 940px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
figure img { display: block; width: 100%; border-radius: 6px; }
figcaption { padding: 10px 6px 4px; font-size: 14px; color: var(--soft); line-height: 1.55; }
figcaption b { color: var(--ink); font-weight: 600; }
.fig-pair { max-width: 940px; margin: 24px auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fig-pair figure { margin: 0; display: flex; flex-direction: column; }
.fig-pair figure img { flex: 1; object-fit: contain; background: #fff; }

/* the series: flat memory -> hierarchy */
.series { max-width: 940px; margin: 8px auto 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.series .arrow { align-self: center; font-size: 22px; color: var(--faint); }
.scard {
  display: block; text-decoration: none; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 16px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color .3s ease, transform .4s var(--ease), box-shadow .3s ease;
}
.scard:hover { border-color: #cfd3dc; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(22, 35, 61, .06); }
.scard .kick { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.scard h3 { margin-top: 2px; font-size: 28px; font-weight: 700; }
.scard h3 small { font-family: "Public Sans", sans-serif; font-size: 15px; font-weight: 500; color: var(--soft); margin-left: 6px; }
.scard p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--soft); }
.scard .viz { margin-top: 14px; }
.scard .go { margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.scard .go::after { content: " ↓"; display: inline-block; transition: transform .3s var(--ease); }
.scard:hover .go::after { transform: translateY(3px); }

/* flat memory dots */
.dots { display: grid; grid-template-columns: repeat(24, 1fr); gap: 4px; }
.dots i { aspect-ratio: 1; border-radius: 999px; background: #d4d9e2; }
.dots i.hit { background: var(--khublue); }
.viz-note { margin-top: 8px; font-size: 12.5px; color: var(--faint); }

/* hierarchy bars */
.pyr { display: grid; gap: 5px; }
.pyr .lv { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; font-size: 12.5px; color: var(--soft); }
.pyr .bar { height: 14px; border-radius: 3px; background: var(--khu); opacity: .9; display: flex; align-items: center; justify-content: flex-end; }
.pyr .bar span { font-size: 11px; color: #fff; padding-right: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pyr .lv.src .bar { background: #d4d9e2; }
.pyr .lv.src .bar span { color: var(--soft); }

/* chapters: one continuous page, each paper opens like a chapter */
.chapter { scroll-margin-top: 58px; }
.paper-head { text-align: center; padding-top: 84px; position: relative; }
.paper-head::before {
  content: ""; position: absolute; left: 50%; top: 30px; width: min(940px, calc(100% - 44px)); height: 1px;
  transform: translateX(-50%); background: var(--line);
}
.ch-num {
  font-family: "Spectral", Georgia, serif; font-weight: 500; font-size: 96px; line-height: .9; letter-spacing: .02em;
  background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: .9;
}
.ch-kick { margin-top: 16px; font-size: 12.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.ch-name { margin-top: 10px; font-family: "Spectral", Georgia, serif; font-size: 40px; font-weight: 700; line-height: 1.1; }
.paper-head .ptitle { margin: 10px auto 0; font-size: clamp(21px, 2.6vw, 26px); font-weight: 500; max-width: 760px; line-height: 1.3; color: var(--soft); }
.paper-head .ptitle::after { display: none; }

/* reading progress: the top stripe fills as you scroll */
.nav::before { display: none; }
.progress { height: 3px; background: #e7e5de; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--duo); transform-origin: 0 50%; transform: scaleX(0); }

/* nav: the chapter you are reading is underlined */
.nav-links a { position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; background: var(--khu); transform: scaleX(0); transition: transform .35s var(--ease); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after { transform: scaleX(1); }

/* buttons */
.btn-row { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border: 1.5px solid var(--ink); border-radius: 999px; padding: 9px 20px; font-size: 15px; font-weight: 500; text-decoration: none; }
.btn:hover { background: #22345a; border-color: #22345a; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #eceae3; }

/* headline numbers */
.headline { max-width: 940px; margin: 22px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hl { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.hl .bench { font-size: 13px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .05em; }
.hl .line { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.hl .bk { font-size: 14px; color: var(--soft); flex: 1; min-width: 150px; }
.hl .from { font-size: 15px; color: var(--faint); font-variant-numeric: tabular-nums; }
.hl .to { font-family: "Spectral", Georgia, serif; font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl .gain { font-size: 14px; font-weight: 600; color: var(--khu); font-variant-numeric: tabular-nums; }

/* demo */
.explorer { max-width: 940px; margin: 24px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; align-items: center; }
.seg-tabs .lbl { font-size: 13.5px; color: var(--soft); margin-right: 4px; }
.stab { border: 1.5px solid var(--line); border-radius: 999px; background: transparent; padding: 6px 16px; font-size: 14.5px; font-weight: 500; color: var(--soft); cursor: pointer; font-family: inherit; }
.stab:hover { border-color: var(--ink); color: var(--ink); }
.stab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.strip .fr { position: relative; }
.strip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 4px; transition: opacity .35s ease, filter .35s ease, outline-color .35s ease; outline: 2.5px solid transparent; outline-offset: 1px; }
.strip .fr.off img { opacity: .35; filter: grayscale(.8); }
.strip .fr.on img { outline-color: var(--khu); }
.strip-note { margin-top: 6px; font-size: 12.5px; color: var(--faint); text-align: right; }

.recall { margin-top: 16px; display: grid; gap: 8px; justify-items: center; }
.recall .rk { justify-self: start; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.mem {
  width: 100%; display: grid; grid-template-columns: 74px 1fr; gap: 12px; align-items: center;
  background: var(--red-tint); border: 1px solid #efd4d5; border-radius: 8px; padding: 10px 14px;
  opacity: 0; transform: translateY(4px); animation: memIn .45s var(--ease) forwards;
}
.mem .lvl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--khu); }
.mem .txt { font-family: "Spectral", Georgia, serif; font-size: 17px; line-height: 1.4; }
.mem.flat { background: var(--blue-tint); border-color: #d3dceb; }
.mem.flat .lvl { color: var(--khublue); }
.recall.hier .mem:nth-of-type(2) { width: 74%; animation-delay: .05s; }
.recall.hier .mem:nth-of-type(3) { width: 87%; animation-delay: .25s; }
.recall.hier .mem:nth-of-type(4) { width: 100%; animation-delay: .45s; }
@keyframes memIn { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .mem { animation: none; opacity: 1; transform: none; } }

.outcome { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.oc { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.oc .ok { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.oc .ot { font-size: 15.5px; margin-top: 2px; }
.oc.ours { border-color: var(--ink); }
.oc.ours .ok { color: var(--ink); }
.demo-note { margin-top: 12px; font-size: 13px; color: var(--faint); }

/* tables */
.tbl-head { max-width: 960px; margin: 34px auto 0; padding: 0 2px; }
.tbl-head h3 { font-size: 21px; }
.tables-wrap { max-width: 960px; margin: 12px auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; overflow-x: auto; }
table.res { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 560px; }
.res th, .res td { padding: 6px 9px; text-align: right; white-space: nowrap; }
.res th:first-child, .res td:first-child { text-align: left; }
.res td.c, .res th.c { text-align: center; }
.res thead th { font-weight: 600; font-size: 13px; color: var(--soft); border-bottom: 2px solid var(--ink); vertical-align: bottom; }
.res thead th.grp { text-align: center; border-bottom: 1px solid var(--line); color: var(--ink); }
.res tbody td { border-bottom: 1px solid #ecebe4; }
.res tbody tr:last-child td { border-bottom: none; }
.res tr.ours td { background: var(--blue-tint); }
.res tr.ours td:first-child { font-weight: 600; }
.res tr.sep td { border-top: 1.5px solid var(--line); }
.res b { font-weight: 700; }
.res u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.res .ck { color: var(--ink); }
.res .x { color: var(--faint); }
.tbl-note { max-width: 960px; margin: 8px auto 0; font-size: 13px; color: var(--faint); padding: 0 2px; }

/* analysis cards */
.cards { max-width: 960px; margin: 20px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; min-width: 0; }
.card h4 { margin: 0 0 4px; font-size: 19.5px; }
.card .take { margin: 0 0 10px; font-size: 14.5px; color: var(--soft); line-height: 1.5; }
.card .take b { color: var(--ink); font-weight: 600; }
.card .scroll { overflow-x: auto; }
table.mini { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.mini th, .mini td { padding: 5px 5px; text-align: right; white-space: nowrap; }
.mini th:first-child, .mini td:first-child { text-align: left; padding-left: 2px; }
.mini td.c, .mini th.c { text-align: center; }
.mini thead th { font-size: 12px; font-weight: 600; color: var(--soft); border-bottom: 1.5px solid var(--ink); }
.mini tbody td { border-bottom: 1px solid #ecebe4; }
.mini tbody tr:last-child td { border-bottom: none; }
.mini tr.ours td { background: var(--blue-tint); font-weight: 600; }
.mini tr.base td { color: var(--soft); }
.card .src { margin-top: 8px; font-size: 12px; color: var(--faint); }

/* headroom bars */
.hbars { display: grid; gap: 8px; margin-top: 4px; }
.hb { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.hb .nm { color: var(--soft); }
.hb .track { position: relative; height: 18px; }
.hb .fill { height: 100%; border-radius: 0 4px 4px 0; background: #c3cbd8; }
.hb.ours .fill { background: var(--khublue); }
.hb.oracle .fill { background: repeating-linear-gradient(135deg, #e3c6c8 0 5px, #f3e3e4 5px 10px); }
.hb .val { position: absolute; top: 50%; transform: translate(6px, -50%); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

/* bibtex */
.bibs { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.bib { position: relative; background: #f1f0ea; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.bib .bk { font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.bib pre { margin: 0; overflow-x: auto; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.copy-btn { position: absolute; top: 12px; right: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--soft); cursor: pointer; font-family: inherit; }
.copy-btn:hover { color: var(--ink); border-color: var(--ink); }

/* footer */
footer { margin-top: 70px; border-top: 1px solid var(--line); padding: 0 0 44px; font-size: 14px; color: var(--soft); text-align: center; }
footer::before { content: ""; display: block; height: 3px; background: var(--duo); margin-bottom: 26px; }
footer a { color: var(--soft); }
footer a:hover { color: var(--ink); }
footer .insts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-bottom: 14px; }

/* responsive */
@media (max-width: 820px) {
  .series { grid-template-columns: 1fr; }
  .series .arrow { transform: rotate(90deg); justify-self: center; }
  .cards, .headline, .fig-pair { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { padding-top: 40px; }
  section h2 { font-size: 25px; }
  .ch-num { font-size: 72px; }
  .ch-name { font-size: 32px; }
  .paper-head { padding-top: 64px; }
  .explorer { padding: 16px; }
  .strip { grid-template-columns: repeat(4, 1fr); }
  .outcome { grid-template-columns: 1fr; }
  .mem { grid-template-columns: 1fr; gap: 2px; }
  .recall.hier .mem:nth-of-type(n) { width: 100%; }
  .hb { grid-template-columns: 110px 1fr; }
  .inst.etri .long { display: none; }
  .dots { grid-template-columns: repeat(18, 1fr); }
}

/* next chapter: a quiet hand-off at the end of Chapter I */
.next-ch {
  display: block; position: relative; max-width: 940px; margin: 56px auto 0; padding: 30px 32px;
  text-align: center; text-decoration: none; color: var(--ink);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  transition: background-color .4s ease;
}
.next-ch:hover { background: #f3f2ed; }
.nc-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--khu); }
.nc-title { display: block; margin-top: 8px; font-family: "Spectral", Georgia, serif; font-size: 34px; font-weight: 600; line-height: 1.15; }
.nc-num { background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; margin-right: 8px; font-weight: 500; }
.nc-sub { display: block; margin-top: 6px; font-size: 15px; color: var(--soft); }
.nc-go { display: block; margin-top: 10px; font-size: 20px; color: var(--faint); transition: transform .4s var(--ease), color .3s ease; }
.next-ch:hover .nc-go { transform: translateY(4px); color: var(--khu); }

/* side table of contents: wide screens only */
.toc {
  position: fixed; top: 120px; left: max(24px, calc(50% - 500px - 196px)); width: 160px; z-index: 5;
  display: none; flex-direction: column; gap: 14px; font-size: 13px;
  opacity: 0; transform: translateX(-6px); transition: opacity .4s ease, transform .4s var(--ease); pointer-events: none;
}
.toc.show { opacity: 1; transform: none; pointer-events: auto; }
.toc a { display: block; color: var(--faint); text-decoration: none; line-height: 1.35; transition: color .25s ease; }
.toc a:hover { color: var(--ink); }
.toc-top { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.toc-ch { display: flex; flex-direction: column; gap: 6px; padding-left: 14px; border-left: 1px solid var(--line); position: relative; }
.toc-ch > a:not(.toc-chap) { padding-left: 2px; position: relative; }
.toc-chap { font-family: "Spectral", Georgia, serif; font-size: 18px; font-weight: 600; color: var(--soft) !important; margin-bottom: 2px; }
.toc-chap .tn { font-weight: 500; margin-right: 8px; color: var(--faint); }
.toc-chap.in { color: var(--ink) !important; }
.toc-chap.in .tn { background: var(--duo); -webkit-background-clip: text; background-clip: text; color: transparent; }
.toc a.active:not(.toc-chap) { color: var(--ink); font-weight: 600; }
.toc-ch > a.active:not(.toc-chap)::before { content: ""; position: absolute; left: -16px; top: 2px; bottom: 2px; width: 2px; background: var(--khu); border-radius: 2px; }
.toc-top.active { color: var(--ink); }
@media (min-width: 1380px) { .toc { display: flex; } }
