/* ───────────────────────────────────────────────────────────
   Seungmin Kim — personal site
   Editorial-minimal: white paper, black type, mono labels.
   ─────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  --paper: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #3f3f3f;
  --ink-faint: #666666;
  --line: #dcdcdc;
  --panel: #f7f7f7;
  --accent: #000000;

  --serif: "Pretendard", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Pretendard", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 42.5rem;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0c0c0c;
  --ink: #f5f5f5;
  --ink-soft: #c9c9c9;
  --ink-faint: #9a9a9a;
  --line: #2d2d2d;
  --panel: #171717;
  --accent: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: break-word;
  transition: background-color 0.18s ease, color 0.18s ease;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  padding: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.skip:focus {
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

/* ── header / nav ─────────────────────────────────────────── */

.site-head {
  padding-top: clamp(2.75rem, 7vh, 5rem);
}

.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1.45rem, 5vw, 2.6rem);
}

.nav a {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 0.25rem 0.1rem;
}

.nav a:hover {
  color: var(--accent);
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  margin-left: -0.45rem;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
}

.theme-icon {
  width: 0.98rem;
  height: 0.98rem;
  fill: currentColor;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

/* ── page shell ───────────────────────────────────────────── */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page > * {
  animation: rise 0.65s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.page > *:nth-child(2) { animation-delay: 0.06s; }
.page > *:nth-child(3) { animation-delay: 0.12s; }
.page > *:nth-child(4) { animation-delay: 0.18s; }
.page > *:nth-child(5) { animation-delay: 0.24s; }
.page > *:nth-child(6) { animation-delay: 0.3s; }
.page > *:nth-child(n + 7) { animation-delay: 0.36s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page > * {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ── home / hero ──────────────────────────────────────────── */

.hero {
  margin-top: clamp(3.75rem, 10vh, 6.5rem);
}

.hero-name {
  font-size: clamp(2.65rem, 5vw, 3rem);
  font-weight: 650;
  font-variation-settings: "opsz" 60;
  letter-spacing: -0.025em;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0;
}

.hero-sub {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 0.9rem 0 0;
}

.lede {
  font-style: italic;
  font-size: 1.18rem;
  font-variation-settings: "opsz" 20;
  line-height: 1.72;
  color: var(--ink-soft);
  margin: 2.1rem 0 0;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 2rem 0 0;
}

.contact-link {
  display: inline-grid;
  place-items: center;
  position: relative;
  width: 2.3rem;
  height: 2.3rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.contact-link svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.contact-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.contact-link::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--paper);
  background: var(--ink);
  border-radius: 2px;
  padding: 0.34rem 0.45rem;
  transition: opacity 0.15s ease;
}

.contact-link:hover::after,
.contact-link:focus-visible::after {
  opacity: 1;
}

/* ── cv sections ──────────────────────────────────────────── */

.cv-section {
  margin-top: 3.65rem;
  scroll-margin-top: 2rem;
}

.label {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 1.15rem;
  margin: 0;
}

.plain-list {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
}

.plain-list li {
  margin-top: 0.55rem;
  padding-left: 1.1rem;
  position: relative;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

.plain-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.entry {
  display: grid;
  grid-template-columns: 5.8rem minmax(0, 1fr);
  gap: 1.6rem;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.entry-period {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  padding-top: 0.4rem;
  white-space: nowrap;
}

.entry-body p {
  margin: 0;
}

.entry-title {
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.48;
}

.entry-where {
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 0.1rem !important;
}

.entry-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  line-height: 1.55;
  color: var(--ink-faint);
  margin-top: 0.34rem !important;
}

.entry-detail {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin-top: 0.35rem !important;
}

.publication-authors {
  font-size: 0.91rem;
  line-height: 1.55;
}

.publication-authors strong {
  color: var(--ink);
  font-weight: 700;
}

.publication-note {
  margin-top: 0.18rem !important;
  color: var(--ink-faint);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.cv-more {
  margin: 4rem 0 0;
}

.cv-more a {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-decoration: none;
}

.cv-more a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cv-contact {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 1.2rem 0 0;
}

/* ── writings list ────────────────────────────────────────── */

.page-title {
  font-size: 2rem;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: 0;
  margin: clamp(3.5rem, 10vh, 5.5rem) 0 0;
}

.post-list {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.post-item {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  min-height: 4.6rem;
  margin: 0;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}

.post-date {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--ink-faint);
}

.post-period {
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.post-link {
  font-size: 1.12rem;
  line-height: 1.5;
  text-decoration: none;
  text-wrap: pretty;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.post-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}

.empty {
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 2.5rem;
}

/* ── post page ────────────────────────────────────────────── */

.crumb {
  margin: clamp(3rem, 8vh, 4.5rem) 0 0;
}

.crumb a {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-decoration: none;
}

.crumb a:hover {
  color: var(--accent);
}

.post-head {
  margin-top: 1.8rem;
}

.post-title {
  font-size: 2.05rem;
  font-weight: 500;
  font-variation-settings: "opsz" 60;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.post-meta {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin: 1rem 0 0;
}

/* ── prose (markdown body) ────────────────────────────────── */

.prose {
  margin-top: 3rem;
  font-size: 1.02rem;
  line-height: 1.82;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.prose p {
  margin: 1.35rem 0 0;
  text-wrap: pretty;
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.018em;
  margin: 3.8rem 0 0;
  line-height: 1.4;
  text-wrap: balance;
}

.prose h3 {
  font-size: 1.12rem;
  font-weight: 650;
  font-style: normal;
  letter-spacing: -0.01em;
  margin: 2.65rem 0 0;
  line-height: 1.5;
  text-wrap: balance;
}

.prose h2 + p,
.prose h3 + p {
  margin-top: 0.85rem;
}

.prose ul,
.prose ol {
  margin: 1.45rem 0 0;
  padding-left: 1.4rem;
}

.prose li {
  margin-top: 0.45rem;
  text-wrap: pretty;
}

.prose li::marker {
  color: var(--ink-faint);
}

.prose .section-label {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 4.75rem 0 0;
  font-family: var(--serif);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.prose .section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.prose .section-label + h2 {
  margin-top: 0.9rem;
}

.prose .research-callout {
  margin: 1.9rem 0 0;
  padding: 1.1rem 1.2rem 1.15rem;
  border-left: 2px solid var(--ink);
  background: var(--panel);
}

.prose .research-callout p {
  margin: 0.55rem 0 0;
  font-size: 0.93rem;
  line-height: 1.72;
  color: var(--ink-soft);
}

.prose .research-callout .research-callout-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}

.prose .research-callout ul {
  margin: 0.7rem 0 0;
  padding-left: 1.15rem;
}

.prose .research-callout li {
  margin-top: 0.3rem;
  font-size: 0.91rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

.prose .research-callout-finding {
  border: 1px solid var(--ink);
}

.prose .research-callout-limit {
  border-left-color: var(--ink-faint);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

.prose blockquote {
  margin: 1.8rem 0 0;
  padding-left: 1.3rem;
  border-left: 1px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
}

.prose blockquote p {
  margin-top: 0.6rem;
}

.prose blockquote p:first-child {
  margin-top: 0;
}

.prose hr {
  border: 0;
  margin: 3rem 0 0;
}

.prose hr::after {
  content: "⁂";
  display: block;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto 0;
}

.prose .project-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 2rem 0 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.prose .project-meta > div {
  padding: 0.95rem 1rem;
  background: var(--panel);
}

.prose .project-meta span {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.prose .project-meta strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.91rem;
  font-weight: 600;
  line-height: 1.45;
}

.prose .research-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.4rem;
  margin: 2rem 0 0;
}

.prose .research-metric {
  padding-top: 0.75rem;
  border-top: 1px solid var(--ink);
}

.prose .research-metric-value,
.prose .research-metric-label {
  display: block;
}

.prose .research-metric-value {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.prose .research-metric-label {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.prose .research-figure {
  margin: 2.2rem 0 0;
}

.prose .research-figure img {
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
}

.prose .research-figure figcaption {
  margin-top: 0.65rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
}

.prose .research-figure-interface img {
  max-width: 35rem;
}

.prose .research-figure-comparison img {
  max-width: 48rem;
}

.prose .research-figure-scroll {
  display: block;
  overflow-x: auto;
  color: inherit;
}

.prose .research-figure-scroll img {
  display: block;
}

.prose .research-figure-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  margin: 2.2rem 0 0;
}

.prose .research-figure-pair .research-figure {
  margin: 0;
}

.prose .research-table {
  margin: 1.8rem 0 0;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.prose .research-table table {
  min-width: 37rem;
  margin: 0;
}

.prose .research-table th,
.prose .research-table td {
  padding-right: 1rem;
}

.prose .research-table td:last-child,
.prose .research-table th:last-child {
  padding-right: 0;
}

.prose .publication-card {
  margin: 2rem 0 0;
  padding: 1.3rem 1.4rem 1.35rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.prose .publication-card p {
  margin: 0;
}

.prose .publication-card-kicker {
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.prose .publication-card-title {
  margin-top: 0.5rem !important;
  font-size: 1.06rem;
  font-weight: 650;
  line-height: 1.45;
}

.prose .publication-card-meta {
  margin-top: 0.45rem !important;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.prose .publication-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin-top: 1rem !important;
  font-size: 0.86rem;
}

.prose .publication-card-links a {
  text-decoration-thickness: 1px;
}

.prose table {
  width: 100%;
  margin: 1.8rem 0 0;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prose th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  font-weight: 500;
  padding: 0.5rem 0.8rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.prose td {
  padding: 0.5rem 0.8rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.08em 0.36em;
}

.prose pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.1rem 1.3rem;
  margin: 1.8rem 0 0;
  overflow-x: auto;
  line-height: 1.65;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.8rem;
}

/* ── syntax highlighting (PrismJS classes, palette-matched) ── */

.token.comment,
.token.prolog,
.token.cdata {
  color: var(--ink-faint);
  font-style: italic;
}

.token.keyword,
.token.atrule,
.token.important,
.token.tag {
  color: var(--accent);
}

.token.string,
.token.char,
.token.attr-value,
.token.regex {
  color: #555555;
}

.token.function,
.token.class-name,
.token.selector {
  color: #242424;
}

.token.number,
.token.boolean,
.token.constant,
.token.builtin,
.token.attr-name {
  color: #696969;
}

.token.operator,
.token.punctuation {
  color: var(--ink-soft);
}

/* ── footer ───────────────────────────────────────────────── */

.site-foot {
  text-align: center;
  margin-top: clamp(5rem, 14vh, 8rem);
  padding: 0 1.5rem 3.5rem;
}

.site-foot::before {
  content: "⁂";
  display: block;
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin-bottom: 1.6rem;
}

.site-foot p {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0;
}

.site-foot a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-foot a:hover {
  color: var(--accent);
}

.foot-sep {
  margin: 0 0.5rem;
  color: var(--line);
}

/* ── small screens ────────────────────────────────────────── */

@media (max-width: 560px) {
  .site-head {
    padding-top: 2.35rem;
  }

  .nav {
    flex-wrap: wrap;
    gap: 0.85rem 1.1rem;
  }

  .nav a {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }

  .theme-toggle {
    width: 1.75rem;
    height: 1.75rem;
    margin-left: -0.25rem;
  }

  .hero {
    margin-top: 3.25rem;
  }

  .hero-name {
    font-size: 2.25rem;
  }

  .contact-links {
    gap: 0.6rem 1rem;
    margin-top: 1.7rem;
  }

  .contact-link {
    width: 2.2rem;
    height: 2.2rem;
  }

  .cv-section {
    margin-top: 3rem;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .entry-period {
    padding-top: 0;
  }

  .entry-meta {
    margin-top: 0.25rem !important;
  }

  .page-title {
    font-size: 1.7rem;
  }

  .post-item {
    grid-template-columns: 5.6rem minmax(0, 1fr);
    gap: 0.9rem;
    align-items: center;
    min-height: 4.25rem;
    padding: 1rem 0;
  }

  .post-link {
    font-size: 1rem;
  }

  .post-title {
    font-size: 1.7rem;
  }

  .lede {
    font-size: 1.16rem;
  }

  .prose .project-meta {
    grid-template-columns: 1fr;
  }

  .prose .research-metrics {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .prose .research-metric-value {
    font-size: 1.42rem;
  }

  .prose .research-figure-pair {
    grid-template-columns: 1fr;
  }

  .prose .research-figure-comparison .research-figure-scroll img {
    width: 46rem;
    max-width: none;
  }

  .prose .publication-card {
    padding: 1.15rem 1.1rem 1.2rem;
  }

  .prose .section-label {
    margin-top: 3.8rem;
    font-size: 0.7rem;
  }

  .prose {
    font-size: 0.98rem;
    line-height: 1.78;
  }

  .prose h2 {
    font-size: 1.32rem;
    line-height: 1.42;
  }

  .prose h3 {
    font-size: 1.06rem;
    margin-top: 2.35rem;
  }

  .prose .research-callout {
    padding: 1rem 1rem 1.05rem;
  }
}
