* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

:root {
  --bg: oklch(97.5% 0.006 80);
  --bg-raised: oklch(100% 0 0);
  --fg: oklch(20% 0.01 80);
  --fg-muted: oklch(48% 0.01 80);
  --border: oklch(90% 0.006 80);
  --accent: #c8552d;
  --accent-ink: oklch(99% 0 0);
  --accent-tint: color-mix(in oklab, var(--accent) 14%, white);
  --accent-tint-ink: color-mix(in oklab, var(--accent) 65%, black);
  --shadow: 0 1px 2px rgba(20, 15, 10, .04), 0 10px 28px -12px rgba(20, 15, 10, .16);
  --shadow-hover: 0 2px 4px rgba(20, 15, 10, .05), 0 16px 36px -14px rgba(20, 15, 10, .2);
  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

:root[data-theme="dark"] {
  --bg: oklch(19% 0.012 80);
  --bg-raised: oklch(24% 0.012 80);
  --fg: oklch(95% 0 0);
  --fg-muted: oklch(68% 0.01 80);
  --border: oklch(32% 0.012 80);
  --accent-tint: color-mix(in oklab, var(--accent) 22%, black);
  --accent-tint-ink: color-mix(in oklab, var(--accent) 55%, white);
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 28px -12px rgba(0, 0, 0, .45);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .25), 0 16px 36px -14px rgba(0, 0, 0, .5);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  min-height: 100vh;
}

a { color: inherit; }

/* header */
.header { position: sticky; top: 0; background: var(--bg); z-index: 10; }
.header-inner {
  max-width: 920px; margin: 0 auto; padding: 1.5rem 1.5rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-tint); color: var(--accent-tint-ink);
  display: flex; align-items: center; justify-content: center; flex: none;
  font-family: var(--font-display); font-weight: 700; font-size: .85rem;
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; color: var(--fg); }
.right-cluster { display: flex; align-items: center; gap: 1.75rem; }
.nav { display: flex; gap: 1.75rem; }
.nav a {
  font-size: .92rem; font-weight: 500; text-decoration: none; color: var(--fg-muted);
  padding-bottom: 2px; border-bottom: 2px solid transparent; transition: color .15s ease;
}
.nav a:hover { color: var(--fg); }
.nav a.active { color: var(--fg); border-color: var(--accent); }

.lang-switch {
  font-size: .8rem; font-weight: 600; text-decoration: none; color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: .35rem .65rem; transition: color .15s ease, border-color .15s ease;
}
.lang-switch:hover { color: var(--fg); border-color: var(--fg-muted); }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-raised);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; padding: 0;
  transition: background .15s ease;
}
.theme-toggle:hover { background: var(--border); }
.theme-toggle svg { width: 17px; height: 17px; stroke: var(--fg-muted); fill: none; stroke-width: 1.8; display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* layout */
.wrap { max-width: 700px; margin: 0 auto; padding: 1.5rem 1.5rem 5rem; }
.wrap--narrow { max-width: 680px; }
.wrap--tight { max-width: 560px; }

/* hero */
.hero { padding: 1.5rem 0 3rem; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2; margin: 0 0 .85rem; letter-spacing: -0.01em;
}
.hero p { font-size: 1.02rem; color: var(--fg-muted); margin: 0; max-width: 46ch; line-height: 1.55; }

/* page title (About / Contact) */
.page-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.2rem);
  margin: 0 0 1.75rem; letter-spacing: -0.01em;
}

/* sections */
.section-label {
  font-size: .82rem; font-weight: 600; color: var(--fg-muted); margin: 0 0 1.25rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.section-label--spaced { margin-top: 3.25rem; }

/* project cards */
.cards { display: flex; flex-direction: column; gap: 1rem; }
.card {
  display: flex; gap: 1.25rem; border-radius: 16px; background: var(--bg-raised);
  padding: 1.35rem 1.5rem; text-decoration: none; color: var(--fg);
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card--former { opacity: .72; }
.card--former:hover { opacity: 1; }
.card-thumb { width: 88px; height: 88px; flex: none; border-radius: 12px; background: var(--bg); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-main { min-width: 0; }
.card-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .55rem; }
.card-date { font-size: .78rem; color: var(--fg-muted); }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; margin: 0 0 .4rem; line-height: 1.25; }
.card-body { font-size: .92rem; line-height: 1.55; margin: 0; color: var(--fg-muted); }

.also-label {
  font-size: .82rem; font-weight: 600; color: var(--fg-muted); margin: 1.75rem 0 .9rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.chip-link { text-decoration: none; transition: transform .15s ease; }
.chip-link:hover { transform: translateY(-1px); }

/* tags / chips */
.tag {
  border-radius: 999px; padding: .18rem .65rem; font-size: .72rem; font-weight: 600;
  background: var(--accent-tint); color: var(--accent-tint-ink);
}
.chip-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip-group-label { font-size: .78rem; font-weight: 600; color: var(--fg-muted); margin: 0 0 .6rem; }
.chip-group-label--spaced { margin-top: 1.1rem; }
.chip { border-radius: 999px; padding: .4rem .9rem; font-size: .84rem; font-weight: 600; background: var(--accent-tint); color: var(--accent-tint-ink); }

/* panels */
.panel { background: var(--bg-raised); border-radius: 16px; padding: 1.75rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.panel-label { font-size: .82rem; font-weight: 600; color: var(--fg-muted); margin: 0 0 1.1rem; text-transform: uppercase; letter-spacing: .04em; }
.panel p { margin: 0 0 1rem; line-height: 1.65; color: var(--fg); }
.panel p:last-child { margin-bottom: 0; }
.panel pre {
  font-family: var(--font-mono); font-size: .82rem; background: var(--bg); border-radius: 10px;
  padding: 1rem 1.15rem; overflow-x: auto; white-space: pre-wrap; color: var(--fg); line-height: 1.6;
}
.panel a { text-decoration: underline; text-underline-offset: 2px; }

/* info rows (About / Contact) */
.info-row { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row:first-child { padding-top: 0; }
.info-label { font-size: .82rem; font-weight: 600; color: var(--fg-muted); width: 120px; flex: none; }
.info-value { flex: 1; min-width: 200px; line-height: 1.6; }
.info-value a { text-decoration: underline; text-underline-offset: 2px; }
.info-list {
  list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: .6rem;
}
.info-list li { display: flex; align-items: center; gap: .6rem; }
.info-list .icon { width: 18px; height: 18px; flex: none; color: var(--fg-muted); }
.info-list a { text-decoration: underline; text-underline-offset: 2px; }

.edu-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: .55rem; }
.edu-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5rem; }
.edu-degree { font-weight: 600; }
.edu-school { color: var(--fg-muted); font-size: .92rem; }

/* about intro */
.intro { display: flex; gap: 1.75rem; align-items: center; margin-bottom: 2.5rem; flex-wrap: wrap; }
.intro-photo { width: 128px; height: 128px; flex: none; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.intro-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.intro-text { min-width: 240px; flex: 1; }
.intro-text h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.2rem);
  margin: 0 0 .6rem; letter-spacing: -0.01em;
}
.intro-text p { margin: 0; line-height: 1.6; color: var(--fg-muted); }

/* project detail */
.back-link {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .88rem; font-weight: 500;
  text-decoration: none; color: var(--fg-muted); margin-bottom: 1.75rem;
}
.back-link:hover { color: var(--fg); }
.detail-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .85rem; }
.detail-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.2; margin: 0 0 1.75rem; letter-spacing: -0.01em;
}
.detail-hero {
  border-radius: 16px; overflow: hidden; margin-bottom: 1.75rem; box-shadow: var(--shadow);
  background: var(--bg-raised); display: flex; align-items: center; justify-content: center;
  max-height: 280px; padding: 1.5rem;
}
.detail-hero img { max-width: 100%; max-height: 220px; width: auto; height: auto; display: block; object-fit: contain; }

.btn-row { display: flex; gap: .85rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.btn {
  display: inline-flex; align-items: center; font-size: .88rem; font-weight: 600;
  text-decoration: none; padding: .7rem 1.35rem; border-radius: 999px; transition: transform .15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--bg-raised); color: var(--fg); box-shadow: var(--shadow); }
.btn:hover { transform: translateY(-1px); }
.btn-spaced { margin-top: 1.75rem; }

.links-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.links-list a { text-decoration: underline; text-underline-offset: 2px; font-size: .92rem; }

/* 404 */
.error-page { text-align: center; padding: 5rem 1.5rem; }
.error-page h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 .75rem;
}
.error-page p { color: var(--fg-muted); margin: 0; }

@media (max-width: 480px) {
  .card { flex-direction: column; }
  .card-thumb { width: 100%; height: 150px; }
}
