:root {
  --bg: #fdfdfc;
  --card: #f4f4f2;
  --ink: #2a2a2a;
  --ink-soft: #6b6b6b;
  --ink-faint: #b5b5b3;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pill-bg: rgba(241, 241, 241, 0.55);
  --pill-line: rgba(26, 26, 26, 0.08);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header / nav (floating frosted pill, logo pinned top-left) ── */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  pointer-events: none; /* children re-enable */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding-top: 20px;
}

.logo-link {
  position: absolute;
  left: calc(max(0px, 50vw - 430px) + clamp(20px, 6vw, 80px));
  top: 20px;
  display: block;
  pointer-events: auto;
}

.logo {
  height: 52px;
  width: auto;
  display: block;
  transition: transform 1.1s cubic-bezier(0.34, 1.3, 0.5, 1);
  transform-origin: 50% 50%;
  cursor: pointer;
}
.logo-link:hover .logo,
.logo-link:focus-visible .logo { transform: rotate(360deg); }

.nav-pill {
  pointer-events: auto;
  width: min(420px, calc(100vw - 160px));
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  border-radius: 10px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.nav-pill a,
.nav-pill button {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}
.nav-pill a:hover,
.nav-pill button:hover { opacity: 0.65; }
.nav-pill a.active { font-weight: 700; }

/* Mobile hamburger (shown under 640px) */
.menu-btn {
  display: none;
  pointer-events: auto;
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.menu-btn:hover { opacity: 0.65; }

.mobile-menu {
  display: none;
  pointer-events: auto;
  position: absolute;
  top: 64px;
  right: 20px;
  left: 20px;
  background: var(--pill-bg);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  border-radius: 10px;
  padding: 8px 22px;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 16px 0;
  border-bottom: 1px solid var(--pill-line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a.active { font-weight: 700; }
.mobile-menu a:hover { opacity: 0.65; }

/* Contact dropdown */
.contact-wrap { position: relative; }

.contact-menu {
  position: absolute;
  top: calc(100% + 16px);
  right: 0;
  background: var(--card);
  border-radius: 14px;
  padding: 20px 24px;
  display: none;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
  z-index: 50;
}
.contact-wrap.open .contact-menu { display: flex; }
@media (hover: hover) {
  .contact-wrap:hover .contact-menu { display: flex; }
}
.contact-menu::before {
  content: "";
  position: absolute;
  top: -16px; left: 0; right: 0;
  height: 16px;
}

.contact-menu a {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  padding: 0;
  border-bottom: 1.5px solid transparent;
  width: fit-content;
}
.contact-menu a:hover { border-bottom-color: var(--ink); color: var(--ink); }

.contact-menu .menu-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Main content ───────────────────────────── */

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 130px clamp(20px, 6vw, 80px) 120px;
}

h1 {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.35;
}

p { margin-bottom: 18px; color: var(--ink); }
p a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
p a:hover { color: var(--ink-soft); }

.muted { color: var(--ink-soft); }

/* ── Home: mindmap ──────────────────────────── */

#mindmap {
  width: 100%;
  height: 480px;
  display: block;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #ececea;
  cursor: grab;
  touch-action: none;
}
#mindmap:active { cursor: grabbing; }

.map-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  max-width: 280px;
  line-height: 1.45;
}
.map-tooltip.show { opacity: 1; }

.home-linkedin { margin-top: 56px; }
.home-linkedin a {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 1px;
}
.home-linkedin a:hover { color: var(--ink-soft); border-bottom-color: var(--ink-soft); }

/* ── Writing page ───────────────────────────── */

.writing-list { list-style: none; margin-top: 40px; }

.writing-list li { margin-bottom: 20px; }

.writing-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
}
.writing-list a:hover { color: var(--ink-soft); }

.writing-list .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  transform: translateY(1px);
}

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

.blog-back { margin-bottom: 40px; }
.blog-back a {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
}
.blog-back a:hover { color: var(--ink); }

.blog-category {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.blog-category .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.blog-post ul { margin: 0 0 18px 22px; }
.blog-post li { margin-bottom: 10px; }

/* ── About page ─────────────────────────────── */

.about h1 { font-size: 14px; }
.about p { max-width: 720px; }
.about ul { margin: 0 0 18px 22px; }
.about li { margin-bottom: 12px; }

/* ── Project hover previews (About) ─────────── */

.proj { color: var(--ink); }
.proj.has-preview {
  cursor: pointer;
  border-bottom: 1.5px dotted var(--ink-faint);
}
.proj.has-preview:hover { color: var(--ink-soft); }

.proj-preview {
  position: fixed;
  top: 50%;
  right: clamp(16px, 4vw, 56px);
  transform: translateY(-50%) translateX(12px);
  width: min(360px, 38vw);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.3, 1.2, 0.5, 1);
  z-index: 80;
}
.proj-preview.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.proj-preview img,
.proj-preview video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: cover;
  object-position: top; /* tall page screenshots show their top */
}
.proj-preview video { display: none; }

.proj-mobile-note { display: none; }

@media (max-width: 640px) {
  .proj-preview { display: none; }
  .proj.has-preview { border-bottom: none; cursor: default; }
  .proj-mobile-note { display: inline; color: var(--ink-soft); }
}

/* ── Matcha corner ──────────────────────────── */

.matcha-corner {
  position: fixed;
  right: clamp(14px, 4vw, 48px);
  bottom: clamp(36px, 5vw, 48px);
  width: 90px;
  z-index: 40;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.matcha-corner img,
.matcha-corner svg.matcha-fallback {
  width: 100%;
  height: auto;
  display: block;
}

.matcha-caption {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.matcha-corner:hover .matcha-caption,
.matcha-corner:focus-visible .matcha-caption { opacity: 1; }

/* steam wisps */
.steam {
  position: absolute;
  top: -22px;
  left: 42%;
  width: 44px;
  transform: translateX(-50%);
  pointer-events: none;
}
.steam path {
  fill: none;
  stroke: #c9c9c5;
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0;
}
.matcha-corner:hover .steam path,
.matcha-corner:focus-visible .steam path {
  animation: steam-rise 2.2s ease-out infinite;
}
.steam path:nth-child(2) { animation-delay: 0.55s !important; }
.steam path:nth-child(3) { animation-delay: 1.1s !important; }

@keyframes steam-rise {
  0%   { opacity: 0; transform: translateY(8px) scaleX(1); }
  25%  { opacity: 0.9; }
  70%  { opacity: 0.35; }
  100% { opacity: 0; transform: translateY(-22px) scaleX(1.25); }
}


/* ── Mobile ─────────────────────────────────── */

@media (max-width: 640px) {
  .nav-pill { display: none; }
  .menu-btn { display: block; }
  .logo { height: 44px; }
  .logo-link { top: 14px; left: 16px; }
  main { padding-top: 104px; padding-bottom: 130px; }
  #mindmap { height: 380px; }
  .matcha-corner { width: 68px; }
}
