/* =========================================================
   Hrishikesh Kini — Portfolio Design System
   Editorial, warm-neutral, ember accent, realistic 3D cat.
   Static site: CSS variables for dark/light theming, no build.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Typography — The AI Engineer's Workshop */
  --font-body: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-editorial: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Radii & shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Layout */
  --container: 1140px;
  --nav-height: 68px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dark theme (The AI Engineer's Workshop — Midnight) ---------- */
:root,
[data-theme="dark"] {
  --bg: #121110;
  --bg-soft: #1a1816;
  --bg-card: #1e1c1a;
  --bg-card-hover: #262320;
  --bg-glass: rgba(18, 17, 16, 0.88);
  --border: #2e2a26;
  --border-strong: #453f39;

  --text: #f5f2ec;
  --text-muted: #a69f94;
  --text-faint: #8a837a;

  --accent: #f0652b;
  --accent-2: #ff7b42;
  --accent-grad: linear-gradient(135deg, #ff7b42 0%, #f0652b 100%);
  --accent-soft: rgba(240, 101, 43, 0.14);
  --accent-text-on: #121110;

  --glow: radial-gradient(ellipse 65% 50% at 75% 0%, rgba(240, 101, 43, 0.12), transparent 70%);

  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 20px 48px rgba(0, 0, 0, 0.5);

  --scrollbar-track: #161413;
  --scrollbar-thumb: #332d29;
  --scrollbar-thumb-hover: #4d443e;

}

/* ---------- Light theme (The AI Engineer's Workshop — Warm Ivory & Terracotta) ---------- */
[data-theme="light"] {
  --bg: #faf7f2;
  --bg-soft: #f1ebe1;
  --bg-card: #fffcf8;
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(250, 247, 242, 0.9);
  --border: #ddd5ca;
  --border-strong: #c8beb0;

  --text: #191919;
  --text-muted: #625d56;
  --text-faint: #6b6559;

  --accent: #d9470b;
  --accent-2: #b83805;
  --accent-grad: linear-gradient(135deg, #d9470b 0%, #b83805 100%);
  --accent-soft: rgba(217, 71, 11, 0.1);
  --accent-text-on: #ffffff;

  --glow: radial-gradient(ellipse 65% 50% at 75% 0%, rgba(217, 71, 11, 0.08), transparent 70%);

  --shadow-card: 0 4px 20px -2px rgba(98, 93, 86, 0.08), 0 2px 6px -1px rgba(98, 93, 86, 0.04);
  --shadow-lift: 0 16px 36px -4px rgba(98, 93, 86, 0.12), 0 6px 12px -2px rgba(98, 93, 86, 0.06);

  --scrollbar-track: #f1ebe1;
  --scrollbar-thumb: #d5ccbe;
  --scrollbar-thumb-hover: #b5a999;

}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

body::before {
  /* Ambient ember glow behind hero */
  content: "";
  position: fixed;
  inset: 0;
  background: var(--glow);
  pointer-events: none;
  z-index: 0;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

ul {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-text-on);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Utility classes ---------- */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(var(--container), 100% - 3rem);
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: var(--space-9);
  z-index: 1;
}

.section--soft {
  background: var(--bg-soft);
  transition: background var(--transition);
}

.section-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: var(--space-3);
}

.section-sub {
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: var(--space-7);
}

/* Thin top rule connecting kicker to title, editorial feel */
.section-head {
  border-top: 1px solid var(--border);
  padding-top: var(--space-6);
  margin-bottom: var(--space-7);
}

.section-head .section-kicker {
  margin-bottom: var(--space-3);
}

.section-head .section-sub {
  margin-bottom: 0;
}

/* ---------- Scroll reveal (no-JS safe: visible by default, only gated when html.js) ---------- */
.reveal {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
}

html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal-delay-1 {
  transition-delay: 0.08s;
}
.reveal-delay-2 {
  transition-delay: 0.16s;
}
.reveal-delay-3 {
  transition-delay: 0.24s;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition), backdrop-filter var(--transition);
}

.nav.is-scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--border);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition);
}


.nav-logo .gradient-text {
  font-size: inherit;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: var(--space-2) 0;
  position: relative;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent-grad);
  border-radius: 2px;
  transition: width var(--transition);
}

.nav-links a:hover::after,
.nav-links a.is-active::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

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

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

/* Mobile nav toggle */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

.nav-burger span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-burger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-burger.is-open span:nth-child(2) {
  opacity: 0;
}
.nav-burger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero (DESIGN_SPEC.md) ----------
   The hero is a self-contained light "cream" band on the spec palette.
   Tokens are scoped to .hero so the rest of the site is untouched. */
.hero {
  --ip-bg: #fbf7f2;
  --surface: #ffffff;
  --sand: #f3e9de;
  --sand-deep: #f5e6d6;
  --border: #e6d9cb;
  --border-strong: #d9c9b8;
  --ink: #1a1410;
  --body: #5e534a;
  --accent: #c2410c;
  --online: #1f9d6b;

  /* remap the global tokens the shared components rely on */
  --text: var(--ink);
  --text-muted: var(--body);
  --text-faint: #8a837a;
  --bg-card: var(--surface);
  --bg-card-hover: var(--sand);
  --accent-text-on: #ffffff;
  --accent-soft: rgba(194, 65, 12, 0.12);

  position: relative;
  min-height: 860px;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  background: var(--ip-bg);
  z-index: 1;
}

/* Dark theme: same hero structure, site midnight + ember palette, so the
   theme toggle stays coherent instead of leaving a cream band on a dark page. */
[data-theme="dark"] .hero {
  --ip-bg: #121110;
  --surface: #1e1c1a;
  --sand: #262320;
  --sand-deep: #1a1816;
  --border: #2e2a26;
  --border-strong: #453f39;
  --ink: #f5f2ec;
  --body: #a69f94;
  --accent: #f0652b;
  --online: #34d399;

  --text: var(--ink);
  --text-muted: var(--body);
  --text-faint: #736c63;
  --bg-card: var(--surface);
  --bg-card-hover: var(--sand);
  --accent-text-on: #121110;
  --accent-soft: rgba(240, 101, 43, 0.14);
}

.hero-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 56px;
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 24px;
  padding-block: var(--space-8) var(--space-7);
}

.hero-copy {
  flex: 1 1 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  margin: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--body);
  margin: 0;
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: none;
  animation: none;
}

.hero-title {
  font-size: 76px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin: 0;
}

.hero-tagline {
  font-size: 20px;
  line-height: 1.6;
  color: var(--body);
  max-width: 540px;
  margin: 0;
}

.hero-tagline strong {
  color: var(--ink);
  font-weight: 600;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
}

.hero-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.skill-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--sand);
  border: 1px solid var(--border);
  color: var(--body);
}

.hero-social {
  justify-content: flex-start;
}

/* Hero stage: square, holds the cream circle the cat stands on */
.hero-stage {
  position: relative;
  flex: 1 1 360px;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
  margin-inline: auto;
}

.hero-cat-circle {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: var(--sand-deep);
}

/* Position marker the 3D cat glides to; never covers content.
   Starts 76% down the stage so the cat's feet land on the lower part
   of the cream circle (the spec's 60%-down rule then applies to this box).
   This is the only anchor: past the hero the cat stays docked bottom-right. */
.hero-anchor {
  position: absolute;
  inset: 76% 0 0 0;
  pointer-events: none;
}

/* ---------- 3D cat layer (decorative, never interactive) ---------- */
.cat-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.cat-layer.is-ready {
  opacity: 1;
}

.cat-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.footer-credit {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: var(--space-3);
}

.footer-credit a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Hero buttons: spec size and weight */
.hero .btn {
  font-size: 16px;
  font-weight: 600;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
}

.hero .btn--primary {
  background: var(--accent);
  color: var(--accent-text-on);
  box-shadow: none;
  filter: none;
}

.hero .btn--primary:hover {
  transform: none;
  filter: brightness(1.08);
  box-shadow: none;
  color: var(--accent-text-on);
}

.hero .btn--ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink);
}

.hero .btn--ghost:hover {
  background: var(--sand);
  border-color: var(--border-strong);
  transform: none;
}

/* Hero social icons: 44px circles, 18px stroke icons */
.hero .social-row {
  gap: 12px;
}

.hero .social-row a {
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--body);
}

.hero .social-row a:hover {
  background: var(--sand);
  border-color: var(--border);
  color: var(--accent);
  transform: none;
}

.hero .social-row svg {
  width: 18px;
  height: 18px;
}

/* Visible focus ring on every control (spec: 2px accent, 3px offset) */
.hero a:focus-visible,
.hero button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition), border-color var(--transition);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent-grad);
  color: var(--accent-text-on);
  box-shadow: 0 8px 24px var(--accent-soft);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-soft);
  color: var(--accent-text-on);
}

.btn--ghost {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

/* ---------- Social icons row ---------- */
.social-row {
  display: flex;
  gap: var(--space-3);
}

.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition),
    border-color var(--transition), background var(--transition);
}

.social-row a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-3px);
}

.social-row svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ---------- Surfaces ---------- */
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transform-style: preserve-3d;
  will-change: transform;
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    380px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--accent-soft) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.card:hover::before {
  opacity: 1;
}

.card--hover:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
}

/* ---------- About + stats ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-8);
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  max-width: 60ch;
}

.about-text strong,
.about-text b {
  color: var(--text);
}

.about-photo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.about-photo-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) 0;
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, var(--bg-card-hover), var(--bg-card));
  box-shadow: var(--shadow-card), 0 20px 40px -15px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.about-photo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift), 0 24px 48px -12px rgba(255, 123, 41, 0.15);
}

.about-photo-backdrop {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 190px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(28px);
  pointer-events: none;
}

.about-photo-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.25));
  display: block;
}

.about-photo-badge {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-7);
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  padding: var(--space-4) var(--space-5);
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: var(--space-1);
}

.stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ---------- Chips ---------- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-mono);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition),
    background var(--transition), transform var(--transition);
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------- Selected work ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: var(--space-6);
}

.work-card {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.work-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift), 0 0 0 1px var(--accent-soft);
}

.work-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  align-self: flex-start;
  margin-bottom: var(--space-3);
}

.work-card h3 {
  font-size: clamp(1.2rem, 2vw, 1.4rem);
  margin-bottom: var(--space-3);
  line-height: 1.35;
}

.work-card h3 a {
  color: var(--text);
  text-decoration: none;
}

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

.work-card h3 a::after {
  /* Whole-card link target */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.work-card a,
.work-card .card-link,
.work-card .chip {
  position: relative;
  z-index: 2;
}

.work-summary {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.62;
  margin-bottom: var(--space-5);
  flex-grow: 1;
}

.work-impact {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--text);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.work-impact::before {
  content: "↳";
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 400;
}

.work-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.work-meta .chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.work-meta .chip {
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-pill);
}

.work-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  font-size: 0.88rem;
  font-weight: 600;
}

.work-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all var(--transition);
  text-decoration: none;
}

.work-links a:first-child {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.work-links a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--accent);
}

/* ---------- Archive list ---------- */
.archive {
  margin-top: var(--space-7);
}

.archive-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-4);
}

.archive-list {
  border-top: 1px solid var(--border);
}

.archive-row {
  display: grid;
  grid-template-columns: 1.1fr 2.2fr 1.7fr auto;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: background var(--transition), color var(--transition);
}

.archive-row a {
  color: var(--text);
  font-weight: 500;
}

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

.archive-row .archive-type {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.archive-row .archive-tags {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.archive-row .archive-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  justify-self: end;
  white-space: nowrap;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}

.skill-card {
  padding: var(--space-5);
}

.skill-card h3 {
  font-size: 1.05rem;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.skill-card h3::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent-grad);
  flex-shrink: 0;
}

/* ---------- Experience timeline ---------- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.5;
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-6);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 12px;
  height: 12px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-soft);
}

.timeline-card {
  padding: var(--space-6);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.timeline-head h3 {
  font-size: 1.3rem;
}

.timeline-company {
  color: var(--accent);
  font-weight: 600;
}

.timeline-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: var(--space-4);
}

.timeline-card ul {
  display: grid;
  gap: var(--space-2);
}

.timeline-card li {
  color: var(--text-muted);
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.95rem;
}

.timeline-card li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Education rows inside the experience section */
.edu-block {
  margin-top: var(--space-7);
}

.edu-block-title {
  font-size: 1.15rem;
  margin-bottom: var(--space-4);
}

.edu-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 2fr;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.edu-row h3 {
  font-size: 1rem;
}

.edu-row .edu-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.edu-row .edu-note {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.edu-row .edu-note a {
  word-break: break-word;
}

/* ---------- Blog / writing ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.blog-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
}

.blog-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-card h3 {
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
  line-height: 1.35;
}

.blog-card h3 a {
  color: var(--text);
}

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

.blog-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  flex-grow: 1;
}

.blog-link {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

.blog-link:hover {
  text-decoration: underline;
}

.blog-fallback {
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--space-5);
}

.contact-card {
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.contact-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.contact-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.contact-card h3 {
  font-size: 0.95rem;
  margin-bottom: var(--space-1);
}

.contact-card a,
.contact-card span {
  color: var(--text-muted);
  font-size: 0.92rem;
  word-break: break-word;
}

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

.contact-cta {
  margin-top: var(--space-6);
}

/* ---------- Footer ---------- */
.footer {
  padding: var(--space-7) 0 7rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.88rem;
  position: relative;
  z-index: 1;
}

.footer .social-row {
  justify-content: center;
  margin-bottom: var(--space-4);
}

.footer .nav-links {
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-5);
}

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

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


/* ---------- Project detail pages ---------- */
.project-page {
  padding-top: calc(var(--nav-height) + var(--space-6));
  min-height: 100vh;
}

.project-page .back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: var(--space-6);
  transition: color var(--transition);
}

.project-page .back-link:hover {
  color: var(--accent);
}

.project-hero {
  margin-bottom: var(--space-7);
}

.project-hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  margin-bottom: var(--space-3);
}

.project-hero .project-tags {
  margin-top: var(--space-4);
  margin-bottom: 0;
}

.project-content {
  max-width: 800px;
}

.project-content h2 {
  font-size: 1.4rem;
  margin: var(--space-7) 0 var(--space-3);
}

.project-content h3 {
  font-size: 1.1rem;
  margin: var(--space-5) 0 var(--space-2);
}

.project-content p {
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.project-content ul {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.project-content li {
  color: var(--text-muted);
  padding-left: 1.3rem;
  position: relative;
}

.project-content li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.project-content img {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-block: var(--space-4);
  width: 100%;
}

.project-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15em 0.45em;
}

.project-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

.project-content pre code {
  background: none;
  border: none;
  padding: 0;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .about-photo {
    max-width: 320px;
  }

  .archive-row {
    grid-template-columns: 1fr auto;
  }

  .archive-row .archive-type {
    display: none;
  }

  .archive-row .archive-tags {
    grid-column: 1;
    order: 3;
  }

  .archive-row .archive-link {
    grid-row: 1;
  }
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
  }

  .hero-inner {
    gap: 32px;
  }

  .hero-stage {
    max-width: 360px;
  }
}

/* below 768px the cat is smaller and docks bottom-right */
@media (max-width: 767.98px) {
  /* Hero: title scales down; the cat docks bottom-right, so no empty circle */
  .hero-title {
    font-size: 48px;
  }

  .hero-cat-circle {
    display: none;
  }

  .hero-stage {
    display: none;
  }

  .nav .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) var(--space-5) var(--space-5);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  }

  .nav .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .footer .nav-links {
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
  }

  .nav .nav-links a {
    padding: var(--space-3) 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child a {
    border-bottom: none;
  }

  .nav-burger {
    display: flex;
  }

  .timeline {
    padding-left: 1.6rem;
  }

  .timeline-item::before {
    left: -1.6rem;
  }

  .section {
    padding-block: var(--space-8);
  }

  .work-card {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .work-index {
    order: -1;
  }

  .footer {
    padding-bottom: 8rem;
  }

  .edu-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 40px;
  }

  .hero-tagline {
    font-size: 18px;
  }
  .hero-cta .btn,
  .btn-row .btn {
    width: 100%;
    justify-content: center;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Reduced motion ---------- */
@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;
  }

  html.js .reveal {
    opacity: 1;
    transform: none;
  }

}
