/* =========================================================
   Prof. Jong-Hyun Kim — NGNS Lab homepage
   Plain CSS, no build step. Sections alternate dark / light
   like the original Gamma design.
   ========================================================= */

:root {
  --font: "Instrument Sans", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --ink: #16171a;
  --ink-2: #4b4e56;
  --ink-3: #7a7d86;
  --line: #e2e3e7;
  --paper: #ffffff;
  --paper-2: #f5f5f6;

  --night: #0f1014;
  --night-2: #17181c;
  --on-night: #f3f3f4;
  --on-night-2: rgba(243, 243, 244, 0.74);
  --on-night-3: rgba(243, 243, 244, 0.5);
  --night-line: rgba(255, 255, 255, 0.14);

  --slate: #4e5055;
  --slate-card: #5a5c62;
  --slate-line: rgba(255, 255, 255, 0.16);

  --accent: #1f6feb;
  --accent-night: #7cb8ff;
  --ok: #1a7f4b;
  --ok-bg: #e5f4ec;

  --radius: 10px;
  --header-h: 64px;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[lang="ko"] { word-break: keep-all; overflow-wrap: anywhere; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--paper); color: var(--ink); padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--accent-night); outline-offset: 2px; }
.section-light :focus-visible, .section-white :focus-visible { outline-color: var(--accent); }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  color: var(--on-night);
  transition: background-color .25s ease, box-shadow .25s ease, backdrop-filter .25s ease;
}
.site-header.is-solid {
  background: rgba(15, 16, 20, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 1px 0 var(--night-line);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 24px; }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  text-decoration: none; font-size: .92rem; font-weight: 500;
  color: var(--on-night-2); padding: 8px 12px; border-radius: 8px;
  transition: color .15s ease, background-color .15s ease;
}
.site-nav a:hover { color: var(--on-night); background: rgba(255, 255, 255, .07); }
.site-nav a.is-active { color: var(--on-night); background: rgba(255, 255, 255, .1); }

.nav-toggle {
  display: none; width: 44px; height: 44px; margin-right: -10px;
  background: none; border: 0; padding: 0; cursor: pointer; color: inherit;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 920px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px var(--gutter) 16px;
    background: var(--night);
    box-shadow: 0 1px 0 var(--night-line), 0 16px 32px rgba(0, 0, 0, .35);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 8px; font-size: 1rem; border-radius: 0; border-bottom: 1px solid var(--night-line); }
  .site-nav a:last-child { border-bottom: 0; }
  .no-js .site-nav { position: static; display: flex; flex-direction: row; flex-wrap: wrap; background: none; box-shadow: none; }
  .no-js .nav-toggle { display: none; }
}

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px; border-radius: 8px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #e8e8ea; color: #111; border: 1px solid #e8e8ea; }
.btn-primary:hover { background: #fff; border-color: #fff; }
.btn-ghost { color: var(--on-night); border: 1px solid rgba(255, 255, 255, .5); background: rgba(0, 0, 0, .15); }
.btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }

/* ---------- Hero ----------
   Sized like the Gamma original: height follows the content (~509px on desktop),
   88px above the title, ~82px below the buttons, 1035px content column. */
.hero {
  position: relative;
  padding: 88px 0 82px;
  color: var(--on-night);
  background:
    linear-gradient(90deg, rgba(10, 11, 14, .76) 0%, rgba(10, 11, 14, .52) 55%, rgba(10, 11, 14, .32) 100%),
    linear-gradient(180deg, rgba(10, 11, 14, .3) 0%, rgba(10, 11, 14, 0) 35%, rgba(10, 11, 14, .55) 100%),
    url("../img/hero.jpg") center 45% / cover no-repeat,
    var(--night);
}
.hero-inner { max-width: calc(1035px + 2 * var(--gutter)); }
.hero h1 {
  width: fit-content; max-width: 100%;
  font-size: clamp(2.53rem, 4.85vw, 3.88rem); line-height: 1.25; letter-spacing: normal;
}
/* Gamma-style title: white on the left fading to soft gray on the right */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background: linear-gradient(90deg, #ffffff 0%, #f4f4f5 38%, #9b9ca1 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
  }
}
.hero-lead {
  margin-top: 30px;
  font-size: 18px; font-weight: 500; line-height: 1.6; color: var(--on-night);
}
.hero .btn-row { margin-top: 17px; gap: 8px; }
.hero .btn { min-height: 50px; padding: 0 18px; border: 0; font-size: 18px; line-height: 1.6; border-radius: 6.75px; }
.hero .btn-primary { background: #cfd0d8; color: #000; }
.hero .btn-primary:hover { background: #fff; }
.hero .btn-ghost { background: #141415; color: #d5d5d8; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); }
.hero .btn-ghost:hover { background: #1d1d20; color: #fff; box-shadow: inset 0 0 0 1px #fff; }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
@media (max-width: 700px) { .section { padding: 64px 0; } }

.section-title { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.025em; }
.section-lead { margin-top: 14px; max-width: 70ch; }
.sub-title { font-size: clamp(1.3rem, 2.4vw, 1.6rem); margin: 64px 0 20px; }

.section-light { background: var(--paper-2); color: var(--ink); }
.section-white { background: var(--paper); color: var(--ink); }
.section-gray  { background: var(--slate); color: var(--on-night); }

.section-image { position: relative; color: var(--on-night); background-color: var(--night); background-size: cover; background-position: center; }
.section-research {
  background-image:
    linear-gradient(180deg, rgba(14, 16, 20, .82) 0%, rgba(14, 16, 20, .92) 40%, rgba(14, 16, 20, .97) 100%),
    url("../img/research.jpg");
  background-size: cover; background-position: center top;
}
.section-activities {
  background-image:
    linear-gradient(180deg, rgba(14, 15, 18, .8) 0%, rgba(14, 15, 18, .88) 100%),
    url("../img/activities.jpg");
}
.section-image .section-lead { color: var(--on-night-2); }

/* ---------- Profile ---------- */
.profile-card {
  margin-top: 32px;
  display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 32px; align-items: center;
  padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
}
.profile-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.profile-body h3 { font-size: 1.45rem; margin-bottom: 12px; }
.profile-body p { color: var(--ink-2); }
@media (max-width: 760px) {
  .profile-card { grid-template-columns: 1fr; gap: 20px; padding: 16px; }
}

/* period + text rows (experience, activities) */
.timeline li {
  display: grid; grid-template-columns: 11.5rem 1fr; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.timeline li:first-child { border-top: 1px solid var(--line); }
.timeline .period { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.timeline li > span:last-child { color: var(--ink-2); }
.timeline-dark li { border-color: var(--night-line) !important; grid-template-columns: 9.5rem 1fr; }
.timeline-dark .period { color: var(--on-night); }
.timeline-dark li > span:last-child { color: var(--on-night-2); }
@media (max-width: 560px) {
  .timeline li, .timeline-dark li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Research ---------- */
.areas { margin-top: 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
/* number on the left; title and description stacked to its right (as in the Gamma original) */
.area {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-content: start;
  padding: 24px 22px; border-radius: 12px;
  background: rgba(255, 255, 255, .055); border: 1px solid var(--night-line);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
/* number and title share one size and sit on the same baseline */
.area-num {
  align-self: baseline;
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255, 255, 255, .14); font-weight: 600; font-size: 1.16rem; line-height: 1; position: relative; top: 3px;
}
.area h3 { grid-column: 2; align-self: baseline; margin: 0 0 10px; font-size: 1.16rem; }
.area p { grid-column: 2; color: var(--on-night-2); font-size: .95rem; }
@media (max-width: 960px) { .areas { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .areas { grid-template-columns: 1fr; } }

.projects li {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 0 14px 20px; position: relative;
}
.projects li::before {
  content: ""; position: absolute; left: 2px; top: 23px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--on-night-3);
}
.projects-ongoing li::before { background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .18); }
.project-title { font-weight: 500; }
.project-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; color: var(--on-night-3); }
.project-meta .period { font-variant-numeric: tabular-nums; color: var(--on-night-2); }

/* ---------- Tabs + entry lists (publications, patents) ---------- */
.tabs { margin-top: 32px; }
.tabs-bar {
  position: sticky; top: var(--header-h); z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between;
  padding: 12px 0; margin-bottom: 8px;
  background: inherit;
}
.section-white .tabs-bar { background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.section-light .tabs-bar { background: var(--paper-2); box-shadow: 0 1px 0 var(--line); }
.no-js .tabs-bar { position: static; }
.no-js .tablist { display: none; }

.tablist { display: flex; flex-wrap: wrap; gap: 6px; }
.tablist [role="tab"] {
  font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer;
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.tablist [role="tab"]:hover { border-color: #c9cbd1; color: var(--ink); }
.tablist [role="tab"][aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tablist .count {
  display: inline-block; min-width: 1.6em; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  font-size: .78rem; font-variant-numeric: tabular-nums; text-align: center;
  background: rgba(0, 0, 0, .07);
}
.tablist [aria-selected="true"] .count { background: rgba(255, 255, 255, .2); }
/* while searching, all matching categories are listed, so no tab is "current" */
.is-searching .tablist [role="tab"][aria-selected="true"] { background: var(--paper); border-color: var(--line); color: var(--ink-2); }
.is-searching .tablist [aria-selected="true"] .count { background: rgba(0, 0, 0, .07); }
.tablist .count:empty { display: none; }

.search input {
  font: inherit; font-size: .92rem; width: 280px; max-width: 100%; min-height: 40px;
  padding: 8px 14px 8px 36px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper) no-repeat 13px 50% / 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7d86' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 111, 235, .15); }
@media (max-width: 700px) {
  .tabs-bar { position: static; }
  .search, .search input { width: 100%; }
  /* one swipeable row of tabs instead of a tall stack */
  .tablist {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter);
  }
  .tablist::-webkit-scrollbar { display: none; }
  .tablist [role="tab"] { flex: none; white-space: nowrap; }
}

.panel-title { font-size: 1.3rem; margin: 28px 0 8px; }
.js .panel-title { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.js .tabs.is-searching .panel-title { position: static !important; width: auto; height: auto; clip: auto; overflow: visible; }

.entries li {
  position: relative;
  padding: 14px 0 14px 3.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2); font-size: .95rem; line-height: 1.6;
}
.entries.numbered li[data-n]::before {
  content: attr(data-n);
  position: absolute; left: 0; top: 14px; width: 2.6rem;
  text-align: right; font-variant-numeric: tabular-nums;
  font-size: .85rem; font-weight: 600; color: var(--ink-3);
}
.no-js .entries li, .entries li:not([data-n]) { padding-left: 0; }
.entries em { font-style: italic; color: var(--ink); }
.entries mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }

.badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: 1px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  color: var(--ok); background: var(--ok-bg);
}


.no-results { padding: 32px 0; color: var(--ink-3); text-align: center; }

.stats { margin-top: 32px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 20px 22px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
}
.stat-num { font-size: 2.2rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-num:empty::before { content: "—"; color: var(--ink-3); }
.stat-label { font-weight: 600; }
.stat-sub { font-size: .85rem; color: var(--ink-3); }
.no-js .stats { display: none; }
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 14px 16px; }
  .stat-num { font-size: 1.6rem; }
}

/* ---------- Activities & Awards ---------- */
.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; }
.two-col .section-title { margin-bottom: 28px; font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; gap: 64px; } }
@media (min-width: 901px) { .section-activities .awards-column { margin-left: 32px; } }

.awards li {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--night-line);
}
.awards li:first-child { border-top: 1px solid var(--night-line); }
.award-kind {
  grid-row: span 2; align-self: start; margin-top: 2px;
  padding: 2px 9px; border-radius: 6px; font-size: .76rem; font-weight: 600; white-space: nowrap;
  background: rgba(255, 255, 255, .12); color: var(--on-night);
}
.award-title { color: var(--on-night); font-weight: 500; }
.award-meta { color: var(--on-night-3); font-size: .88rem; }

/* ---------- Notices ---------- */
.cards-3 { margin-top: 36px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.notice {
  padding: 24px; border-radius: 12px; background: rgba(15, 16, 20, .32); border: 1px solid var(--slate-line);
}
.notice-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, .88); color: #2b2d31;
}
.notice-icon svg, .to-top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice h3 { margin: 18px 0 10px; font-size: 1.16rem; }
.notice p { color: var(--on-night-2); font-size: .95rem; }
@media (max-width: 860px) { .cards-3 { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.section-contact { padding-top: 24px; }
.contact-grid { margin-top: 36px; display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: start; }
.contact-cards { display: flex; flex-direction: column; gap: 14px; }
.contact-card {
  padding: 18px 22px; border-radius: 8px;
  background: rgba(15, 16, 20, .22); border: 1px solid var(--slate-line); border-left: 4px solid rgba(255, 255, 255, .7);
}
.contact-card h3 { font-size: 1.1rem; margin-bottom: 10px; }
.contact-card p { color: var(--on-night-2); font-size: .95rem; }
.contact-card strong { color: var(--on-night); font-weight: 600; }
.contact-card a { color: var(--on-night); text-decoration-color: rgba(255, 255, 255, .4); text-underline-offset: 3px; }
.contact-card a:hover { text-decoration-color: currentColor; }
.contact-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } .contact-photo { aspect-ratio: 16 / 10; } }

/* ---------- Footer ---------- */
.site-footer { background: #141416; color: var(--on-night); padding: 72px 0 48px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.footer-cols h3 { font-size: 1.05rem; margin-bottom: 10px; }
.footer-cols p { color: var(--on-night-2); font-size: .92rem; }
.footer-tagline {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--night-line);
  text-align: center; color: var(--on-night-2); font-size: .92rem;
}
@media (max-width: 760px) { .footer-cols { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(23, 24, 28, .88); color: #fff; border: 1px solid var(--night-line);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
