/* Network Science Lab @ GNU
   Palette taken from the lab's own figures: ink lines, white paper,
   the GNU blue, and the red highlighted nodes. */
:root {
  color-scheme: light;
  --ink: #18202e;
  --muted: #5a6475;
  --paper: #ffffff;
  --wash: #f3f6f9;
  --rule: #d9e0e8;
  --gnu-blue: #2f87c8;
  --link: var(--ink);   /* links are black and underlined, as on the former Google Site */
  --node-red: #c8452f;

  /* EB Garamond for Latin text. It has no Hangul, so Korean uses 이롭게바탕체 (Iropke Batang,
     hosted in assets/fonts/), then 나눔명조 (Nanum Myeongjo) and the system Myeongjo/Batang. */
  --font: "EB Garamond", "Iropke Batang", "Nanum Myeongjo", "NanumMyeongjo", "나눔명조",
          "AppleMyungjo", "Batang", "바탕", "Noto Serif CJK KR", Georgia, serif;

  /* Sidebar: pure black (light mode) */
  --side-bg: #000000;
  --side-ink: #ffffff;
  --side-muted: #c4c4c4;
  --side-accent: #f08a72;
  --logo-ink: #000000;   /* home-page logo; gold while a pair of stubs joins */
  --logo-hi: #e0a800;
  --side-hover: #8cc2f0;   /* light blue for the lab name on hover */
  --side-rule: rgba(255, 255, 255, 0.18);   /* divider above the meeting links */
  --side-button: #3a3a3a;                   /* phone menu's close button */

  --sidebar: 15.5rem;
  --measure: 56rem;
}

/* Dark mode (chosen with the moon/sun button; light is the default).
   The page turns pure black (kind to OLED screens) and the sidebar turns bright. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4e6eb;
  --muted: #a3abb8;
  --paper: #000000;   /* pure black: OLED pixels switch off */
  --wash: #111111;
  --rule: #2c2c2c;
  --gnu-blue: #6cb2ea;
  --node-red: #f0846c;

  --side-bg: #f1f1ee;
  --side-ink: #1c1c1c;
  --side-muted: #5f5f5f;
  --side-accent: #c8452f;
  --side-hover: #1d6fb5;
  --logo-ink: #ffffff;
  --logo-hi: #f5d24e;
  --side-rule: rgba(0, 0, 0, 0.14);
  --side-button: #dedede;
}

/* 이롭게바탕체 Medium, cut down to the 2,350 common Hangul syllables (KS X 1001) plus every
   Korean character the site uses, as WOFF2. Used for Korean only; Latin stays EB Garamond. */
@font-face {
  font-family: "Iropke Batang";
  src: url("../fonts/iropke-batang-m.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+AC00-D7A3, U+3131-318E, U+1100-11FF;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Keeps an opening bracket attached to the Korean word after it. */
.nobr { white-space: nowrap; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.25rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  word-break: keep-all;          /* keeps Korean words intact at line breaks */
  overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--node-red); }
a:focus-visible { outline: 2px solid var(--gnu-blue); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip:focus { left: 0; z-index: 10; }

/* ---------- Frame ---------- */
.frame {
  background: linear-gradient(to right, var(--side-bg) var(--sidebar), var(--paper) var(--sidebar));
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem 1.5rem;
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex; flex-direction: column;
}

.menu-toggle, .menu-close, .menu-backdrop { display: none; }   /* phone-only controls */

/* Light/dark mode button: moon in light mode, sun in dark mode */
.theme-toggle {
  position: absolute; top: 0.6rem; right: 1rem; z-index: 25;   /* top-right corner, inside the empty strip above the content */
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  border: 1px solid var(--rule); border-radius: 50%;
  background: var(--paper); color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { color: var(--gnu-blue); border-color: currentColor; }
.theme-toggle:focus-visible { outline: 2px solid var(--gnu-blue); outline-offset: 2px; }
.theme-toggle .icon-sun, :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html:not(.js) .theme-toggle { display: none; }   /* needs JavaScript */
.brand { display: block; text-decoration: none; color: var(--side-ink); }
.brand:hover, .brand:focus-visible { color: var(--side-hover); }
.brand-name {
  display: block;
  font-size: 1.85rem;
  line-height: 1.2;
  font-weight: 400;
}

.sidebar nav ul { list-style: none; margin: 2rem 0 0; padding: 0; }
.sidebar nav { margin-bottom: 2rem; }
.sidebar nav li { margin: 0; }
.sidebar nav li.nav-divider { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--side-rule); }   /* meeting sites below */
.sidebar nav a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.9rem;
  border-left: 2px solid transparent;
  color: var(--side-ink);
  text-decoration: none;
  font-size: 1.15rem;
  line-height: 1.35;
}
.sidebar nav a:hover { color: var(--side-ink); border-left-color: var(--side-muted); }
.sidebar nav a:focus-visible { outline-color: var(--side-ink); }
.sidebar nav a[aria-current="page"] {
  border-left-color: var(--side-accent);
}

/* ---------- Page ---------- */
.page {
  padding: 3rem clamp(1.25rem, 5vw, 4rem) 2rem;
  max-width: calc(var(--measure) + 8rem);
}



.page h2 {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}
.page h2 a { color: inherit; text-decoration: none; }
.page h2 a:hover { color: var(--node-red); }

.page p, .page ul, .page ol { max-width: var(--measure); }
.page p { margin: 0 0 1rem; }

.page ul, .page ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.page li { margin: 0 0 0.5rem; }
.page li > p { margin: 0 0 0.35rem; }
.page li ul { margin: 0.35rem 0 0.25rem; padding-left: 1.2rem; }
.page li li { margin-bottom: 0.25rem; color: var(--muted); font-size: 0.92em; }  /* slightly smaller than the main item */
.page li li a { color: var(--link); }
.page ul ul { list-style: circle; }

/* ---------- Home ---------- */
.hero { margin-bottom: 2.5rem; }
/* Home-page logo: a vector drawing of the network that assembles itself (assets/js/logo-assembly.js),
   with the lab name below it as the original lettering. */
.logo-anim { width: 17rem; max-width: 70%; margin: 0 0 1.25rem; -webkit-tap-highlight-color: transparent; }
.logo-anim svg { display: block; width: 100%; height: auto; overflow: visible; }
.logo-anim line { stroke: var(--logo-ink); stroke-width: 2.14; stroke-linecap: round; }
.logo-anim circle { fill: var(--logo-ink); }
.logo-anim line.joining { stroke: var(--logo-hi); stroke-width: 3; }
.logo-text { display: block; width: 100%; height: auto; }
:root[data-theme="dark"] .logo-text { filter: invert(1); }
:root[data-theme="dark"] .logo-anim .dots { filter: none; }
/* With JavaScript on and motion allowed, keep the finished logo hidden until the animation starts,
   so it doesn't flash before assembling; it shows after 2 s regardless, in case the script fails. */
@media (prefers-reduced-motion: no-preference) {
  .js .logo-anim:not(.playing) svg, .js .logo-anim:not(.playing) .logo-text { opacity: 0; animation: logo-fallback 0s 2s forwards; }
}
@keyframes logo-fallback { to { opacity: 1; } }
:root[data-theme="dark"] .mosaic img { background: #ffffff; }   /* published plots stay on white */
.affiliation { font-size: 1.25rem; color: var(--muted); margin: 0; }
.funding {
  margin-top: 3.5rem;
  max-width: var(--measure);
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--gnu-blue);
  background: var(--wash);
  font-size: 1.12rem;
}
.funding p { margin: 0; }
.funding .prior { margin-top: 0.4rem; color: var(--muted); font-size: 1rem; }
.fonts-note { margin-top: 2.5rem; max-width: var(--measure); color: var(--muted); font-size: 0.95rem; }
.fonts-note p { margin: 0; }
.fonts-note p + p { margin-top: 0.35rem; }
.fonts-note sup { font-size: 0.7em; line-height: 0; }
.fonts-note a { color: inherit; }

.intro p { font-size: 1.25rem; }
[lang="ko"] p, [lang="ko"] li { line-height: 1.85; }
.intro[lang="ko"] p { font-size: 1.12rem; }
.intro + .intro { margin-top: 1.75rem; }

.figures { margin-top: 3rem; }
.figures-note { color: var(--muted); font-size: 1.1rem; }
.mosaic {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 1rem;
}
.mosaic a {
  display: flex; flex-direction: column;
  background: var(--paper);
  padding: 0.9rem;
  text-decoration: none;
  color: var(--muted);
}
.mosaic img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: contain;

  transition: transform 0.25s ease;
}
.mosaic a.wide { grid-column: span 2; }
.mosaic a.wide img { aspect-ratio: 8 / 3; }
.mosaic a:hover img { transform: scale(1.03); }

/* ---------- PI ---------- */
.portrait {
  display: block;
  width: 14rem;
  max-width: 100%;
  margin: 0 0 1.75rem;
  border: 1px solid var(--rule);
}
.contact p { margin: 0 0 0.2rem; }
.contact p:first-child { font-size: 1.6rem; margin-bottom: 0.6rem; }
.contact + ul { margin-top: 1.75rem; clear: none; }

/* ---------- Publications: newest paper has the highest number ----------
   The list uses <ol reversed>, so numbering counts down automatically
   when a paper is added at the top. */
.page-publications-html ol { list-style: decimal outside; padding-left: 3rem; }
.page-publications-html ol > li { padding-left: 0.4rem; margin-bottom: 1.1rem; }
.page-publications-html ol > li::marker {
  color: var(--muted);
  font-size: 1.05rem;
  font-variant-numeric: lining-nums tabular-nums;
}

/* ---------- Network literacy ---------- */
.cover { display: block; width: min(24rem, 100%); border: 1px solid var(--rule); margin-top: 1rem; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 1.05rem;
  color: var(--muted);
  max-width: var(--measure);
}
.site-footer p { margin: 0 0 0.25rem; }

/* ---------- Small screens ---------- */
@media (max-width: 52rem) {
  .frame { grid-template-columns: 1fr; background: var(--paper); }

  /* Slim top bar: menu button + lab name, staying at the top while scrolling */
  .sidebar {
    position: sticky; top: 0; z-index: 20;
    height: auto; overflow: visible;
    display: block;
    padding: 0.35rem 0.75rem;
    background: var(--paper);
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
  }
  .topbar { display: flex; align-items: center; gap: 0.35rem; }
  .menu-toggle, .menu-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.75rem; height: 2.75rem;          /* comfortable tap target */
    padding: 0; border: 0; border-radius: 4px;
    background: transparent; cursor: pointer;
  }
  .menu-toggle { color: var(--ink); }
  .theme-toggle { position: fixed; top: 0.6rem; right: 0.75rem; }   /* right end of the top bar */
  .topbar { padding-right: 2.75rem; }                                  /* lab name never runs under it */
  .js.menu-open .theme-toggle { visibility: hidden; }                  /* covered by the open menu */
  html:not(.js) .menu-toggle { display: none; }   /* without JavaScript the menu is already open */
  .menu-toggle:focus-visible { outline: 2px solid var(--gnu-blue); outline-offset: 1px; }
  .brand { color: var(--ink); min-width: 0; }
  .brand:hover, .brand:focus-visible { color: var(--gnu-blue); }
  .brand-name { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Without JavaScript the menu simply shows below the bar */
  .drawer { background: var(--side-bg); color: var(--side-ink); margin: 0.35rem -0.75rem -0.35rem; padding: 0.5rem 1.25rem 1rem; }
  .menu-close { display: none; }

  /* With JavaScript: dark menu that slides in from the left */
  .js .drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: min(19rem, 82vw);
    margin: 0; padding: 0.75rem 1.25rem 2rem;
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .js.menu-open .drawer { transform: none; visibility: visible; transition: transform 0.25s ease; }
  .js .menu-close { display: inline-flex; color: var(--side-ink); background: var(--side-button); }
  .js .menu-close:focus-visible { outline: 2px solid var(--side-ink); outline-offset: 1px; }
  .js .menu-backdrop {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  .js.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  .js.menu-open { overflow: hidden; }       /* page doesn't scroll behind the open menu */
  .sidebar nav ul { margin: 1rem 0 0; }
  .sidebar nav a { font-size: 1.2rem; padding: 0.55rem 0 0.55rem 0.9rem; }

  .page { padding-top: 2rem; }
  body { font-size: 1.15rem; }
  .intro p { font-size: 1.15rem; }
  .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mosaic a.wide { grid-column: auto; }
  .mosaic a.wide img { aspect-ratio: 4 / 3; }
  .portrait { width: 12rem; }
  .page-publications-html ol { padding-left: 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .menu-backdrop { transition: none !important; }
  .mosaic img { transition: none; }
  .mosaic a:hover img { transform: none; }
}

@media print {
  .sidebar, .skip { display: none; }
  .frame { display: block; }
}

/* Page titles are hidden visually (the pages open with their content, as on the
   former Google Site) but stay available to screen readers and search engines. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.page > .visually-hidden + h2 { margin-top: 0; }
