:root {
  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, .42);   /* reference site's translucent white */
  --body: rgba(255, 255, 255, .74);  /* readable body copy */
  --line: rgba(255, 255, 255, .14);
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ph: #2a2a2a;
  --pad: clamp(16px, 2.2vw, 28px);
  --text-w: 680px;
  --media-w: 960px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 400 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
/* project pages */
.light {
  --bg: #f1f1f1;
  --fg: #111111;
  --dim: rgba(17, 17, 17, .5);
  --body: #111111;
  --line: rgba(17, 17, 17, .14);
  --ph: #d9d9d9;
}
a { color: inherit; text-decoration: none; transition: color .2s, opacity .2s; }
a:hover { color: var(--fg); }
img, video, iframe { display: block; max-width: 100%; height: auto; }
b, strong { font-weight: 600; color: var(--fg); }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--pad);
  font-size: 17px; line-height: 1.3; color: var(--dim);
  background: linear-gradient(var(--bg) 60%, transparent);
}
.bar .name { color: var(--fg); }
.bar .name span { display: block; color: var(--dim); }
.bar nav { display: flex; gap: 1.2em; align-items: baseline; }
.langs { display: flex; gap: .7em; padding-left: 1.2em; border-left: 1px solid var(--line); }
.langs a[aria-current] { color: var(--fg); }
/* Korean: break lines between words, not inside them */
:lang(ko) body, body:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(ko) .intro, :lang(zh-Hans) .intro { letter-spacing: -.02em; line-height: 1.25; }

/* ---------- home ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px var(--pad) var(--pad);
  position: relative; overflow: hidden;
}
.home .bar { background: none; }
/* 3D blob (blob3d.js) */
.blobs { position: absolute; inset: 0; }
.blobs canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
/* film grain over the 3D blob */
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* no-WebGL fallback: just the eyes */
.eyes-only { position: absolute; left: 50%; top: 50%; width: min(70vw, 70vh); aspect-ratio: 1; translate: -50% -50%; }
.eyes { position: absolute; inset: 0; will-change: transform; }
.eye {
  /* pill eyes; white here because the fallback sits on the black page with no blob behind it */
  position: absolute; width: 4%; aspect-ratio: 1 / 2; translate: -50% -50%; border-radius: 999px;
  background: #fff; transition: scale .12s;
}
.blink .eye { scale: 1 .1; }
.intro {
  position: relative; z-index: 1; pointer-events: none;  /* characters under the text stay draggable */
  text-shadow: 0 1px 18px rgba(0, 0, 0, .45);  /* readable over bright colors */
  margin: 0 auto; max-width: 22em;
  font-size: clamp(20px, 2.4vw, 34px); line-height: 1.08; font-weight: 500;
  letter-spacing: -.035em; color: var(--dim);
}
.intro em { font-style: normal; color: var(--fg); }

.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 64px var(--pad);
  padding: 40px var(--pad) 120px;
}
.card { display: block; color: var(--dim); }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; transition: opacity .3s; }
.card:hover img { opacity: .82; }
.card-title { display: inline-block; margin-top: 14px; font-size: 20px; font-weight: 500; color: var(--fg); }
.card-year { margin-left: .6em; font-size: 16px; }
.foot { padding: 0 var(--pad) var(--pad); color: var(--dim); font-size: 15px; }

/* ---------- project ---------- */
.project-head {
  max-width: calc(var(--media-w) + 2 * var(--pad)); margin: 0 auto;
  padding: 32vh var(--pad) 10vh;
}
.project-head h1 {
  margin: 0; font-weight: 600; color: var(--fg);
  font-size: clamp(48px, 9vw, 132px); line-height: .95; letter-spacing: -.05em;
}
.meta { margin: 0 0 12px; color: var(--dim); font-size: 20px; }

.case { padding: 0 var(--pad); }
/* left-aligned with the title, line length capped at --text-w */
.case .text { max-width: var(--media-w); margin: 0 auto 56px; padding-right: max(0px, min(var(--media-w), 100%) - var(--text-w)); }
.case .text h1, .case .text h2, .case .text h3 {
  margin: 1.4em 0 .5em; font-weight: 600; color: var(--fg);
  font-size: 32px; line-height: 1.15; letter-spacing: -.025em;
}
.case .text h3 { font-size: 18px; line-height: 1.55; font-weight: 400; color: var(--body); letter-spacing: 0; }
.case .text h1:first-child, .case .text h2:first-child { margin-top: 0; }
.case .text h2 b, .case .text h1 b { font-weight: inherit; }
.case .text a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dim); }
.case figure { max-width: var(--media-w); margin: 0 auto 56px; }
.case figure img, .case figure video { width: 100%; }
.ph { /* missing image — replace with <img> */
  display: flex; align-items: center; justify-content: center; width: 100%;
  background: var(--ph); color: var(--dim); font-size: 15px;
}
.case .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.case .row .text, .case .col { margin: 0; padding-right: 0; color: var(--body); }
.case .embed, .case figure > iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }
.case .embed iframe, .case figure > iframe { width: 100%; height: 100%; border: 0; }

.next {
  display: block; max-width: var(--media-w); margin: 120px auto 0;
  padding: 48px var(--pad) 72px; border-top: 1px solid var(--line);
  font-size: clamp(32px, 5vw, 64px); line-height: 1.05; color: var(--dim);
}
.next span { display: block; font-size: 18px; margin-bottom: 8px; }

/* ---------- resume (markup imported from Cargo) ---------- */
.resume .resume-embed { max-width: var(--text-w); margin: 0 auto; padding: 0 var(--pad) 120px; }
.resume .bio { font-size: 24px; line-height: 1.4; margin: 0 0 48px; color: var(--body); }
.resume .skills-box { display: grid; gap: 0; margin-bottom: 64px; }
.resume .skill-row, .resume .exp-row, .resume .footer-row { display: flex; gap: 24px; }
.resume .skill-label, .resume .company, .resume .footer-label { width: 150px; flex-shrink: 0; color: var(--fg); }
.resume .company { font-size: 24px; line-height: 1.2; }
.resume .footer-label { color: var(--dim); }
.resume hr.divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.resume .exp-title { margin: 0 0 8px; color: var(--fg); }
.resume .exp-period, .resume .muted { color: var(--dim); }
.resume .exp-detail ul { margin: 0 0 6px; padding-left: 1.1em; }
.resume .exp-section, .resume .footer-sections { display: block; }

@media (max-width: 720px) {
  body { font-size: 17px; }
  .bar { font-size: 15px; gap: 12px; }
  .bar .name, .bar nav a { white-space: nowrap; }
  .bar nav { flex-wrap: wrap; justify-content: flex-end; gap: .3em .9em; }
  .langs { flex-basis: 100%; justify-content: flex-end; padding-left: 0; border-left: 0; }
  .grid { grid-template-columns: 1fr; gap: 40px; }
  .skill-row, .exp-row, .footer-row { flex-direction: column; gap: 6px !important; }
  .resume .skill-label, .resume .company, .resume .footer-label { width: auto; }
}

/* ---------- password modal (home) ---------- */
.lock {
  width: min(360px, calc(100% - 32px)); padding: 20px; border-radius: 18px;
  color: #fff; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(28px) saturate(1.5); backdrop-filter: blur(28px) saturate(1.5);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.lock::backdrop { background: rgba(0, 0, 0, .25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lock-row { display: flex; gap: 8px; }
.lock input {
  flex: 1; min-width: 0; padding: 12px 14px; font: inherit; color: #fff;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px;
}
.lock input::placeholder { color: rgba(255, 255, 255, .55); }
.lock input:focus { outline: none; border-color: #fff; }
.lock button {
  padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer;
  color: #111; background: #fff; border: 0; border-radius: 10px;
}
.lock-err { margin: 10px 2px 0; font-size: 15px; color: #ff8a8a; }
