/* ─────────────────────────────────────────────────────────────────────
   main.css - site design (Work / Projects / About)
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg: #ffffff;
  --hero-bg: #ffffff;
  --card: #ffffff;
  --stage: #f5f5f5;
  --fg: #0a0a0a;
  --muted: #6f6f6f;
  --faint: #a3a3a3;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.2);
  --soft: rgba(0, 0, 0, 0.045);
  --soft-2: rgba(0, 0, 0, 0.08);
  --primary: #171717;
  --primary-fg: #fafafa;
  --header-bg: rgba(255, 255, 255, 0.72);
  --blue: oklch(0.485 0.291 264.1);          /* accent fill (buttons) */
  --accent-fg: #ffffff;
  --link: oklch(0.485 0.291 264.1);          /* accent text: links, italic words */
  --accent-line: oklch(0.485 0.291 264.1 / 0.55);
  --accent-glow: oklch(0.62 0.2 268 / 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -12px rgba(0, 0, 0, 0.16);
  --shot-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.35), 0 8px 20px -8px rgba(0, 0, 0, 0.18);
  --shot-lift-shadow: 0 80px 120px -30px rgba(0, 0, 0, 0.45), 0 20px 40px -12px rgba(0, 0, 0, 0.22);
  --heat-0: rgba(0, 0, 0, 0.06);
  --heat-1: oklch(0.88 0.06 268);
  --heat-2: oklch(0.74 0.14 267);
  --heat-3: oklch(0.58 0.23 265);
  --heat-4: oklch(0.45 0.29 264);
  --heat-shine: oklch(0.66 0.24 266);
  --heat-glow: oklch(0.6 0.25 266 / 0.55);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: 24px;
  --max: 1680px;
  --header-h: 64px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --hero-bg: #0a0a0a;
  --card: #131313;
  --stage: #1b1b1c;
  --fg: #f8f8f8;
  --muted: #a3a3a3;
  --faint: #6b6b6b;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --soft: rgba(255, 255, 255, 0.045);
  --soft-2: rgba(255, 255, 255, 0.09);
  --primary: #e5e5e5;
  --primary-fg: #141414;
  --header-bg: rgba(10, 10, 10, 0.72);
  --link: oklch(0.7 0.17 268);                /* lighter blue so text stays legible on dark */
  --accent-line: oklch(0.62 0.22 266 / 0.7);
  --accent-glow: oklch(0.5 0.25 266 / 0.22);
  --shadow: none;
  --shot-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.8), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shot-lift-shadow: 0 90px 130px -30px rgba(0, 0, 0, 0.9), 0 20px 40px -12px rgba(0, 0, 0, 0.7);
  --heat-0: rgba(255, 255, 255, 0.07);
  --heat-1: oklch(0.32 0.1 266);
  --heat-2: oklch(0.43 0.19 265);
  --heat-3: oklch(0.55 0.26 264);
  --heat-4: oklch(0.74 0.16 268);
  --heat-shine: oklch(0.93 0.07 268);
  --heat-glow: oklch(0.75 0.18 268 / 0.7);

  color-scheme: dark;
}

/* No-JS fallback: follow the system theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0a0a;
    --hero-bg: #0a0a0a;
    --card: #131313;
    --stage: #1b1b1c;
    --fg: #f8f8f8;
    --muted: #a3a3a3;
    --faint: #6b6b6b;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --soft: rgba(255, 255, 255, 0.045);
    --soft-2: rgba(255, 255, 255, 0.09);
    --primary: #e5e5e5;
    --primary-fg: #141414;
    --header-bg: rgba(10, 10, 10, 0.72);
    --link: oklch(0.7 0.17 268);                /* lighter blue so text stays legible on dark */
  --accent-line: oklch(0.62 0.22 266 / 0.7);
  --accent-glow: oklch(0.5 0.25 266 / 0.22);
    --shadow: none;
    --heat-0: rgba(255, 255, 255, 0.07);
    --heat-1: oklch(0.32 0.1 266);
    --heat-2: oklch(0.43 0.19 265);
    --heat-3: oklch(0.55 0.26 264);
    --heat-4: oklch(0.74 0.16 268);
    --heat-shine: oklch(0.93 0.07 268);
    --heat-glow: oklch(0.75 0.18 268 / 0.7);
    color-scheme: dark;
  }
}

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; color: var(--fg); }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

.inline-link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s;
}
.inline-link:hover { color: var(--link); text-decoration-color: currentColor; }

.icon { width: 16px; height: 16px; flex: none; }

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

/* One italic serif word per headline, in the accent blue. */
.accent-word {
  font-family: "Averia Serif Libre", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--link);
}

/* ── Header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  transition: background-color 0.2s, box-shadow 0.2s;
}
.site-header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 1px 0 var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* The brand doubles as the home tab: same pill as the nav links. */
.brand {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-nav a {
  height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* Header tabs: gray circle fill on hover, like .btn. Only one tab is gray at a time. */
.brand,
.site-nav a {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: color 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.brand::before,
.site-nav a::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: calc(100% + 40px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--soft-2);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1);
  pointer-events: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); }
.brand:hover::before,
.site-nav a:hover::before,
.brand[aria-current="page"]::before,
.site-nav a[aria-current="page"]::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
/* Short delay before the current tab refills, so crossing the gap between tabs doesn't flash it. */
.brand[aria-current="page"]::before,
.site-nav a[aria-current="page"]::before { transition-delay: 0.12s; }
.header-inner:has(.brand:not([aria-current]):hover, .site-nav a:not([aria-current]):hover) .site-nav a[aria-current="page"] {
  color: var(--muted);
}
.header-inner:has(.brand:not([aria-current]):hover, .site-nav a:not([aria-current]):hover) :is(.brand, .site-nav a)[aria-current="page"]::before {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition-delay: 0s;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--soft-2);
  color: var(--fg);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--border-strong); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 16px; height: 16px; }

/* Theme switch: the new theme spreads out from the toggle. main.js sets the
   circle's center and final radius before starting the view transition, so the
   clip applies from the very first frame. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
/* The radius is a registered custom property so the animation runs on the main
   thread. Animating clip-path directly lets Chromium composite it, and on 2x
   displays the composited circle is drawn at half scale (wrong center, stops at
   half size). */
@property --reveal-radius {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
::view-transition-new(root) {
  clip-path: circle(var(--reveal-radius) at var(--reveal-x, 100%) var(--reveal-y, 0));
  animation: theme-reveal 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes theme-reveal {
  from { --reveal-radius: 0px; }
  to   { --reveal-radius: var(--reveal-r, 150vmax); }
}
/* Colors swap instantly underneath the reveal instead of fading on their own. */
:root.theme-switching *,
:root.theme-switching *::before,
:root.theme-switching *::after {
  transition: none !important;
}

.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--soft);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.6s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.6s cubic-bezier(0.23, 1, 0.32, 1), transform 0.15s;
}
/* Hover fill: a circle grows from the center until it covers the button. */
.btn::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: calc(100% + 40px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1);
  pointer-events: none;
}
.btn:hover { color: var(--accent-fg); border-color: var(--blue); }
.btn:hover::before { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.btn:active { transform: scale(0.97); }

.social {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.social a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--fg);
  transition: background-color 0.15s, color 0.15s;
}
.social a:hover { background: var(--soft-2); }
.social svg { width: 18px; height: 18px; }

/* ── Hero (home) ──────────────────────────────────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
  margin-top: calc(var(--header-h) * -1);
  overflow: hidden;
  background: var(--hero-bg);
}

.hero-inner {
  position: relative;
  pointer-events: none;
  z-index: 3;
  min-height: min(100svh, 880px);
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-h) + 72px);
  padding-bottom: 112px;
}

.hero-copy {
  pointer-events: auto;
  width: 100%;
  max-width: 672px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--stage);
  box-shadow: 0 0 0 1px var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.display {
  margin-top: 40px;
  font-size: clamp(30px, 4.6vw, 36px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  margin-top: 24px;
  font-size: 18px;
  line-height: 28px;
  color: var(--muted);
  text-wrap: pretty;
}
.lede + .lede { margin-top: 20px; }
.lede a { color: var(--fg); }

.hero .btn-row { margin-top: 32px; }

/* GitHub heatmap */
.heatmap {
  margin-top: 32px;
  min-height: 126px;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
}
/* Scrolls on narrow screens, starting at the most recent week (rtl). The padding
   leaves room for cells pushed outward by the magnet effect. */
.heatmap-scroll {
  margin: -18px;
  padding: 18px;
  overflow-x: auto;
  direction: rtl;
  scrollbar-width: none;
}
.heatmap-scroll::-webkit-scrollbar { display: none; }
@media (hover: none), (max-width: 760px) {
  .heatmap-scroll { margin: -18px 0; padding: 18px 0; }
}
.heatmap-grid {
  position: relative;
  width: max-content;
  direction: ltr;
  display: grid;
  grid-template-rows: repeat(7, 10px);
  grid-auto-flow: column;
  grid-auto-columns: 10px;
  gap: 3px;
}
.heat {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--heat-0);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.heatmap-grid.is-settling .heat {
  transition: transform 0.55s cubic-bezier(0.34, 1.9, 0.64, 1);
}
.heat.level-1 { background: var(--heat-1); }
.heat.level-2 { background: var(--heat-2); }
.heat.level-3 { background: var(--heat-3); }
.heat.level-4 { background: var(--heat-4); }
.heat.is-future { background: transparent; box-shadow: inset 0 0 0 1px var(--soft-2); }
/* Load wave: cells pop in along a diagonal (--i = week + weekday) once the heatmap is in view. */
.heatmap-grid.will-reveal .heat { opacity: 0; }
.heatmap-grid.will-reveal.is-in .heat {
  animation: heat-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i, 0) * 14ms) both;
}
@keyframes heat-in {
  from { opacity: 0; scale: 0.2; }
  to { opacity: 1; scale: 1; }
}
.heatmap-caption {
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.heatmap-caption b {
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  font-weight: 600;
  box-shadow: inset 0 -1px 0 var(--accent-line);
}
.heatmap-caption a:hover { color: var(--fg); }

/* Decorative app collage behind the hero copy */
.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  perspective: 2200px;
}
.hero-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: flex-start;
  gap: 44px;
  transform: translate(2%, -48%) rotateX(48deg) rotateZ(-32deg);
  transform-style: preserve-3d;
}
.hero-shot {
  display: block;
  width: 250px;
  flex: none;
  border-radius: 38px;
  overflow: hidden;
  box-shadow: var(--shot-shadow), 0 0 0 1px var(--border);
  background: var(--card);
  pointer-events: auto;
  cursor: pointer;
  transform: translateZ(0);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.35s ease,
    filter 0.35s ease;
}
/* Hover: the phone lifts off the tilted surface toward the viewer; the others recede. */
.hero-shot:hover {
  transform: translateZ(28px) translateY(-6px);
  box-shadow: var(--shot-lift-shadow), 0 0 0 1px var(--border-strong);
}
.hero-stage:has(.hero-shot:hover) .hero-shot:not(:hover) {
  opacity: 0.5;
  filter: saturate(0.6);
}
.hero-shot:nth-child(2) { margin-top: -140px; }
.hero-shot:nth-child(3) { margin-top: 90px; }
.hero-shot:nth-child(4) { margin-top: -60px; }
.hero-shot img { width: 100%; height: auto; }

/* Soft blue glow centered under the intro paragraph. z-index -1 puts it behind
   the hero text but above the hero's own fade layers. */
.hero .display + .lede { position: relative; }
.hero .display + .lede::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 35%;
  width: min(900px, 80vw);
  height: 720px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-glow), transparent 72%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to top, var(--bg) 0, transparent 26%),
    linear-gradient(90deg, var(--hero-bg) 0, var(--hero-bg) 40%, color-mix(in srgb, var(--hero-bg) 50%, transparent) 62%, transparent 84%);
}

/* Theme-dependent images */
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
:root[data-theme="dark"] .only-light { display: none; }

/* ── Work feed ────────────────────────────────────────────────────── */
.feed {
  position: relative;
  z-index: 5;
  padding-bottom: 64px;
  background: linear-gradient(to bottom, transparent 0, var(--bg) 64px);
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 28px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--soft);
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.6s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.6s cubic-bezier(0.23, 1, 0.32, 1), transform 0.15s;
}
/* Same hover fill as .btn; the selected filter stays filled. */
.chip::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: calc(100% + 40px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1);
  pointer-events: none;
}
.chip:hover,
.chip[aria-pressed="true"] { color: var(--accent-fg); border-color: var(--blue); }
.chip:hover::before,
.chip[aria-pressed="true"]::before { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.chip:active { transform: scale(0.97); }
.chip .count { font-size: 12px; color: var(--faint); transition: color 0.6s cubic-bezier(0.23, 1, 0.32, 1); }
.chip:hover .count,
.chip[aria-pressed="true"] .count { color: inherit; opacity: 0.7; }
/* Only one blue chip at a time: hovering another chip unfills the selected one. */
.filters:has(.chip:not([aria-pressed="true"]):hover) .chip[aria-pressed="true"] {
  color: var(--fg);
  border-color: var(--border-strong);
}
.filters:has(.chip:not([aria-pressed="true"]):hover) .chip[aria-pressed="true"]::before {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
  transition-delay: 0s;
}
/* Short delay before the selected chip refills, so crossing the gap between chips doesn't flash it. */
.chip[aria-pressed="true"]::before { transition-delay: 0.12s; }
.filters:has(.chip:not([aria-pressed="true"]):hover) .chip[aria-pressed="true"] .count {
  color: var(--faint);
  opacity: 1;
}

.masonry {
  column-count: 1;
  column-gap: 16px;
}
@media (min-width: 640px)  { .masonry { column-count: 2; } }
@media (min-width: 1024px) { .masonry { column-count: 3; } }
@media (min-width: 1280px) { .masonry { column-count: 4; } }
@media (min-width: 1600px) { .masonry { column-count: 5; } }

.masonry > * {
  display: block;
  break-inside: avoid;
  margin-bottom: 16px;
}
.masonry > [hidden] { display: none; }

.feed-empty {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

/* Cards */
.card, .project {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover, .project:hover { border-color: var(--border-strong); }
.card-desc a, .post-text a { position: relative; z-index: 2; }

.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--stage);
  border-bottom: 1px solid var(--border);
}

/* Phone screenshot on a stage */
.card-media.phone {
  height: 380px;
  padding: 28px 0 0;
}
.card-media.phone img {
  width: 66%;
  margin: 0 auto;
  border-radius: 30px 30px 0 0;
  box-shadow: var(--shot-shadow), 0 0 0 1px var(--border);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .card-media.phone img { transform: translateY(-6px); }

.card-media.window { padding: 22px 18px; }
.card-media.window img {
  width: 100%;
  height: auto;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.card:hover .card-media.window img { transform: scale(1.015); }

/* Code-style cover for repos without screenshots */
.card-media.code {
  padding: 18px;
}
.code-window {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  overflow: hidden;
}
.code-window .bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.code-window .bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--soft-2);
}
.code-window pre {
  margin: 0;
  padding: 12px 14px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font: inherit;
}
.code-window .p { color: var(--faint); }
.code-window .c { color: var(--fg); }
.code-window .k { color: var(--lang, var(--link)); }

.card-body { padding: 16px 20px 20px; }

.card-org {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
}
.card-org img, .card-org .lang-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex: none;
}
.lang-mark {
  display: grid;
  place-items: center;
  background: var(--lang, var(--link));
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.card-title {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card-title .arrow {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.2s, color 0.2s;
}
.card:hover .card-title .arrow { color: var(--fg); transform: translate(2px, -2px); }

.card-desc {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.card-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 14px;
  color: var(--muted);
}
.card-meta .updated { width: 100%; font-size: 13px; color: var(--faint); }

.tag {
  position: relative;
  z-index: 2;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s;
}
.tag:hover { color: var(--fg); }

/* Post-style card */
.post { padding: 20px; }
.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.post-head .avatar {
  width: 40px;
  height: 40px;
  box-shadow: none;
}
.post-author { line-height: 1.25; }
.post-author b { display: block; font-size: 16px; font-weight: 600; }
.post-author span { font-size: 14px; color: var(--muted); }
.post-icon {
  margin-left: auto;
  width: 22px;
  height: 22px;
  color: var(--muted);
}
.post-text {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.55;
}
.post-text a { color: var(--link); }
.post-date {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}
.post .card-meta { margin-top: 6px; }

/* Feature card */
.feature {
  padding: 22px 20px 20px;
  border-color: transparent;
  background: var(--blue);
  color: #fff;
}
.feature:hover { border-color: transparent; }
.feature .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.feature .logo img { width: 100%; height: 100%; object-fit: cover; }
.feature h3 {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.feature p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
}
.feature h4 {
  margin: 20px 0 10px;
  font-size: 14px;
  font-weight: 500;
}
.checks { display: grid; gap: 8px; }
.checks li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
}
.checks svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.feature hr {
  margin: 20px 0 16px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}
.feature .fine { font-size: 14px; color: rgba(255, 255, 255, 0.85); }
.feature .fine b { color: #fff; font-weight: 600; }
.feature .cta {
  margin-top: 14px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.feature .cta:hover { opacity: 0.92; }

/* ── Inner pages ──────────────────────────────────────────────────── */
.page {
  flex: 1;
  padding-top: 80px;
  padding-bottom: 96px;
}
.page-narrow { max-width: 720px; }

.page .display { margin-top: 40px; }
.page .avatar + .display { margin-top: 40px; }
.page-head .display:first-child { margin-top: 0; }
.page .btn-row { margin-top: 32px; }

.section-block { margin-top: 72px; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title a { text-transform: none; letter-spacing: 0; font-size: 14px; }
.section-title a:hover { color: var(--fg); }

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.entry h3 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.entry .sub { margin-top: 2px; font-size: 15px; color: var(--muted); }
.entry .desc {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 62ch;
}
.entry .when {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.entry.kv { grid-template-columns: 150px 1fr; }
.entry.kv .k { font-size: 15px; color: var(--muted); }

.chips-static {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips-static span {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg);
}

.news-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.55;
}
.news-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.news-list a { color: var(--link); }

/* Projects page */
.project-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 900px) { .project-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1400px) { .project-grid { grid-template-columns: 1fr 1fr 1fr; } }
.project-grid > [hidden] { display: none; }
.project:target {
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 22%, transparent);
}

.project {
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.project-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.project-top .idx { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.project-top .when { margin-left: auto; font-variant-numeric: tabular-nums; }
.project-top img, .project-top .lang-mark { width: 28px; height: 28px; border-radius: 7px; }
.project h3 {
  margin-top: 16px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.project .tagline { margin-top: 4px; font-size: 14px; color: var(--muted); }
.project .desc {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.project .desc a { color: var(--link); }
.project .stack {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.project .stack span {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--soft-2);
  font-size: 12.5px;
  color: var(--fg);
}
.project-foot {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.project-foot .repo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12.5px;
}
.project-foot .repo-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.project-foot .repo-fact { margin-left: auto; color: var(--faint); }
.project-body { flex: 1; display: flex; flex-direction: column; }
.project-body > .project-foot { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 5;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.footer-inner {
  min-height: 84px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 20px;
  padding-bottom: 20px;
  font-size: 14px;
  color: var(--muted);
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.footer-links a { transition: color 0.15s; }
.footer-links a:hover { color: var(--fg); }
.footer-links svg { width: 16px; height: 16px; display: block; }

/* ── Motion ───────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (min-width: 900px) and (min-height: 720px) {
  .hero { position: sticky; top: 0; }
}

@media (max-width: 1100px) {
  .hero-stage { transform: translate(14%, -46%) rotateX(48deg) rotateZ(-32deg); }
}

@media (max-width: 899px) {
  .hero-visual { opacity: 0.35; }
  .hero-stage { left: 38%; }
  .hero::after {
    background:
      linear-gradient(to top, var(--bg) 0, transparent 30%),
      linear-gradient(90deg, var(--hero-bg) 0, color-mix(in srgb, var(--hero-bg) 70%, transparent) 100%);
  }
  .hero-inner { min-height: 0; padding-bottom: 72px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .hero-visual { display: none; }
  .hero-inner { padding-top: calc(var(--header-h) + 40px); }
  .display { margin-top: 28px; }
  .lede { font-size: 17px; line-height: 27px; }
  .social { margin-left: 0; }
  .site-nav a { padding: 0 10px; }
  .page { padding-top: 48px; }
  .entry { grid-template-columns: 1fr; }
  .entry .when { order: -1; font-size: 13px; }
  .entry.kv { grid-template-columns: 1fr; gap: 6px; }
  .news-list li { grid-template-columns: 1fr; gap: 2px; }
  .card-media.phone { height: 340px; }
}

@media (max-width: 420px) {
  .site-nav a { padding: 0 9px; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .btn-row { display: none !important; }
  body { background: #fff; color: #000; }
  .page { padding: 0; }
}
