/* ============================================================
   Aan Porto — Portfolio styles
   Foundations from Untitled UI tokens, themed for an off-white,
   minimal portfolio with a dark-mode toggle.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&display=swap");

:root {
  /* Untitled UI grays */
  --gray-25:  #fcfcfd;
  --gray-50:  #f9fafb;
  --gray-75:  #f4f5f7;
  --gray-100: #f2f4f7;
  --gray-150: #ebedf1;
  --gray-200: #e4e7ec;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --gray-950: #0c111d;

  /* Soft warm off-white palette (Jaime-ish) */
  --warm-50:  #f7f6f3;
  --warm-100: #efeeea;
  --warm-200: #e3e1db;
  --warm-300: #c9c7c0;

  /* Surfaces (light) */
  --bg-page:        var(--warm-50);
  --bg-elev:        #ffffff;
  --bg-card:        var(--warm-100);
  --bg-card-hover:  var(--warm-200);
  --bg-tag:         var(--warm-100);

  /* Text (light) */
  --fg-primary:   var(--gray-900);
  --fg-secondary: var(--gray-600);
  --fg-tertiary:  var(--gray-500);
  --fg-muted:     var(--gray-400);

  /* Borders */
  --border-soft:   rgba(16, 24, 40, 0.06);
  --border-medium: rgba(16, 24, 40, 0.10);

  /* Accent (the yellow sticky note) */
  --accent-yellow: #f3e25b;
  --accent-yellow-soft: #f9efa3;
  --link-blue: #2e6df0;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(16,24,40,0.04), 0 1px 1px rgba(16,24,40,0.03);
  --shadow-pop: 0 8px 24px -8px rgba(16,24,40,0.10), 0 4px 8px -4px rgba(16,24,40,0.06);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
}

/* Dark theme */
html[data-theme="dark"] {
  --warm-50:  #0e0e0c;
  --warm-100: #16161479;
  --warm-200: #1f1f1c;
  --warm-300: #2a2a26;

  --bg-page:       #0c0c0a;
  --bg-elev:       #141413;
  --bg-card:       #16161499;
  --bg-card-hover: #1c1c1a;
  --bg-tag:        #1c1c1a;

  --fg-primary:   #f4f3ef;
  --fg-secondary: #b6b3aa;
  --fg-tertiary:  #8c8980;
  --fg-muted:     #62605a;

  --border-soft:   rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.10);

  --accent-yellow: #ecd84a;
  --accent-yellow-soft: #4c4416;
  --link-blue: #7da8ff;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 1px 1px rgba(0,0,0,0.3);
  --shadow-pop: 0 8px 24px -8px rgba(0,0,0,0.50), 0 4px 8px -4px rgba(0,0,0,0.40);
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--fg-primary);
  background: var(--bg-page);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  transition: background-color 240ms ease, color 240ms ease;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, h5, p { margin: 0; }
::selection { background: var(--accent-yellow); color: var(--gray-900); }

/* Typography helpers */
.t-display-md { font-size: 38px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 500; }
.t-display-sm { font-size: 30px; line-height: 1.2; letter-spacing: -0.018em; font-weight: 500; }
.t-display-xs { font-size: 22px; line-height: 1.3; letter-spacing: -0.012em; font-weight: 500; }
.t-body-lg    { font-size: 18px; line-height: 1.55; }
.t-body       { font-size: 16px; line-height: 1.55; }
.t-body-sm    { font-size: 14.5px; line-height: 1.5; }
.t-caption    { font-size: 13px; line-height: 1.45; letter-spacing: 0; }
.t-mono       { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: 0.01em; }

.fg-primary   { color: var(--fg-primary); }
.fg-secondary { color: var(--fg-secondary); }
.fg-tertiary  { color: var(--fg-tertiary); }
.fg-muted     { color: var(--fg-muted); }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  width: 100%;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   Nav (centered pill) + theme toggle
   ============================================================ */
.nav-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 24px 8px;
  position: relative;
}
.pill-nav {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-full);
  padding: 4px;
  gap: 2px;
}
.pill-nav button {
  padding: 7px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-secondary);
  border-radius: var(--r-full);
  transition: background 160ms ease, color 160ms ease;
  white-space: nowrap;
}
.pill-nav button:hover { color: var(--fg-primary); }
.pill-nav button.active {
  background: var(--bg-elev);
  color: var(--fg-primary);
  box-shadow: var(--shadow-card);
}

.theme-toggle {
  position: absolute;
  right: 24px;
  top: 22px;
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-secondary);
  transition: background 160ms ease, color 160ms ease;
}
.theme-toggle:hover {
  background: var(--bg-card);
  color: var(--fg-primary);
}

/* Nav responsive — keep pill, just tighten on small screens */
@media (max-width: 720px) {
  .nav-wrap {
    padding: 16px 12px 4px;
    flex-direction: column;
    gap: 10px;
  }
  .theme-toggle {
    position: fixed;
    top: auto;
    right: auto;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: 16px;
    width: 38px;
    height: 38px;
    background: var(--bg-elev);
    border: 1px solid var(--border-soft);
    box-shadow:
      0 1px 2px rgba(16,24,40,0.06),
      0 4px 12px -4px rgba(16,24,40,0.10);
    z-index: 50;
  }
}
@media (max-width: 560px) {
  .pill-nav { padding: 3px; }
  .pill-nav button {
    padding: 6px 12px;
    font-size: 13px;
  }
}
@media (max-width: 400px) {
  .pill-nav button {
    padding: 6px 10px;
    font-size: 12.5px;
  }
}

/* ============================================================
   Hero (home)
   ============================================================ */
.hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 24px 64px;
}
.hero-avatar {
  margin-bottom: 28px;
}
.hero-avatar image-slot {
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
}
.hero .name {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg-primary);
  margin-bottom: 28px;
}
.hero p {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-secondary);
  margin-bottom: 18px;
}
.hero p strong { color: var(--fg-primary); font-weight: 500; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tag);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 2px 8px 2px 4px;
  margin: 0 1px;
  vertical-align: 0.04em;
  font-size: 15.5px;
  color: var(--fg-primary);
  font-weight: 500;
  transition: background 160ms ease;
}
.chip:hover { background: var(--bg-card-hover); }
.chip-glyph {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.chip-glyph svg { width: 12px; height: 12px; }

.btn-row {
  display: flex;
  gap: 6px;
  margin-top: 32px;
}
.btn {
  padding: 9px 18px;
  border-radius: var(--r-full);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fg-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  transition: background 160ms ease, transform 80ms ease;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:active { transform: scale(0.985); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-card);
}

/* ============================================================
   Project grid + card
   ============================================================ */
.projects-grid {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 24px 96px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 800px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

.project-card {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2xl);
  overflow: hidden;
  text-align: left;
  transition: background 200ms ease, transform 280ms ease, border-color 200ms ease;
  cursor: pointer;
}
.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}
.project-card .cover {
  aspect-ratio: 4/3;
  width: 100%;
  overflow: hidden;
  position: relative;
}
.project-card .cover > * {
  width: 100%; height: 100%;
  transition: transform 600ms cubic-bezier(.2,.8,.2,1);
}
.project-card:hover .cover > * { transform: scale(1.02); }
.project-card .meta {
  padding: 18px 22px 22px;
}
.project-card .meta .title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.project-card .meta .subtitle {
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--fg-tertiary);
}

/* ============================================================
   Project detail
   ============================================================ */
.detail {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}
.detail .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-tertiary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-full);
  transition: color 160ms ease, background 160ms ease;
  margin-bottom: 48px;
}
.detail .back:hover { color: var(--fg-primary); background: var(--bg-card); }

.detail-head {
  max-width: 640px;
  margin: 0 auto 56px;
  text-align: center;
}
.detail-head h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 500;
  margin-bottom: 16px;
  text-wrap: pretty;
}
.detail-head p {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--fg-tertiary);
  margin-bottom: 20px;
  text-wrap: pretty;
}
.detail-head .meta-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-tertiary);
  font-size: 14.5px;
}
.detail-head .meta-row .dot {
  width: 3px; height: 3px; border-radius: 50%; background: var(--fg-muted);
}
.detail-head .meta-row a {
  color: var(--link-blue);
}
.detail-head .meta-row a:hover { text-decoration: underline; }

.gallery-tray {
  background: var(--bg-card);
  border-radius: var(--r-2xl);
  padding: 32px;
  border: 1px solid var(--border-soft);
}
@media (max-width: 720px) {
  .gallery-tray { padding: 16px; }
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  align-items: start;
}
.gallery-tile {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
}
.gallery-tile.full { grid-column: span 6; }
.gallery-tile.half { grid-column: span 3; }
.gallery-tile.third { grid-column: span 2; }
@media (max-width: 720px) {
  .gallery-tile.half, .gallery-tile.third { grid-column: span 6; }
}
.gallery-tile > * { width: 100%; height: 100%; display:block; }

/* Case study sections */
.case-section {
  max-width: 720px;
  margin: 56px auto 0;
}
.case-section-wide {
  max-width: 920px;
  margin: 72px auto 0;
}
.case-section .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.case-section h3 {
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 500;
  margin-bottom: 16px;
  text-wrap: pretty;
}
.case-section p {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--fg-secondary);
  margin-bottom: 14px;
  text-wrap: pretty;
}
.case-section ul {
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg-secondary);
  padding-left: 20px;
  margin: 6px 0 14px;
}
.case-section li::marker { color: var(--fg-muted); }
.case-section li { margin-bottom: 4px; }

/* Callout inline note */
.cs-callout {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--fg-primary);
  border-radius: var(--r-sm);
  padding: 18px 20px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-secondary);
}

/* Approach 3-up grid */
.approach-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.approach-cell {
  padding: 28px 26px;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.approach-cell:last-child { border-right: none; }
.approach-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}
.approach-cell ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fg-tertiary);
}
.approach-cell li { margin-bottom: 6px; }
@media (max-width: 760px) {
  .approach-grid { grid-template-columns: 1fr; }
  .approach-cell { border-right: none; border-bottom: 1px solid var(--border-soft); }
  .approach-cell:last-child { border-bottom: none; }
}

/* Version timeline */
.versions { margin-top: 24px; }
.version-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 32px;
  padding: 36px 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
}
.version-row:last-child { border-bottom: none; }
.version-tag-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 6px;
}
.version-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-primary);
}
.version-year {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}
.version-title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--fg-primary);
  margin-bottom: 10px;
}
.version-desc {
  font-size: 15.5px !important;
  line-height: 1.65 !important;
  color: var(--fg-secondary);
  margin-bottom: 14px !important;
}
.version-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.version-chip {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--fg-tertiary);
}
.version-chip.problem {
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.15);
  color: #b53a2b;
}
html[data-theme="dark"] .version-chip.problem {
  background: rgba(240, 100, 80, 0.10);
  color: #f08c7a;
}
.version-chip.solution {
  background: rgba(20, 130, 90, 0.08);
  border-color: rgba(20, 130, 90, 0.18);
  color: #1f8a5b;
}
html[data-theme="dark"] .version-chip.solution {
  background: rgba(60, 200, 140, 0.10);
  color: #59d49c;
}
@media (max-width: 600px) {
  .version-row { grid-template-columns: 64px 1fr; gap: 16px; }
}

/* Feature grid (2 col) */
.feature-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-elev);
}
.feature-cell {
  padding: 26px 26px 28px;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feature-cell:nth-child(2n) { border-right: none; }
.feature-cell:nth-last-child(-n+2) { border-bottom: none; }
.feature-num {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 2px;
}
.feature-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
  line-height: 1.35;
  margin-bottom: 4px;
}
.feature-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--fg-tertiary);
}
@media (max-width: 700px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-cell { border-right: none !important; }
  .feature-cell:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
}

/* Stats horizontal grid */
.stats-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.stat-cell {
  padding: 22px 0 0;
  border-top: 1px solid var(--border-soft);
}
.stat-value {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--fg-primary);
  line-height: 1;
  margin-bottom: 12px;
}
.stat-label {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-tertiary);
}
@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Callouts 2-up */
.callouts-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.callout-cell {
  padding: 22px 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.callout-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.callout-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
  margin-bottom: 8px;
}
.callout-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--fg-tertiary);
}
@media (max-width: 700px) {
  .callouts-grid { grid-template-columns: 1fr; }
}

/* Principles (numbered) */
.principles { margin-top: 24px; border-top: 1px solid var(--border-soft); }
.principle-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 28px;
  padding: 32px 0;
  border-bottom: 1px solid var(--border-soft);
}
.principle-num {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding-top: 5px;
}
.principle-title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--fg-primary);
  margin-bottom: 8px;
  line-height: 1.35;
}
.principle-text {
  font-size: 15.5px !important;
  line-height: 1.65 !important;
  color: var(--fg-secondary);
  margin-bottom: 12px !important;
}
.principle-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.principle-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--fg-tertiary);
}
@media (max-width: 600px) {
  .principle-row { grid-template-columns: 1fr; gap: 12px; }
}

/* Metrics (outcome) */
.metric-section {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2xl);
  padding: 48px 40px;
}
.metric-section h3 { margin-bottom: 12px; }
.metrics-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}
.metric-cell {
  background: var(--bg-elev);
  padding: 28px 24px;
}
.metric-value {
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--fg-primary);
  line-height: 1;
  margin-bottom: 10px;
}
.metric-label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-tertiary);
}
@media (max-width: 760px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-section { padding: 32px 24px; }
}

/* Team grid */
.team-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}
.team-cell {
  padding: 28px 26px;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-elev);
}
.team-cell:last-child { border-right: none; }
.team-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 10px;
}
.team-name {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--fg-primary);
  margin-bottom: 4px;
}
.team-title {
  font-size: 13.5px;
  color: var(--fg-tertiary);
  margin-bottom: 18px;
}
.team-cell ul {
  margin: 0;
  padding-left: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--fg-tertiary);
}
.team-cell li { margin-bottom: 6px; }
@media (max-width: 760px) {
  .team-grid { grid-template-columns: 1fr; }
  .team-cell { border-right: none; border-bottom: 1px solid var(--border-soft); }
  .team-cell:last-child { border-bottom: none; }
}

/* Detail pills */
.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
}
.detail-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--fg-tertiary);
  letter-spacing: 0.02em;
}

/* Next project */
.next-project {
  max-width: 720px;
  margin: 80px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.next-project .label {
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.next-project .title {
  font-size: 18px;
  font-weight: 500;
  color: var(--fg-primary);
}

/* ============================================================
   About
   ============================================================ */
.about {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  padding: 80px 24px 96px;
}
.about-avatar {
  width: 124px;
  height: 124px;
  border-radius: var(--r-full);
  margin: 0 auto 32px;
  background: var(--gray-900);
  display: grid;
  place-items: center;
  color: white;
  overflow: hidden;
}
html[data-theme="dark"] .about-avatar { background: var(--warm-200); }
.about h2 {
  font-size: 25px;
  line-height: 1.32;
  letter-spacing: -0.015em;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: 32px;
  text-wrap: pretty;
}
.about p {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--fg-tertiary);
  margin-bottom: 22px;
  text-wrap: pretty;
}
.about .cta-row { margin: 28px 0; display: flex; gap: 8px; justify-content: center; }

/* ============================================================
   Writing — list + detail (Steph Ango style)
   ============================================================ */
.writing {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}
.writing-head {
  margin-bottom: 56px;
}
.writing-head h1 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg-primary);
  margin-bottom: 14px;
}
.writing-head p {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--fg-tertiary);
  max-width: 540px;
}
.writing-year {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 24px;
  align-items: start;
  padding: 14px 0;
}
.writing-year-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: 0.02em;
  padding-top: 14px;
  position: sticky;
  top: 88px;
}
.writing-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.writing-rows li {
  border-bottom: 1px solid var(--border-soft);
}
.writing-rows li:last-child { border-bottom: none; }
.writing-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 0;
  text-align: left;
  color: var(--fg-primary);
  transition: color 140ms ease;
}
.writing-row:hover { color: var(--fg-primary); }
.writing-row:hover .writing-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.writing-thumb {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
}
.writing-title {
  font-size: 16px;
  line-height: 1.4;
  color: var(--fg-primary);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.writing-date {
  font-size: 13.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .writing-year { grid-template-columns: 48px 1fr; gap: 12px; }
  .writing-year-label { position: static; }
  .writing-row { grid-template-columns: 20px 1fr auto; gap: 10px; }
  .writing-title { font-size: 15px; }
  .writing-date { font-size: 12.5px; }
}

/* Post detail */
.post {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}
.post .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-tertiary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-full);
  transition: color 160ms ease, background 160ms ease;
  margin-bottom: 40px;
}
.post .back:hover { color: var(--fg-primary); background: var(--bg-card); }
.post-head { margin-bottom: 32px; }
.post-date {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}
.post-head h1 {
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.022em;
  font-weight: 500;
  margin-bottom: 14px;
  text-wrap: balance;
}
.post-summary {
  font-size: 18px;
  line-height: 1.55;
  color: var(--fg-tertiary);
  text-wrap: pretty;
}
.post-cover {
  width: 100%;
  aspect-ratio: 16/10;
  margin-bottom: 40px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 30% 40%, color-mix(in oklab, var(--cover-accent) 28%, var(--bg-card)), var(--bg-card));
  overflow: hidden;
  position: relative;
}
.post-cover image-slot {
  width: 100%;
  height: 100%;
}
.post-body {
  font-size: 18px;
  line-height: 1.75;
  color: var(--fg-secondary);
}
.post-body p {
  font-size: 18px !important;
  line-height: 1.75 !important;
  color: var(--fg-secondary);
  margin-bottom: 22px !important;
  text-wrap: pretty;
}
.post-body h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 500;
  color: var(--fg-primary);
  margin: 36px 0 14px;
}
.post-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--fg-muted);
  color: var(--fg-primary);
  font-style: italic;
  font-size: 18px;
}

/* Related writing block at the bottom of a post */
.related-writing {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--border-soft);
}
.related-head { margin-bottom: 8px; }
.related-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* Post nav (prev / next) */
.post-nav {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--border-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.post-nav-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background 160ms ease;
}
.post-nav-row:hover { background: var(--bg-card); }
.post-nav-row.align-right {
  text-align: right;
  align-items: flex-end;
}
.post-nav-row .label {
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.post-nav-row .title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-primary);
  letter-spacing: -0.005em;
}
@media (max-width: 540px) {
  .post-head h1 { font-size: 28px; }
  .post-body { font-size: 17px; }
  .post-body p { font-size: 17px !important; }
}

/* ============================================================
   Visuals — moodboard grid
   ============================================================ */
.visuals {
  max-width: 1400px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}
.visuals-head {
  max-width: 540px;
  margin: 0 auto 56px;
  text-align: center;
}
.visuals-head h1 {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg-primary);
  margin-bottom: 12px;
}
.visuals-head p {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-tertiary);
}
.visuals-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  column-gap: 24px;
  row-gap: 56px;
}
@media (max-width: 1200px) { .visuals-grid { grid-template-columns: repeat(4, 1fr); column-gap: 20px; row-gap: 44px; } }
@media (max-width: 760px)  { .visuals-grid { grid-template-columns: repeat(3, 1fr); column-gap: 16px; row-gap: 36px; } }
@media (max-width: 500px)  { .visuals-grid { grid-template-columns: repeat(2, 1fr); column-gap: 14px; row-gap: 28px; } }
.visual-tile {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.visual-image {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
.visual-tile:hover .visual-image { transform: translateY(-2px); }
.visual-image image-slot {
  width: 100%;
  height: 100%;
}
.visual-caption {
  margin-top: 14px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--fg-tertiary);
  letter-spacing: 0;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 32px 24px 40px;
  margin-top: auto;
}
.site-footer .inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .copyright {
  font-size: 13.5px;
  color: var(--fg-muted);
}
.site-footer .socials {
  display: flex;
  gap: 4px;
}
.site-footer .socials a {
  width: 34px; height: 34px;
  border-radius: var(--r-full);
  display: inline-grid;
  place-items: center;
  color: var(--fg-tertiary);
  transition: background 160ms, color 160ms;
}
.site-footer .socials a:hover {
  background: var(--bg-card);
  color: var(--fg-primary);
}

/* ============================================================
   Floating Contact button (bottom-right, plain pill)
   ============================================================ */
.contact-tab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  color: var(--fg-primary);
  padding: 9px 14px 9px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  box-shadow:
    0 1px 2px rgba(16,24,40,0.06),
    0 4px 12px -4px rgba(16,24,40,0.10);
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease, box-shadow 200ms ease;
}
.contact-tab:hover {
  background: var(--bg-card);
  box-shadow:
    0 1px 2px rgba(16,24,40,0.08),
    0 8px 20px -6px rgba(16,24,40,0.14);
}
.contact-tab:active { transform: translateY(1px); }
.contact-tab svg { color: var(--fg-secondary); }

/* Contact popover */
.contact-popover {
  position: fixed;
  bottom: 72px;
  right: 20px;
  z-index: 60;
  width: 320px;
  background: var(--bg-elev);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-pop);
  padding: 18px;
  animation: pop 220ms cubic-bezier(.2,.8,.2,1);
  transform-origin: bottom right;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.contact-popover h4 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}
.contact-popover p {
  font-size: 13.5px;
  color: var(--fg-tertiary);
  margin-bottom: 14px;
}
.contact-popover .row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-popover .row a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--fg-primary);
  transition: background 140ms ease;
}
.contact-popover .row a:hover { background: var(--bg-card); }
.contact-popover .row a .label { flex: 1; }
.contact-popover .row a .v { color: var(--fg-tertiary); font-size: 13px; }

/* ============================================================
   Page transitions
   ============================================================ */
.page-enter {
  animation: pageIn 360ms cubic-bezier(.2,.7,.2,1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stagger > * { opacity: 0; animation: rise 520ms cubic-bezier(.2,.7,.2,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: 40ms; }
.stagger > *:nth-child(2) { animation-delay: 120ms; }
.stagger > *:nth-child(3) { animation-delay: 200ms; }
.stagger > *:nth-child(4) { animation-delay: 280ms; }
.stagger > *:nth-child(5) { animation-delay: 360ms; }
.stagger > *:nth-child(6) { animation-delay: 440ms; }
.stagger > *:nth-child(7) { animation-delay: 520ms; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* tweak panel layering */
[data-tweaks-panel] { z-index: 80; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Mobile polish — bundle of small responsive tweaks
   ============================================================ */
@media (max-width: 720px) {
  /* Hero */
  .hero { padding: 48px 20px 40px; }
  .hero .name { font-size: 16px; margin-bottom: 22px; }
  .hero p { font-size: 16px; margin-bottom: 16px; }
  .hero-avatar { margin-bottom: 22px; }
  .chip { font-size: 14.5px; padding: 2px 8px 2px 4px; }

  /* Projects grid */
  .projects-grid { padding: 4px 20px 64px; gap: 14px; }
  .project-card { border-radius: 18px; }
  .project-card .meta { padding: 16px 18px 20px; }
  .project-card .meta .title { font-size: 15.5px; }
  .project-card .meta .subtitle { font-size: 14px; }

  /* About */
  .about { padding: 56px 20px 72px; }
  .about-avatar { width: 96px; height: 96px; margin-bottom: 26px; }
  .about h2 { font-size: 22px; line-height: 1.32; margin-bottom: 24px; }
  .about p { font-size: 16px; }

  /* Detail */
  .detail { padding: 24px 20px 72px; }
  .detail .back { margin-bottom: 28px; }
  .detail-head { margin-bottom: 36px; }
  .detail-head h1 { font-size: 24px; }
  .detail-head p { font-size: 15.5px; }
  .detail-head .meta-row {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    font-size: 13.5px;
  }
  .detail-pills { gap: 4px; margin-bottom: 16px; }
  .detail-pill { font-size: 10.5px; padding: 3px 8px; }
  .gallery-tray { padding: 12px; border-radius: 18px; }
  .gallery-grid { gap: 10px; }

  /* Case study sections */
  .case-section,
  .case-section-wide { margin: 40px auto 0; padding: 0 4px; }
  .case-section h3 { font-size: 22px; }
  .case-section p { font-size: 15.5px; }
  .case-section ul { font-size: 15px; }
  .approach-cell { padding: 22px 20px; }
  .feature-cell { padding: 22px 20px; }
  .version-row { padding: 28px 0; }
  .principle-row { padding: 26px 0; }
  .principle-title { font-size: 17px; }
  .version-title { font-size: 17px; }
  .stat-value { font-size: 30px; }
  .metric-section { padding: 28px 20px; border-radius: 18px; }
  .metric-value { font-size: 32px; }
  .metric-cell { padding: 22px 18px; }
  .team-cell { padding: 22px 20px; }

  .next-project {
    margin-top: 56px;
    padding-top: 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .next-project .title { font-size: 16.5px; }

  /* Writing */
  .writing { padding: 40px 20px 72px; }
  .writing-head { margin-bottom: 36px; }
  .writing-head p { font-size: 15.5px; }

  /* Post */
  .post { padding: 24px 20px 72px; }
  .post .back { margin-bottom: 24px; }
  .post-head { margin-bottom: 24px; }
  .post-cover { aspect-ratio: 4/3; margin-bottom: 28px; border-radius: 12px; }
  .related-writing { margin-top: 48px; padding-top: 22px; }

  /* Visuals */
  .visuals { padding: 36px 20px 72px; }
  .visuals-head { margin-bottom: 36px; }

  /* Footer */
  .site-footer { padding: 24px 20px 32px; }
  .site-footer .inner { gap: 12px; flex-direction: column; align-items: flex-start; }

  /* Floating Contact button — smaller on mobile, safe-area aware */
  .contact-tab {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    right: 16px;
    padding: 8px 12px 8px 10px;
    font-size: 13.5px;
    border-radius: 9px;
  }
  /* Popover positioning + size */
  .contact-popover {
    bottom: 64px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: 360px;
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .hero { padding: 36px 18px 32px; }
  .hero p { font-size: 15.5px; }
  .detail-head h1 { font-size: 21px; }
  .post-head h1 { font-size: 25px; }
  .post-body { font-size: 16.5px; }
  .post-body p { font-size: 16.5px !important; line-height: 1.7 !important; }
  .visuals-grid { row-gap: 24px; }
  .visual-caption { font-size: 10.5px; }
}
