/* ==========================================================================
   Vinod Kumar Pujari · Portfolio
   "Editorial meets API docs": warm paper, ink, hairlines, one amber accent.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
  /* Type */
  --font-display: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --step--2: clamp(0.72rem, 0.7rem + 0.1vw, 0.78rem);
  --step--1: clamp(0.84rem, 0.8rem + 0.15vw, 0.92rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.13rem, 1.05rem + 0.4vw, 1.35rem);
  --step-2: clamp(1.4rem, 1.2rem + 1vw, 1.9rem);
  --step-3: clamp(1.85rem, 1.4rem + 1.6vw, 2.6rem);
  --step-4: clamp(2.3rem, 1.6rem + 3.4vw, 4.25rem);

  /* Space & layout */
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 2.5rem);
  --maxw: 75rem;
  --nav-h: 4rem;
  --section-pad: clamp(3.5rem, 2.4rem + 4.4vw, 6.5rem);
  --radius: 6px;
  --radius-sm: 4px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Light theme (primary) */
  color-scheme: light;
  --bg: #F8FAFC;
  --bg-raised: #FFFFFF;
  --bg-sunken: #F1F5F9;
  --ink: #0F172A;
  --ink-muted: #3D4A5E;
  --ink-faint: #4F5F76;
  --rule: #E2E8F0;
  --rule-strong: #CBD5E1;
  --accent: #2563EB;            /* decoration + large numerals (3:1) */
  --accent-text: #1D4ED8;       /* small accent text (4.5:1+) */
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-line: rgba(37, 99, 235, 0.4);
  --ok: #15803D;
  --syn-str: #0F766E;
  --btn-bg: #0F172A;
  --btn-bg-hover: #1E293B;
  --btn-fg: #F8FAFC;
  --grid-line: rgba(15, 23, 42, 0.05);
  --dot-grid: rgba(15, 23, 42, 0.08);
  --selection: #BFDBFE;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 22px 44px -28px rgba(15, 23, 42, 0.28);
  --shadow-btn: 0 12px 22px -14px rgba(15, 23, 42, 0.5);
  --grain-opacity: 0;
  --mesh: radial-gradient(48rem 34rem at 6% -4%, rgba(99, 102, 241, 0.34), transparent 62%), radial-gradient(44rem 32rem at 96% 2%, rgba(236, 72, 153, 0.24), transparent 62%), radial-gradient(48rem 34rem at 92% 58%, rgba(20, 184, 166, 0.26), transparent 62%), radial-gradient(46rem 34rem at 2% 78%, rgba(59, 130, 246, 0.30), transparent 62%), radial-gradient(40rem 28rem at 55% 104%, rgba(168, 85, 247, 0.26), transparent 62%);
  --grain-filter: none;
  --moon-display: block;
  --sun-display: none;

  /* Code card */
  --code-bg: #0F172A;
  --code-head: #162036;
  --code-line: #1E293B;
  --code-border: #0F172A;
  --code-fg: #E2E8F0;
  --code-key: #93C5FD;
  --code-str: #86EFAC;
  --code-punc: #94A3B8;
  --code-lnum: #7B8BA3;
  --code-dot: #334155;
  --code-method: #60A5FA;
  --code-method-bg: rgba(96, 165, 250, 0.12);
  --code-method-line: rgba(96, 165, 250, 0.4);
  --code-ok: #7FD49B;
  --code-ok-bg: rgba(127, 212, 155, 0.1);
  --code-ok-line: rgba(127, 212, 155, 0.32);
  --code-shadow: 0 34px 60px -32px rgba(15, 23, 42, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1120;
    --bg-raised: #111827;
    --bg-sunken: #0F172A;
    --ink: #E2E8F0;
    --ink-muted: #A8B4C7;
    --ink-faint: #8E9BB0;
    --rule: #1E293B;
    --rule-strong: #334155;
    --accent: #3B82F6;
    --accent-text: #60A5FA;
    --accent-soft: rgba(59, 130, 246, 0.14);
    --accent-line: rgba(59, 130, 246, 0.5);
    --ok: #4ADE80;
    --syn-str: #86EFAC;
    --btn-bg: #E2E8F0;
    --btn-bg-hover: #FFFFFF;
    --btn-fg: #0B1120;
    --grid-line: rgba(226, 232, 240, 0.04);
    --dot-grid: rgba(226, 232, 240, 0.06);
    --selection: #1E3A8A;
    --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.2), 0 24px 48px -28px rgba(0, 0, 0, 0.8);
    --shadow-btn: 0 12px 22px -14px rgba(0, 0, 0, 0.9);
    --grain-opacity: 0;
    --mesh: radial-gradient(48rem 34rem at 6% -4%, rgba(99, 102, 241, 0.46), transparent 62%), radial-gradient(44rem 32rem at 96% 2%, rgba(236, 72, 153, 0.28), transparent 62%), radial-gradient(48rem 34rem at 92% 58%, rgba(20, 184, 166, 0.28), transparent 62%), radial-gradient(46rem 34rem at 2% 78%, rgba(59, 130, 246, 0.40), transparent 62%), radial-gradient(40rem 28rem at 55% 104%, rgba(168, 85, 247, 0.34), transparent 62%);
    --grain-filter: invert(1);
    --moon-display: none;
    --sun-display: block;

    --code-bg: #0F172A;
    --code-head: #131C31;
    --code-line: #1E293B;
    --code-border: #243049;
    --code-shadow: 0 34px 60px -30px rgba(0, 0, 0, 0.85);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1120;
  --bg-raised: #111827;
  --bg-sunken: #0F172A;
  --ink: #E2E8F0;
  --ink-muted: #A8B4C7;
  --ink-faint: #8E9BB0;
  --rule: #1E293B;
  --rule-strong: #334155;
  --accent: #3B82F6;
  --accent-text: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-line: rgba(59, 130, 246, 0.5);
  --ok: #4ADE80;
  --syn-str: #86EFAC;
  --btn-bg: #E2E8F0;
  --btn-bg-hover: #FFFFFF;
  --btn-fg: #0B1120;
  --grid-line: rgba(226, 232, 240, 0.04);
  --dot-grid: rgba(226, 232, 240, 0.06);
  --selection: #1E3A8A;
  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.2), 0 24px 48px -28px rgba(0, 0, 0, 0.8);
  --shadow-btn: 0 12px 22px -14px rgba(0, 0, 0, 0.9);
  --grain-opacity: 0;
  --mesh: radial-gradient(48rem 34rem at 6% -4%, rgba(99, 102, 241, 0.46), transparent 62%), radial-gradient(44rem 32rem at 96% 2%, rgba(236, 72, 153, 0.28), transparent 62%), radial-gradient(48rem 34rem at 92% 58%, rgba(20, 184, 166, 0.28), transparent 62%), radial-gradient(46rem 34rem at 2% 78%, rgba(59, 130, 246, 0.40), transparent 62%), radial-gradient(40rem 28rem at 55% 104%, rgba(168, 85, 247, 0.34), transparent 62%);
  --grain-filter: invert(1);
  --moon-display: none;
  --sun-display: block;

  --code-bg: #0F172A;
  --code-head: #131C31;
  --code-line: #1E293B;
  --code-border: #243049;
  --code-shadow: 0 34px 60px -30px rgba(0, 0, 0, 0.85);
}

/* ---------- 2. Base ------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Soft multi-color mesh behind the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--mesh);
}

/* (paper grain removed) */
body::after {
  display: none;
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: var(--grain-opacity);
  filter: var(--grain-filter);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--selection); color: var(--ink); }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }

a {
  color: var(--accent-text);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.22em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease, text-underline-offset 0.25s var(--ease-out);
}
a:hover {
  text-decoration-color: currentColor;
  text-underline-offset: 0.34em;
}

code { font-family: var(--font-mono); }

button { font: inherit; color: inherit; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.nw { white-space: nowrap; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--maxw));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 0.75rem; }

[id] { scroll-margin-top: calc(var(--nav-h) + 0.5rem); }

/* ---------- 3. Buttons & links ------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 2.875rem;
  padding: 0 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out),
    background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-bg-hover); color: var(--btn-fg); box-shadow: var(--shadow-btn); }
.btn-primary .icon-dl { transition: transform 0.25s var(--ease-out); }
.btn-primary:hover .icon-dl { transform: translateY(2px); }

.btn-secondary { border-color: var(--rule-strong); color: var(--ink); background: transparent; }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); background: var(--bg-raised); }

.btn-sm { min-height: 2.25rem; padding: 0 0.85rem; font-size: 0.85rem; }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--bg); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.25s var(--ease-out);
}
.icon-btn:hover { border-color: var(--rule-strong); background: var(--bg-raised); }
.icon-btn .icon { width: 1.2rem; height: 1.2rem; }
.icon-btn-lg { width: 2.875rem; height: 2.875rem; border-color: var(--rule-strong); }
.icon-btn-lg:hover { border-color: var(--ink); transform: translateY(-2px); }

.quiet-link { color: var(--ink-muted); text-decoration-color: var(--rule-strong); }
.quiet-link:hover { color: var(--ink); text-decoration-color: var(--accent); }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}
.arrow-link .icon { transition: transform 0.25s var(--ease-out); }
.arrow-link:hover .icon { transform: translate(2px, -2px); }
.arrow-link-quiet { color: var(--ink); text-decoration-color: var(--rule-strong); }
.arrow-link-quiet:hover { color: var(--accent-text); }
.arrow-link-quiet:hover .icon { transform: translateX(4px); }

/* ---------- 4. Header / nav --------------------------------------------- */

.site-header {
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }

.nav-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.6vw, 1.75rem);
  min-height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.brand:hover .brand-mark { background: var(--ink); color: var(--bg); }
.brand-name { display: none; font-weight: 500; font-size: 0.95rem; letter-spacing: -0.01em; }

.nav-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.6rem;
}
.nav-links a {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.15rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after { transform: scaleX(1); background: var(--accent); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

html:not(.js) .theme-toggle { display: none; }   /* needs JS to work */
.theme-toggle .icon-moon { display: var(--moon-display); }
.theme-toggle .icon-sun { display: var(--sun-display); }

.menu-toggle {
  display: none;
  align-items: center;
  gap: 0.55rem;
  height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.menu-toggle:hover { border-color: var(--ink); }
.menu-toggle-bars { position: relative; width: 14px; height: 9px; }
.menu-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s var(--ease-out), top 0.25s var(--ease-out);
}
.menu-toggle-bars span:first-child { top: 0; }
.menu-toggle-bars span:last-child { top: 7.5px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:first-child { top: 3.75px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:last-child { top: 3.75px; transform: rotate(-45deg); }

@media (min-width: 40rem) {
  .brand-name { display: inline; }
}

/* Mobile / tablet: collapse links behind the menu button (only when JS runs) */
@media (max-width: 63.99rem) {
  html:not(.js) .nav-bar { flex-wrap: wrap; padding-block: 0.6rem; }
  html:not(.js) .primary-nav { order: 3; width: 100%; }

  .js .menu-toggle { display: inline-flex; }
  .js .primary-nav {
    position: absolute;
    top: 100%;
    left: calc(-1 * var(--gutter));
    right: calc(-1 * var(--gutter));
    display: none;
    padding: 0.5rem var(--gutter) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 24px 40px -30px rgba(0, 0, 0, 0.35);
  }
  .js .site-header.menu-open .primary-nav { display: block; }
  .js .site-header.menu-open { border-bottom-color: var(--rule); }
  .js .nav-links { flex-direction: column; gap: 0; }
  .js .nav-links li + li { border-top: 1px solid var(--rule); }
  .js .nav-links a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.85rem 0;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.015em;
  }
  .js .nav-links a::after { display: none; }
  .js .nav-links a.is-active { color: var(--accent-text); }
}

@media (min-width: 64rem) {
  .nav-actions { padding-left: 1.25rem; border-left: 1px solid var(--rule); }
}

/* ---------- 5. Hero ------------------------------------------------------ */

.hero {
  position: relative;
  padding-block: clamp(2.25rem, 1rem + 5vw, 6rem) clamp(3.5rem, 2.2rem + 4vw, 6rem);
  overflow: clip;
}
/* Faint blueprint grid behind the API card */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 70% 45% at 50% 78%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 45% at 50% 78%, #000 15%, transparent 72%);
}

.hero-grid {
  position: relative;
  display: grid;
  gap: clamp(3rem, 2rem + 4vw, 4.5rem);
  align-items: center;
}

.hero-intro { container-type: inline-size; min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.75rem 0.4rem 0.65rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0;
}

.hero-name {
  margin-top: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(2.75rem, 1.4rem + 6vw, 6rem);
  font-size: clamp(2.75rem, 16.6cqi, 7rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.hero-name-line { display: block; }
.hero-name-last {
  color: var(--accent);
  font-weight: 700;
  padding-left: 0.02em;
}

.hero-role {
  margin-top: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.hero-role .sep { color: var(--accent); margin-inline: 0.1em; }

.hero-pitch {
  margin-top: 0.75rem;
  max-width: 24em;
  font-size: clamp(1.02rem, 0.96rem + 0.3vw, 1.18rem);
  line-height: 1.55;
  color: var(--ink-muted);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(1.75rem, 1.4rem + 1vw, 2.25rem);
}

.hero-note { margin-top: 1rem; font-size: var(--step--1); }

@media (min-width: 62rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 31.25rem);
    column-gap: clamp(2rem, 4.5vw, 4.5rem);
  }
  .hero::before {
    -webkit-mask-image: radial-gradient(ellipse 42% 75% at 80% 50%, #000 15%, transparent 72%);
    mask-image: radial-gradient(ellipse 42% 75% at 80% 50%, #000 15%, transparent 72%);
  }
}

/* ---------- 6. API response card ---------------------------------------- */

.api-card {
  --frame: 8px;                 /* offset hairline frame */
  position: relative;
  width: calc(100% - var(--frame));
  max-width: 38rem;
  justify-self: start;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  box-shadow:
    var(--frame) var(--frame) 0 -1px var(--bg),
    var(--frame) var(--frame) 0 0 var(--rule-strong),
    var(--code-shadow);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.66rem + 0.25vw, 0.8125rem);
  line-height: 1.75;
}
@media (min-width: 40rem) {
  .api-card { --frame: 12px; }
}
@media (min-width: 62rem) {
  .api-card { max-width: none; }
}

.api-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--code-head);
  border-bottom: 1px solid var(--code-line);
  border-radius: 7px 7px 0 0;
}
.api-dots { display: flex; gap: 6px; }
.api-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--code-dot); }
.api-ctype { font-size: 0.68rem; letter-spacing: 0.04em; color: var(--code-punc); }

.api-request {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.7rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--code-line);
}
.api-method {
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--code-method-line);
  border-radius: 3px;
  background: var(--code-method-bg);
  color: var(--code-method);
  font-weight: 500;
  letter-spacing: 0.06em;
}
.api-path {
  flex: 1 1 12rem;
  min-width: 0;
  color: var(--code-fg);
  overflow-wrap: anywhere;
}
.api-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--code-ok-line);
  border-radius: 3px;
  background: var(--code-ok-bg);
  color: var(--code-ok);
  font-weight: 500;
  white-space: nowrap;
}
.api-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.api-body { padding: 1rem 1.25rem 1.2rem 0; }

.json {
  display: block;
  counter-reset: ln;
  white-space: normal;
  --num-w: 2.5ch;
  --gut: 4.5ch;
}
.json .ln {
  position: relative;
  display: block;
  padding-left: calc(var(--gut) + var(--ind, 0ch) + var(--hang, 0ch));
  text-indent: calc(-1 * var(--hang, 0ch));
  counter-increment: ln;
}
.json .ln::before {
  content: counter(ln);
  content: counter(ln) / "";
  position: absolute;
  left: 0;
  width: var(--num-w);
  text-align: right;
  text-indent: 0;
  color: var(--code-lnum);
  user-select: none;
}
.json .i1 { --ind: 2ch; }
.json .t { white-space: nowrap; }
.json .k { color: var(--code-key); }
.json .s { color: var(--code-str); }
.json .s-status { color: var(--code-ok); }
.json .p { color: var(--code-punc); }

.caret {
  display: inline-block;
  width: 0.6ch;
  height: 1.15em;
  margin-left: 0.4ch;
  vertical-align: -0.22em;
  background: var(--code-key);
  opacity: 0;
}

/* ---------- 7. Stats strip ---------------------------------------------- */

.stats .wrap { border-top: 1px solid var(--rule); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--rule);
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: clamp(1.4rem, 1rem + 1.5vw, 2.1rem) clamp(0.9rem, 0.4rem + 1.6vw, 1.75rem);
  background: transparent;
  border-left: 1px solid var(--rule);
}
.stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
.stat:nth-child(odd) { padding-left: 0; border-left: 0; }
.stat-num {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 650;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: lining-nums;
}
.stat-plus { font-size: 0.62em; vertical-align: 0.42em; margin-left: 0.04em; }
.stat-label {
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}
.stat-note {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
}

@media (min-width: 52rem) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat:nth-child(odd) { padding-left: clamp(0.9rem, 0.4rem + 1.6vw, 1.75rem); border-left: 1px solid var(--rule); }
  .stat:nth-child(n+3) { border-top: 0; }
  .stat:first-child { padding-left: 0; border-left: 0; }
}

/* ---------- 8. Sections -------------------------------------------------- */

.section-grid {
  display: grid;
  gap: clamp(1.75rem, 1.2rem + 1.5vw, 2.5rem);
  padding-block: var(--section-pad);
  border-top: 1px solid var(--rule);
}

.section-head { display: flex; flex-direction: column; gap: 0.4rem; }
.section-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent-text);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.section-aside {
  margin-top: 0.85rem;
  max-width: 24ch;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--ink-faint);
}

.section-body { min-width: 0; container-type: inline-size; }

@media (min-width: 60rem) {
  .section-grid {
    grid-template-columns: 15.5rem minmax(0, 1fr);
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }
  .section-head {
    position: sticky;
    top: calc(var(--nav-h) + 2rem);
    align-self: start;
  }
}

/* ---------- 9. About ----------------------------------------------------- */

.lead {
  max-width: 44rem;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 650;
  line-height: 1.32;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.lead strong { font-weight: 500; color: var(--accent-text); }

.about-text {
  max-width: 62ch;
  margin-top: 1.5rem;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1.25rem 1.5rem;
  margin-top: clamp(2rem, 1.6rem + 1.5vw, 2.75rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.fact dd {
  margin-top: 0.35rem;
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
}

/* ---------- 10. Experience timeline ------------------------------------- */

.timeline { list-style: none; padding: 0; }

.role {
  --line-x: 4px;
  position: relative;
  display: grid;
  gap: 0.25rem 0;
  padding: 0 0 clamp(2.75rem, 2rem + 2.5vw, 4rem) 1.75rem;
}
.role:last-child { padding-bottom: 0; }

/* the rail */
.role::before {
  content: "";
  position: absolute;
  left: var(--line-x);
  top: 0.95rem;
  bottom: -0.6rem;
  width: 1px;
  background: var(--rule-strong);
}
.role:last-child::before {
  bottom: auto;
  height: min(100% - 0.95rem, 9rem);
  background: linear-gradient(var(--rule-strong), transparent);
}
/* the marker */
.role::after {
  content: "";
  position: absolute;
  left: calc(var(--line-x) - 4.5px);
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink);
  background: var(--bg);
  transform: rotate(45deg);
}
.role.is-latest::after { background: var(--accent); border-color: var(--accent); }

.role-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 1rem; }
.role-dates {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.role-sub {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
}
.role-sub span + span::before {
  content: "·";
  content: "·" / "";
  margin-inline: 0.5em;
}

.role-company {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.role-title { margin-top: 0.3rem; font-weight: 500; color: var(--ink-muted); }

.role-context {
  max-width: 64ch;
  margin-top: 1rem;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--ink-muted);
}
.ctx-label {
  display: inline-block;
  margin-right: 0.55rem;
  padding: 0.02rem 0.38rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  vertical-align: 0.12em;
  line-height: 1.5;
}
.ctx-label-inline { margin-left: 0.25rem; }

.tag-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
}
.tag-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; }
.tags li {
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink);
}

.highlights {
  display: grid;
  gap: 0.6rem;
  max-width: 66ch;
  margin-top: 1.15rem;
  padding: 0;
  list-style: none;
}
.highlights li { position: relative; padding-left: 1.5rem; text-wrap: pretty; }
.highlights li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 0.75rem;
  height: 1px;
  background: var(--accent);
}

.role-award {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: fit-content;
  max-width: 100%;
  margin-top: 1.4rem;
  padding: 0.65rem 0.9rem;
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--ink-muted);
}
.role-award .icon { width: 1.15rem; height: 1.15rem; margin-top: 0.1rem; color: var(--accent-text); }

/* Endpoints index (GuestPortal) */
.endpoints {
  margin-top: 1.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
  container-type: inline-size;
}
.endpoints-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-sunken);
}
.endpoints-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.endpoints-count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); }

.endpoint-list {
  display: grid;
  gap: 1px;
  padding: 0;
  list-style: none;
  background: var(--rule);
}
.endpoint {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0.15rem 0.7rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  background: var(--bg-raised);
}
.ep-type {
  align-self: start;
  margin-top: 0.12rem;
  padding: 0.08rem 0;
  border: 1px solid var(--accent-line);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ep-util { border-color: var(--rule-strong); color: var(--ink-faint); }
.ep-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ep-desc {
  grid-column: 2;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

@container (min-width: 33rem) {
  .endpoint-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Two-column role layout once the timeline has room */
@container (min-width: 40rem) {
  .role {
    --line-x: calc(9.5rem + 1.5rem);
    grid-template-columns: 9.5rem minmax(0, 1fr);
    column-gap: 3rem;
    padding-left: 0;
  }
  .role::before { top: 1.25rem; }
  .role::after { top: 0.85rem; }
  .role-meta { flex-direction: column; gap: 0.2rem; padding-top: 0.55rem; }
  .role-sub { display: flex; flex-direction: column; gap: 0.1rem; }
  .role-sub span + span::before { content: none; }
  .role-company { margin-top: 0; }
}

/* ---------- 11. Skills --------------------------------------------------- */

.skills-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.legend-swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.skills { border-top: 1px solid var(--ink); }
.skill-row {
  display: grid;
  gap: 0.65rem;
  padding-block: 1.05rem;
  border-bottom: 1px solid var(--rule);
}
.skill-row dt {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
}
.pills { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0; list-style: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}
.pill.is-core { border-color: var(--accent-line); background: var(--accent-soft); }
.pill.is-core::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.pill-note { margin-left: -0.15rem; font-weight: 400; color: var(--ink-faint); }

@container (min-width: 32rem) {
  .skill-row { grid-template-columns: 11.5rem minmax(0, 1fr); align-items: center; }
}

/* ---------- 12. Project card -------------------------------------------- */

.project-card {
  display: grid;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--bg-raised);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.35s ease;
}
.project-card:hover,
.project-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-card);
}

.project-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(1.5rem, 1rem + 2vw, 2.4rem);
}
.project-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.project-name {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.025em;
}
.project-desc { margin-top: 0.9rem; max-width: 46ch; color: var(--ink-muted); text-wrap: pretty; }
.project-info .tag-group { margin-top: 1.25rem; }
.project-info .arrow-link { margin-top: auto; padding-top: 1.75rem; }

.project-visual {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  min-width: 0;
  padding: clamp(1.1rem, 0.8rem + 1.4vw, 1.9rem);
  border-top: 1px solid var(--rule);
  background-color: var(--bg-sunken);
  background-image: radial-gradient(var(--dot-grid) 1px, transparent 1.2px);
  background-size: 14px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
}

.jpf-path {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  min-width: 0;
}
.jpf-path-label {
  padding-right: 0.65rem;
  border-right: 1px solid var(--rule);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.jpf-path-value { color: var(--ink); overflow-wrap: anywhere; }
.seg-end {
  padding: 0 0.15rem;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 500;
}

.jpf-tree {
  padding: 0.45rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.jpf-tree .row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.16rem 0.8rem 0.16rem calc(0.8rem + var(--d, 0) * 1.15rem);
  white-space: nowrap;
}
.jpf-tree .d1 { --d: 1; }
.jpf-tree .d2 { --d: 2; }
.jpf-tree .d3 { --d: 3; }
.jpf-tree .on-path::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}
.jpf-tree .is-hit { background: var(--accent-soft); }
.jpf-tree .is-hit .tk { color: var(--accent-text); font-weight: 500; }
.tw { display: inline-grid; place-items: center; width: 0.7rem; height: 0.7rem; flex: none; }
.tw.open::before {
  content: "";
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-faint);
}
.tw.closed::before {
  content: "";
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--ink-faint);
}
.tk { color: var(--ink); }
.tk::after { content: ":"; color: var(--ink-faint); }
.tm { color: var(--ink-faint); }
.tv-s { color: var(--syn-str); }
.tv-n { color: var(--accent-text); }

.jpf-out { display: grid; gap: 0.4rem; }
.out-row {
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.out-lang {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.out-row code { color: var(--ink); overflow-wrap: anywhere; }

.more-link { margin-top: 1.5rem; }

@container (min-width: 44rem) {
  .project-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .project-visual { border-top: 0; border-left: 1px solid var(--rule); }
}

/* ---------- 13. Recognition & credentials -------------------------------- */

.creds {
  display: grid;
  border-top: 1px solid var(--ink);
}
.cred { padding-block: 1.5rem; border-bottom: 1px solid var(--rule); }

.cred-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.cred-label .icon { width: 1rem; height: 1rem; color: var(--accent-text); }

.cred-title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.cred-award .cred-title { color: var(--accent-text); }
.cred-title .amp { color: var(--accent); }
.cred-meta { margin-top: 0.5rem; font-size: var(--step--1); font-weight: 500; }
.cred-note { margin-top: 0.2rem; font-size: var(--step--1); color: var(--ink-muted); }

.cred-list { display: grid; padding: 0; list-style: none; }
.cred-list li { padding-block: 0.55rem; border-bottom: 1px dashed var(--rule-strong); }
.cred-list li:first-child { padding-top: 0; }
.cred-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.cred-item {
  font-family: var(--font-display);
  font-size: clamp(1.08rem, 1.02rem + 0.25vw, 1.2rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.edu-secondary {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.15rem;
  padding: 1rem 0 0;
  border-top: 1px dashed var(--rule-strong);
  list-style: none;
}
.edu-secondary li { display: flex; flex-direction: column; gap: 0.1rem; }
.edu-name { font-size: 0.88rem; font-weight: 500; color: var(--ink-muted); }
.edu-meta { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); }

@container (min-width: 36rem) {
  .creds { grid-template-columns: 1fr 1fr; }
  .cred:nth-child(1) { padding-right: 1.75rem; }
  .cred:nth-child(2) { padding-left: 1.75rem; border-left: 1px solid var(--rule); }
  .cred-edu { grid-column: 1 / -1; }
}
@container (min-width: 52rem) {
  .creds { grid-template-columns: 1fr 1fr 1.3fr; border-bottom: 1px solid var(--rule); }
  .cred { padding: 1.75rem 1.75rem 1.5rem; border-bottom: 0; }
  .cred:nth-child(1) { padding-left: 0; }
  .cred + .cred { border-left: 1px solid var(--rule); }
  .cred-edu { grid-column: auto; padding-right: 0; }
}

/* ---------- 14. Contact -------------------------------------------------- */

.contact-line {
  max-width: 16ch;
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.contact-line em { font-style: normal; color: var(--accent); }
.accent-dot { color: var(--accent); }

.contact-sub {
  max-width: 54ch;
  margin-top: 1.25rem;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin-top: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  padding-block: 1.4rem;
  border-block: 1px solid var(--rule);
}
.email-link {
  min-width: 0;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 0.85rem + 2.6vw, 2.6rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
}
.email-link:hover { color: var(--accent-text); text-underline-offset: 0.26em; }

.copy-btn {
  display: none;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.js .copy-btn { display: inline-flex; }
.copy-btn:hover { border-color: var(--ink); background: var(--bg-raised); }
.copy-btn:active { transform: translateY(1px); }
.copy-btn .icon { width: 1rem; height: 1rem; }
.copy-btn .icon-check { display: none; }
.copy-btn.is-copied { border-color: var(--ok); color: var(--ok); }
.copy-btn.is-copied .icon-copy { display: none; }
.copy-btn.is-copied .icon-check { display: block; }
.copy-status {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.contact-links { display: grid; gap: 0.7rem; margin-top: 1.5rem; padding: 0; list-style: none; }
.contact-links li {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.75rem;
}
.cl-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: start;
  color: var(--ink);
  font-weight: 500;
  text-decoration-color: var(--rule-strong);
  overflow-wrap: break-word;
}
@media (min-width: 40rem) {
  .contact-links li { grid-template-columns: 6.25rem minmax(0, 1fr); }
}
.contact-links a:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.contact-links a .icon { width: 0.9rem; height: 0.9rem; color: var(--ink-faint); }

.contact-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.25rem;
}

/* ---------- 15. Footer --------------------------------------------------- */

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 2rem;
  padding-block: 1.75rem 2.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-faint);
}
.footer-inner p { margin: 0; }
.footer-top { margin-left: auto; color: var(--ink-faint); }

/* ---------- 16. Motion (only when the user hasn't asked to reduce it) ---- */

@media (prefers-reduced-motion: no-preference) {

  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes type-in {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  @keyframes pop-in {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes pulse {
    0%       { transform: scale(0.6); opacity: 0.75; }
    70%, 100% { transform: scale(1.7); opacity: 0; }
  }
  @keyframes caret-blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
  }
  @keyframes menu-drop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }

  /* Fill "backwards" only: once an intro animation ends it is removed, so a late
     web-font swap can't leave a finished, composited line painted at its old offset. */
  .hero-intro > * { animation: rise 0.75s var(--ease-out) backwards; }
  .hero-intro > :nth-child(2) { animation-delay: 0.07s; }
  .hero-intro > :nth-child(3) { animation-delay: 0.14s; }
  .hero-intro > :nth-child(4) { animation-delay: 0.2s; }
  .hero-intro > :nth-child(5) { animation-delay: 0.26s; }
  .hero-intro > :nth-child(6) { animation-delay: 0.32s; }

  .api-card { animation: rise 0.8s var(--ease-out) 0.1s backwards; }
  .api-request > * { animation: fade-in 0.3s ease 0.2s backwards; }
  .api-request .api-status { animation: pop-in 0.35s var(--ease-out) 0.38s backwards; }
  .json .ln {
    animation: type-in 0.28s steps(16, end) backwards;
    animation-delay: calc(0.3s + var(--n, 0) * 62ms);
  }
  .caret { animation: caret-blink 0.9s linear 1.1s 4; }

  .status-dot::after { animation: pulse 2.6s ease-out infinite; }

  .js .site-header.menu-open .primary-nav { animation: menu-drop 0.22s var(--ease-out); }

  /* Scroll reveal: hidden state only exists once JS has opted in */
  .reveal-ready [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  }
  .reveal-ready [data-reveal].is-visible { opacity: 1; transform: none; }
  .reveal-ready .stat:nth-child(2) { transition-delay: 0.06s; }
  .reveal-ready .stat:nth-child(3) { transition-delay: 0.12s; }
  .reveal-ready .stat:nth-child(4) { transition-delay: 0.18s; }

  /* Smooth colour hand-off when the theme is toggled */
  .theme-switching,
  .theme-switching *,
  .theme-switching *::before,
  .theme-switching *::after {
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover, .icon-btn-lg:hover, .project-card:hover, .project-card:focus-within { transform: none; }
}

/* ---------- 17. Print ---------------------------------------------------- */

@media print {
  body::after, .site-header, .skip-link, .hero::before, .copy-btn, .hero-ctas, .contact-ctas, .footer-top { display: none !important; }
  body { background: #fff; color: #000; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .section-head { position: static; }
  .api-card { box-shadow: none; }
}
