/* Research paper page — overrides on top of site /style.css.
   Inherit body width/padding from parent (consistency with home page).
   Only add paper-specific structure (header link, paper-header, figures, etc). */

/* --- Header: back-link to home --- */
.brand a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.brand a:hover { color: var(--accent); }
.brand a:hover .brand-dot { background: var(--accent-hover); }
.brand a:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 2px; }

/* --- Paper header (title block) --- */
.paper-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
  display: block;
}
.kicker {
  font-size: 0.6875rem;
  font-weight: 590;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  margin-bottom: 1rem;
}
.paper-header h1 {
  font-size: clamp(1.875rem, 1.25rem + 2.5vw, 2.75rem);
  font-weight: 590;
  line-height: 1.1;
  letter-spacing: -0.022em;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
.authors {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  letter-spacing: -0.005em;
  line-height: 1.5;
}
.venue {
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: 0.005em;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
  margin-bottom: 1.5rem;
}

/* Fair-dealing / license notice */
.license-notice {
  font-size: 0.8125rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--rule) 30%, transparent);
  border-left: 2px solid var(--accent);
  padding: 0.875rem 1rem;
  border-radius: 4px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  margin-top: 1rem;
}

/* --- Language toggle (pill switch, iOS-style segmented control) --- */
.lang-toggle {
  display: inline-flex;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  font-weight: 590;
  line-height: 1;
  vertical-align: middle;
}
.lang-opt {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  text-decoration: none !important;
  color: var(--muted) !important;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
  white-space: nowrap;
}
.lang-opt:hover { color: var(--text) !important; }

/* Default: Korean active */
.lang-ko-opt {
  background: var(--bg);
  color: var(--text) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 80%, transparent), 0 1px 2px rgba(0,0,0,0.04);
  pointer-events: none;
}

/* When URL has #en, swap */
body:has(#en:target) .lang-ko-opt {
  background: transparent;
  color: var(--muted) !important;
  box-shadow: none;
  pointer-events: auto;
}
body:has(#en:target) .lang-en-opt {
  background: var(--bg);
  color: var(--text) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 80%, transparent), 0 1px 2px rgba(0,0,0,0.04);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .lang-toggle { background: color-mix(in srgb, var(--text) 5%, transparent); }
  .lang-ko-opt,
  body:has(#en:target) .lang-en-opt {
    background: color-mix(in srgb, var(--text) 14%, var(--bg));
    box-shadow: 0 0 0 1px var(--rule);
  }
}

/* Header layout: brand on left, toggle + research on right */
.header-right {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}
.header-link {
  font-size: 0.8125rem;
  letter-spacing: -0.005em;
}

/* --- Language section visibility toggle --- */
#en { display: none; }     /* hide English by default */
#ko { display: block; }    /* show Korean by default */

/* When #en is targeted (URL has #en), swap */
body:has(#en:target) #en { display: block; }
body:has(#en:target) #ko { display: none; }
/* #ko targeted: explicit (default Korean already visible) */
body:has(#ko:target) #en { display: none; }
body:has(#ko:target) #ko { display: block; }

/* Hide the lang-marker inside KO/EN sections — switcher is now in header */
.lang-marker { display: none; }

/* --- Per-language section header (lang-marker) --- */
.lang-marker {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 590;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  margin-bottom: 2.5rem;
  scroll-margin-top: 2rem;
}

/* --- Paper sections (Abstract, 1 Introduction, etc) --- */
.paper-section { margin-bottom: 2.5rem; }
.paper-section h3 {
  font-size: 1.0625rem;
  font-weight: 590;
  letter-spacing: -0.011em;
  margin-bottom: 0.875rem;
  color: var(--text);
}
.paper-section h4 {
  font-size: 0.9375rem;
  font-weight: 590;
  letter-spacing: -0.008em;
  margin: 1.5rem 0 0.625rem;
  color: var(--text);
}
.paper-section h5 {
  font-size: 0.875rem;
  font-weight: 590;
  letter-spacing: -0.005em;
  margin: 1rem 0 0.5rem;
  color: var(--muted);
}
.paper-section p {
  font-size: 1rem;
  line-height: 1.62;
  margin-bottom: 0.875rem;
  letter-spacing: -0.008em;
}
.paper-section p:last-child { margin-bottom: 0; }

@media (prefers-color-scheme: dark) {
  .paper-section p {
    font-weight: 470;
    letter-spacing: 0;
    line-height: 1.7;
  }
}

/* --- Annotation notes (aside) — soft callout with side accent --- */
.note {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 0.75rem 0 1rem;
  letter-spacing: -0.003em;
}
.note p { margin-bottom: 0.5rem; }
.note p:last-child { margin-bottom: 0; }
.note .note-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 590;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-text);
  margin-bottom: 0.375rem;
}

/* --- Math/inline code styling --- */
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
  background: color-mix(in srgb, var(--rule) 35%, transparent);
  padding: 0.05em 0.32em;
  border-radius: 3px;
  letter-spacing: 0;
}
.math-block {
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--rule) 35%, transparent);
  padding: 0.875rem 1rem;
  border-radius: 4px;
  margin: 0.75rem 0;
  overflow-x: auto;
  letter-spacing: 0;
  line-height: 1.4;
}

/* --- Citation markers (superscript bracketed refs) --- */
.cite {
  font-size: 0.7em;
  vertical-align: super;
  color: var(--muted);
  letter-spacing: 0;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
  margin-left: 0.05em;
}

/* --- Figures: each PNG image is a transparent diagram with dark text,
   so we wrap it in a forced-white card via the img element. Use a span
   wrapper (.fig-card) since background on <img> alone is unreliable
   when the PNG has alpha channel (dark text becomes invisible in dark mode). */
.paper-figure {
  margin: 1.75rem 0 1.5rem;
  text-align: center;
}
.fig-card {
  display: inline-block;
  background: #ffffff;
  padding: 0.75rem;
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--rule);
  max-width: 100%;
  line-height: 0;  /* prevent inline whitespace gap below img */
}
.fig-card img {
  max-width: 100%;
  height: auto;
  display: block;
}
/* Multiple stacked imgs inside one card (Figure 4, 5 with top/bottom) */
.fig-card img + img { margin-top: 0.75rem; }

.paper-figure figcaption {
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: -0.003em;
  line-height: 1.55;
  margin-top: 0.75rem;
  text-align: left;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}
.paper-figure figcaption strong {
  font-weight: 590;
  color: var(--text);
}
/* Two-image side-by-side row (e.g. Figure 2: scaled dot-product + multi-head) */
.figure-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
}
.figure-row .figure-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
}
.figure-row .figure-cell-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 590;
  letter-spacing: 0.02em;
}

@media (prefers-color-scheme: dark) {
  .fig-card { box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 4px 12px rgba(0,0,0,0.3); }
}

/* --- TOC strip (mini list) --- */
.toc {
  font-size: 0.8125rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--rule) 20%, transparent);
  padding: 0.875rem 1rem;
  border-radius: 4px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
  letter-spacing: -0.003em;
}
.toc strong {
  display: block;
  font-size: 0.6875rem;
  font-weight: 590;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 0.375rem;
}
.toc a { margin-right: 0.875rem; white-space: nowrap; }

/* --- Print --- */
@media print {
  .lang-nav, .license-notice { display: none; }
  .note { border-left: 1px solid #888; background: none; color: #555; }
  .lang-divider { page-break-before: always; }
}
