:root {
  --bg: #f6f4ef;
  --bg-soft: #efede6;
  --ink: #14120e;
  --muted: #6b675e;
  --faint: #9a958a;
  --line: rgba(20, 18, 14, 0.14);
  --accent: #176b45;
  --accent-ink: #0f4a30;
  --card: #ffffff;
  --radius: 20px;
  --serif: "Noto Serif SC", "Noto Sans SC", Georgia, serif;
  --sans: "Noto Sans SC", "Instrument Sans", system-ui, sans-serif;
  --latin: "Instrument Sans", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 520px at 12% -6%, rgba(23, 107, 69, 0.055), transparent 60%),
    var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { display: block; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 6vw;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
}
.mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
nav { display: flex; gap: 26px; align-items: center; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
}
nav a:hover { color: var(--ink); }
nav a.ext span { display: inline; }
.ico { width: 15px; height: 15px; flex: 0 0 auto; }
.nav-cta {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #f7f5f0 !important;
}
.nav-cta:hover { background: var(--accent); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 72px 6vw 96px;
}
.eyebrow {
  margin: 0;
  font-family: var(--latin);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }
.hero-name {
  margin: 16px 0 22px;
  font-family: var(--serif);
  font-size: clamp(58px, 10vw, 128px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  font-weight: 900;
}
.hero-lede {
  max-width: 30em;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.75;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 34px;
  padding: 0;
  list-style: none;
}
.facts li {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn.primary { background: var(--ink); color: #f7f5f0; }
.btn.primary:hover { background: var(--accent); transform: translateY(-2px); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn.ghost:hover { background: var(--bg-soft); transform: translateY(-2px); }

.hero-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 14px;
}
.hero-contact a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  text-decoration: none;
}
.hero-contact a:hover { color: var(--accent); }

.hero-photo { display: grid; place-items: center; perspective: 1400px; }
.portrait-card {
  width: min(100%, 440px);
  border-radius: 26px;
  overflow: hidden;
  transform: rotateY(-12deg) rotateX(4deg);
  box-shadow:
    30px 46px 80px rgba(40, 30, 20, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  transition: transform 0.18s ease-out;
}
.portrait-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 18%;
}

/* ---------- sections ---------- */
.section { padding: 96px 6vw; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 52px; }
.section-head h2 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: clamp(38px, 5.4vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* ---------- projects ---------- */
.project { padding: 44px 0 68px; border-top: 1px solid var(--line); }
.project:last-child { padding-bottom: 8px; }
.project-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: start;
  margin-bottom: 10px;
}
.project-idx {
  font-family: var(--latin);
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.08em;
  padding-top: 9px;
}
.project-title h3 {
  margin: 0 0 10px;
  font-family: var(--sans);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.tag {
  display: inline-flex;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(23, 107, 69, 0.09);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 500;
}
.project-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  padding-top: 4px;
}
.kind { font-size: 13px; color: var(--faint); }
.textlink {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.textlink:hover { color: var(--accent); border-color: var(--accent); }
.project-note {
  max-width: 760px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

/* ---------- media frame / gate ---------- */
.frame {
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d0d0d;
  box-shadow: 0 26px 64px rgba(20, 18, 14, 0.13);
}
.frame.paper { background: #fff; }
.gate {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.gate.has-cover {
  background-size: cover;
  background-position: center;
}
.gate.has-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 8, 0.16);
  transition: background 0.25s ease;
}
.gate.has-cover:hover::before { background: rgba(10, 10, 8, 0.32); }
.gate-btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  border-radius: 999px;
  background: rgba(247, 245, 240, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  transition: transform 0.15s ease;
}
.gate:hover .gate-btn { transform: translateY(-2px); }
.gate .play { width: 16px; height: 16px; }
.frame video { display: block; width: 100%; aspect-ratio: 16 / 9; }
.frame iframe.doc {
  display: block;
  width: 100%;
  height: min(78vh, 880px);
  border: 0;
  background: #fff;
}

/* ---------- inline doc fallback (JS) ---------- */
.doc-fallback {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 36px 24px;
  text-align: center;
  position: relative;
}
.doc-fallback.has-glass {
  aspect-ratio: 16 / 9;
  min-height: 0;
  padding: 20px;
  background-size: cover;
  background-position: center;
}
.doc-fallback.has-glass.portrait { aspect-ratio: 3 / 4; background-position: center top; }
.doc-fallback.has-glass::before { content: ""; position: absolute; inset: 0; background: rgba(16, 14, 12, 0.18); }
.glass-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(92%, 420px);
  padding: 20px 22px 18px;
  border-radius: 20px;
  background: rgba(247, 242, 234, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 16px 40px rgba(20, 16, 12, 0.14);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}
.doc-fallback p { margin: 0; color: #3a362f; font-size: 15px; line-height: 1.6; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.doc-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.doc-actions a.primary { background: var(--ink); color: #f7f5f0; }
.doc-actions a.ghost {
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}
.doc-note { font-size: 13px; }

/* ---------- about ---------- */
.about-grid { display: grid; gap: 44px; }
.about-bio { max-width: 40em; margin: 0; font-size: 19px; line-height: 1.8; }
.about-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.skill-group h4, .awards h4 {
  margin: 0 0 14px;
  font-family: var(--latin);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}
.skill-group ul, .awards ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.skill-group li { color: var(--ink); font-size: 15px; }
.awards { border-top: 1px solid var(--line); padding-top: 32px; }
.awards ul { gap: 11px; }
.awards li { color: var(--muted); font-size: 15px; padding-left: 16px; position: relative; }
.awards li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- resume ---------- */
.resume-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.resume-name { margin: 0; color: var(--muted); font-size: 15px; }
.resume-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.resume-view { margin-top: 8px; }

/* ---------- notes / blog ---------- */
.post-list { display: grid; }
.post-card {
  display: block;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}
.post-card:last-child { border-bottom: 1px solid var(--line); }
.post-card time { color: var(--faint); font-size: 13px; font-family: var(--latin); }
.post-card h3 {
  margin: 8px 0 6px;
  font-family: var(--sans);
  font-size: clamp(21px, 2.4vw, 30px);
  letter-spacing: -0.02em;
  font-weight: 700;
}
.post-card p { margin: 0; color: var(--muted); }
.home-posts { max-width: 820px; }
.more-posts { margin: 22px 0 0; }
.more-posts a { color: var(--ink); }
.empty-note { color: var(--muted); }

/* ---------- footer ---------- */
.foot {
  padding: 96px 6vw 40px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.foot-head h2 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-weight: 700;
}
.foot-sub { color: var(--muted); margin: 0 0 44px; }
.foot-links { display: grid; gap: 20px; margin-bottom: 48px; }
.giant { display: block; text-decoration: none; color: var(--ink); }
.giant-label {
  display: block;
  font-family: var(--latin);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.giant-value {
  display: block;
  font-family: var(--serif);
  font-size: clamp(22px, 4.4vw, 46px);
  letter-spacing: -0.02em;
  line-height: 1.12;
  font-weight: 700;
  transition: color 0.15s ease;
}
.giant:hover .giant-value { color: var(--accent); }
.foot-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.foot-row a {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- reading (blog post) ---------- */
.reading { padding: 64px 6vw 96px; max-width: 860px; }
.reading .section-head { margin-bottom: 40px; }
.post-title {
  margin: 12px 0 12px;
  font-family: var(--serif);
  font-size: clamp(36px, 5.4vw, 60px);
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-weight: 700;
}
.post-date { margin: 0 0 28px; color: var(--faint); font-size: 14px; }
.draft-flag {
  display: inline-block;
  margin: 16px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(20, 18, 14, 0.07);
  font-size: 13px;
  color: var(--muted);
}
.lede { color: var(--muted); font-size: 18px; line-height: 1.7; }

.prose { font-size: 17px; line-height: 1.8; }
.prose h1, .prose h2, .prose h3 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.prose h2 { font-size: 28px; margin: 40px 0 14px; }
.prose h3 { font-size: 22px; margin: 32px 0 12px; }
.prose p, .prose ul, .prose ol { margin: 0 0 18px; }
.prose a { text-underline-offset: 3px; }
.prose code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(20, 18, 14, 0.07);
  padding: 0.12em 0.4em;
  border-radius: 6px;
}
.prose pre {
  background: var(--ink);
  color: #f7f5f0;
  padding: 18px 20px;
  border-radius: 14px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose blockquote {
  margin: 0 0 18px;
  padding: 0 0 0 18px;
  border-left: 3px solid var(--ink);
  color: var(--muted);
}
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 18px; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 40px; }
  .hero-photo { order: -1; }
  .portrait-card {
    width: min(100%, 320px);
    transform: none;
    border-radius: 20px;
  }
  nav { gap: 16px; }
  nav a.ext span { display: none; }
  .project-bar { grid-template-columns: auto 1fr; }
  .project-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; }
  .about-cols { grid-template-columns: 1fr; gap: 24px; }
}
