/* ==========================================================================
   Nayan Bhut — portfolio
   One stylesheet, no framework, no build step beyond Jekyll.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --bg: #fbfbfd;
  --bg-elev: #ffffff;
  --surface: #f5f5f7;
  --surface-2: #ececef;
  --text: #1d1d1f;
  --text-soft: #424245;
  --muted: #6e6e73;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.18);

  --accent: #0a4dbf;
  --accent-hover: #083c96;
  --accent-soft: rgba(10, 77, 191, 0.08);
  --btn-bg: #1d1d1f;
  --btn-fg: #ffffff;
  --btn-hover: #000000;

  --ok: #0a6f45;
  --ok-bg: rgba(10, 111, 69, 0.09);
  --warn: #7a5200;
  --warn-bg: rgba(196, 130, 0, 0.14);

  --header-bg: rgba(251, 251, 253, 0.72);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 20px 40px -28px rgba(0, 0, 0, 0.35);
  --shadow-menu: 0 24px 48px -20px rgba(0, 0, 0, 0.25);

  --radius: 22px;
  --wrap: 1120px;
  --header-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --font: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-elev: #0c0c0e;
  --surface: #151518;
  --surface-2: #1e1e22;
  --text: #f5f5f7;
  --text-soft: #d2d2d7;
  --muted: #98989f;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.24);

  --accent: #8ab4ff;
  --accent-hover: #b3ccff;
  --accent-soft: rgba(138, 180, 255, 0.12);
  --btn-bg: #f5f5f7;
  --btn-fg: #111113;
  --btn-hover: #ffffff;

  --ok: #5ee0a0;
  --ok-bg: rgba(94, 224, 160, 0.12);
  --warn: #f0c674;
  --warn-bg: rgba(240, 198, 116, 0.13);

  --header-bg: rgba(0, 0, 0, 0.7);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 24px 48px -28px rgba(0, 0, 0, 0.9);
  --shadow-menu: 0 24px 48px -20px rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #000000;
    --bg-elev: #0c0c0e;
    --surface: #151518;
    --surface-2: #1e1e22;
    --text: #f5f5f7;
    --text-soft: #d2d2d7;
    --muted: #98989f;
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.24);

    --accent: #8ab4ff;
    --accent-hover: #b3ccff;
    --accent-soft: rgba(138, 180, 255, 0.12);
    --btn-bg: #f5f5f7;
    --btn-fg: #111113;
    --btn-hover: #ffffff;

    --ok: #5ee0a0;
    --ok-bg: rgba(94, 224, 160, 0.12);
    --warn: #f0c674;
    --warn-bg: rgba(240, 198, 116, 0.13);

    --header-bg: rgba(0, 0, 0, 0.7);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 24px 48px -28px rgba(0, 0, 0, 0.9);
    --shadow-menu: 0 24px 48px -20px rgba(0, 0, 0, 0.8);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

svg {
  display: block;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0 0 1em;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-wrap: balance;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

[hidden] {
  display: none !important;
}

[id] {
  scroll-margin-top: calc(var(--header-h) + 28px);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.wrap-narrow {
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus-visible {
  transform: none;
}

/* --------------------------------------------------------------------------
   3. Type helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  max-width: 62ch;
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
  color: var(--muted);
}

.section {
  padding-block: clamp(64px, 9vw, 112px);
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  border-top: 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(32px, 5vw, 52px);
}

.section-head h2 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  margin-bottom: 14px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.text-accent {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   4. Buttons, chips, status
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
    color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn .icon {
  width: 1.05em;
  height: 1.05em;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn-secondary {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text);
}

.btn-tertiary {
  background: var(--surface);
  border-color: transparent;
  color: var(--text);
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
}

.btn-quiet {
  color: var(--muted);
  border-color: var(--border);
  background: transparent;
}

@media (hover: hover) {
  .btn-primary:hover {
    background: var(--btn-hover);
    transform: translateY(-1px);
  }

  .btn-secondary:hover,
  .btn-tertiary:hover {
    background: var(--surface);
    transform: translateY(-1px);
  }

  .btn-quiet:hover {
    background: var(--surface);
    color: var(--text);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

@media (hover: hover) {
  .icon-btn:hover {
    background: var(--surface);
    color: var(--text);
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.chips li {
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.015em;
  line-height: 1.5;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-live {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-dev {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-oss {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   5. Header and navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--bg);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-inline: auto;
}

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav a:hover {
  color: var(--text);
}

.nav a.is-active {
  color: var(--text);
  background: var(--surface);
}

.nav a[aria-current="page"] {
  color: var(--text);
}

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

.header-resume {
  margin-right: 4px;
}

.theme-icon {
  display: block;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-icon-moon {
    display: none;
  }
}

.nav-icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .nav-icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .nav-icon-close {
  display: block;
}

.mobile-nav {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 90;
  padding: 8px clamp(20px, 5vw, 40px) 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-menu);
  animation: menu-in 0.18s var(--ease) both;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.mobile-nav nav {
  display: flex;
  flex-direction: column;
}

.mobile-nav nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  font-weight: 500;
}

.mobile-num {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.mobile-nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.mobile-nav-actions .btn {
  width: 100%;
}

/* --------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(48px, 7vw, 88px) clamp(44px, 6vw, 76px);
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: -240px;
  left: 50%;
  width: min(1100px, 130vw);
  height: 620px;
  transform: translateX(-50%);
  background:
    radial-gradient(46% 52% at 38% 40%, var(--accent-soft), transparent 70%),
    radial-gradient(36% 46% at 72% 28%, rgba(120, 90, 255, 0.09), transparent 72%);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  z-index: 1;
}

.hero-inner {
  max-width: 900px;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

.pulse-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #22a06b;
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(34, 160, 107, 0.5);
  animation: pulse 2.6s var(--ease) infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.8;
  }
  70%,
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.85rem, 8.4vw, 5.1rem);
  font-weight: 680;
  letter-spacing: -0.052em;
  line-height: 0.97;
}

.hero-role {
  margin: 0 0 18px;
  font-size: clamp(1.3rem, 2.8vw, 1.75rem);
  font-weight: 550;
  letter-spacing: -0.028em;
  line-height: 1.25;
}

.hero-role .sep {
  margin-inline: 0.45em;
  color: var(--border-strong);
  font-weight: 400;
}

.hero-role .role-stack {
  color: var(--muted);
  font-weight: 450;
}

.hero-pitch {
  max-width: 62ch;
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 1.7vw, 1.17rem);
  line-height: 1.62;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(26px, 3.5vw, 34px);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 3vw, 28px);
  margin: clamp(34px, 5vw, 52px) 0 0;
  padding-top: clamp(20px, 3vw, 28px);
  border-top: 1px solid var(--border);
}

.hero-stat {
  min-width: 0;
}

.hero-stat + .hero-stat {
  padding-left: clamp(14px, 3vw, 28px);
  border-left: 1px solid var(--border);
}

.hero-stat dt {
  margin: 0 0 4px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.hero-stat dd {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.68rem, 1.4vw, 0.78rem);
  line-height: 1.4;
  letter-spacing: 0.015em;
}

/* --------------------------------------------------------------------------
   7. About
   -------------------------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.about-copy p {
  color: var(--text-soft);
  font-size: 1.03rem;
  line-height: 1.72;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.about-copy strong {
  color: var(--text);
  font-weight: 600;
}

.facts {
  padding: 8px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.facts dl {
  margin: 0;
}

.facts-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.facts-row:first-child {
  border-top: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.8;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
}

.toolbox {
  margin-top: clamp(36px, 5vw, 52px);
  display: grid;
  gap: 14px;
}

.toolbox-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.toolbox-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.9;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   8. Experience
   -------------------------------------------------------------------------- */
.timeline {
  display: grid;
  gap: 16px;
  list-style: none;
}

.job {
  padding: clamp(22px, 3.4vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 20px;
  margin-bottom: 6px;
}

.job-title {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.24rem);
  letter-spacing: -0.022em;
}

.job-company {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.94rem;
}

.job-company .dot {
  margin-inline: 0.55em;
  color: var(--border-strong);
}

.job-dates {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.job ul {
  display: grid;
  gap: 8px;
  max-width: 78ch;
  list-style: none;
}

.job li {
  position: relative;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 0.93rem;
  line-height: 1.6;
}

.job li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

.job a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.job-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   9. Projects
   -------------------------------------------------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 318px), 1fr));
  gap: 16px;
  list-style: none;
}

.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
  }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.card-kind {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.project-card h3 {
  margin: 0 0 8px;
  font-size: 1.16rem;
  letter-spacing: -0.022em;
  line-height: 1.25;
}

.project-card h3 a:hover {
  color: var(--accent);
}

.project-card p {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 0.89rem;
  line-height: 1.6;
}

.project-card .chips {
  margin-bottom: 20px;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: auto;
  padding-top: 4px;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.card-links a .icon {
  width: 0.95em;
  height: 0.95em;
  transition: transform 0.2s var(--ease);
}

@media (hover: hover) {
  .card-links a:hover .icon {
    transform: translate(2px, -2px);
  }
}

.more-projects {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.9rem;
}

.more-projects a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   10. Open source
   -------------------------------------------------------------------------- */
.oss-list {
  display: grid;
  gap: 14px;
  list-style: none;
}

.oss-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 28px;
  align-items: start;
  padding: clamp(22px, 3.4vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

@media (hover: hover) {
  .oss-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
  }
}

.oss-repo {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.oss-card h3 {
  margin: 0 0 8px;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.oss-card h3 a:hover {
  color: var(--accent);
}

.oss-card p {
  max-width: 68ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.6;
}

.oss-card code {
  padding: 0.1em 0.32em;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86em;
}

.oss-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  height: 100%;
}

.oss-side .read-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.oss-note {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   11. Contact
   -------------------------------------------------------------------------- */
.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 56px);
  padding: clamp(26px, 5vw, 56px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(70% 120% at 0% 0%, var(--accent-soft), transparent 60%),
    var(--bg-elev);
}

.contact-card h2 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.4vw, 3rem);
  letter-spacing: -0.045em;
}

.contact-card .contact-lede {
  max-width: 46ch;
  margin-bottom: 26px;
  color: var(--text-soft);
  font-size: 1rem;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.email-link {
  font-size: clamp(0.98rem, 2.2vw, 1.22rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.email-link:hover {
  color: var(--accent);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.copy-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.copy-btn .icon {
  width: 14px;
  height: 14px;
}

.copy-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--ok);
  font-size: 0.78rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s var(--ease);
}

.contact-link span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.contact-link .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.contact-link .arrow {
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

@media (hover: hover) {
  .contact-link:hover {
    color: var(--accent);
  }

  .contact-link:hover .arrow {
    transform: translate(2px, -2px);
  }
}

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding-block: 44px 30px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.footer-brand p {
  max-width: 34ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.74rem;
}

.footer-meta p {
  margin: 0;
}

.back-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.back-top:hover {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   13. Generic page, case study and blog
   -------------------------------------------------------------------------- */
.page-head {
  padding-block: clamp(48px, 7vw, 76px) clamp(24px, 4vw, 36px);
  border-bottom: 1px solid var(--border);
}

.page-head h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.4rem);
  letter-spacing: -0.045em;
}

.page-lede {
  max-width: 66ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.page-body {
  padding-block: clamp(36px, 5vw, 56px) clamp(56px, 8vw, 96px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.back-link:hover {
  color: var(--text);
}

.prose {
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1.01rem;
  line-height: 1.75;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 2.1em 0 0.55em;
  color: var(--text);
  font-size: clamp(1.3rem, 2.6vw, 1.55rem);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.prose h3 {
  margin: 1.7em 0 0.45em;
  color: var(--text);
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.prose p {
  margin: 0 0 1.2em;
}

.prose ul,
.prose ol {
  margin: 0 0 1.3em;
  padding-left: 1.25em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose li::marker {
  color: var(--muted);
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--accent-hover);
}

.prose strong {
  color: var(--text);
  font-weight: 650;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 1.05rem;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.14em 0.38em;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.86em;
}

.prose pre {
  margin: 1.5em 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: #0d0d10;
  color: #e8e8ed;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 1em;
}

.prose table {
  display: block;
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  overflow-x: auto;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose .callout {
  margin: 1.6em 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 0.94rem;
}

.prose .callout p:last-child {
  margin-bottom: 0;
}

/* Case study */
.work-hero {
  padding-block: clamp(32px, 5vw, 52px) clamp(32px, 5vw, 48px);
  border-bottom: 1px solid var(--border);
}

.work-hero .eyebrow {
  margin-top: 4px;
}

.work-hero h1 {
  max-width: 20ch;
  font-size: clamp(2.35rem, 6.4vw, 4.1rem);
  letter-spacing: -0.036em;
  line-height: 1;
}

@media (max-width: 620px) {
  .work-hero h1 {
    letter-spacing: -0.028em;
  }
}

.work-summary {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 1.8vw, 1.16rem);
  line-height: 1.6;
}

.work-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  max-width: 800px;
  margin: 30px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.work-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.work-meta dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.45;
}

.work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.work-chips {
  margin-top: 22px;
}

.work-body {
  padding-block: clamp(32px, 5vw, 56px);
}

.work-body > h2:first-child {
  margin-top: 0;
}

.work-next {
  padding-block: 28px clamp(56px, 8vw, 90px);
  border-top: 1px solid var(--border);
}

.work-next a {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}

.work-next .eyebrow {
  margin: 0;
}

.work-next-title {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.work-next a:hover .work-next-title {
  color: var(--accent);
}

/* Blog */
.post-head {
  padding-block: clamp(40px, 6vw, 64px) clamp(22px, 3vw, 32px);
  border-bottom: 1px solid var(--border);
}

.post-head .eyebrow {
  margin-bottom: 12px;
}

.post-head h1 {
  font-size: clamp(2.05rem, 5.4vw, 3.2rem);
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.post-lede {
  max-width: 64ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.post .prose {
  padding-top: clamp(30px, 4vw, 44px);
}

.post-footer {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

.post-footer a {
  color: var(--accent);
}

.post-footer .back-link {
  margin: 14px 0 0;
}

.blog-list {
  list-style: none;
  max-width: 800px;
}

.blog-item {
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.blog-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.blog-item time {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.blog-item h2 {
  margin: 6px 0 6px;
  font-size: clamp(1.2rem, 2.6vw, 1.4rem);
  letter-spacing: -0.025em;
}

.blog-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.blog-item h2 a:hover {
  color: var(--accent);
}

.blog-item p {
  max-width: 66ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.blog-empty {
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  color: var(--muted);
}

/* 404 */
.error-page {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding-block: 64px;
  text-align: center;
}

.error-page .error-code {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.error-page h1 {
  margin: 12px 0 14px;
  font-size: clamp(2.4rem, 7vw, 4rem);
}

.error-page p {
  max-width: 44ch;
  margin: 0 auto 26px;
  color: var(--muted);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   14. Motion (never hides content; layout space is reserved)
   -------------------------------------------------------------------------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.js [data-reveal].is-in:nth-child(2) {
  transition-delay: 0.05s;
}

.js [data-reveal].is-in:nth-child(3) {
  transition-delay: 0.1s;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .pulse-dot::after {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .nav a {
    padding-inline: 10px;
  }
}

@media (max-width: 960px) {
  .nav {
    display: none;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .header-github {
    display: none;
  }

  .header-actions {
    gap: 2px;
  }
}

@media (min-width: 961px) {
  .nav-toggle {
    display: none;
  }
}

@media (max-width: 800px) {
  .about-grid,
  .contact-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
  }

  .oss-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .oss-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 620px) {
  :root {
    --header-h: 58px;
  }

  .header-resume {
    display: none;
  }

  .hero {
    padding-top: 38px;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 13.5vw, 3.4rem);
  }

  .hero-role {
    font-size: 1.16rem;
  }

  .hero-role .sep {
    margin-inline: 0.3em;
  }

  .hero-actions .btn {
    min-height: 43px;
    padding-inline: 16px;
    font-size: 0.875rem;
  }

  .hero-stats {
    gap: 10px;
  }

  .hero-stat + .hero-stat {
    padding-left: 12px;
  }

  .hero-stat dt {
    font-size: 1.28rem;
  }

  .hero-stat dd {
    font-size: 0.65rem;
  }

  .toolbox-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .toolbox-label {
    line-height: 1.5;
  }

  .job {
    padding: 20px;
  }

  .job-dates {
    width: 100%;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-nav-actions {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 20px;
  }

  .footer-meta {
    flex-direction: row;
  }

  .work-meta {
    margin-top: 24px;
  }
}

@media (max-width: 350px) {
  .brand-name {
    display: none;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-actions .btn {
    padding-inline: 14px;
  }

  .facts {
    padding-inline: 16px;
  }

  .facts-row {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}

/* --------------------------------------------------------------------------
   16. Print
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .hero-actions,
  .work-actions,
  .work-next,
  .skip-link,
  .copy-btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .section,
  .job,
  .project-card,
  .oss-card {
    break-inside: avoid;
    border-color: #ccc;
  }

  a {
    text-decoration: none;
    color: #000;
  }
}
