/* ═══════════════════════════════════════════════════════════
   SAHIL LAD — PORTFOLIO
   Design system
   ───────────────────────────────────────────────────────────
   Warm neutral surfaces · one amber accent · hairline structure
   Inter (variable) for text, JetBrains Mono for meta/labels.
   Rules of the system:
     · Structure is drawn with 1px lines, not shadows.
     · The accent marks state and wayfinding — never decoration.
     · Pill radius = labels. 8px radius = controls. 0 = grid cells.
     · Motion is short (≤240ms), on opacity/transform only.
═══════════════════════════════════════════════════════════ */

/* ─── 1. TOKENS ──────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0b0b0c;
  --bg-alt: #0f0f10;
  --bg-blur: rgba(11, 11, 12, 0.78);
  --surface: #141415;
  --surface-hover: #191919;

  /* Lines */
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);

  /* Text */
  --text: #edebe7;
  --text-2: #a09e99;
  --text-3: #84827c;

  /* Accent — amber. One hue, used sparingly. */
  --accent: #e8a54d;
  --accent-ink: #17120a;
  --accent-soft: rgba(232, 165, 77, 0.12);
  --accent-line: rgba(232, 165, 77, 0.45);

  /* Status — availability only */
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.08);
  --ok-line: rgba(74, 222, 128, 0.24);

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.0625rem;
  --fs-xl: clamp(1.125rem, 1.02rem + 0.4vw, 1.25rem);
  --fs-2xl: clamp(1.75rem, 1.42rem + 1.5vw, 2.5rem);
  --fs-3xl: clamp(2.375rem, 1.6rem + 3.3vw, 4rem);

  /* Rhythm */
  --container: 1200px;
  --gutter: 32px;
  --nav-h: 68px;
  --nav-h-scrolled: 58px;
  --section-py: clamp(72px, 8.5vw, 120px);

  /* Radii */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Elevation — used almost nowhere by design */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 180ms;
}

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

  --bg: #faf9f7;
  --bg-alt: #f2f1ed;
  --bg-blur: rgba(250, 249, 247, 0.82);
  --surface: #ffffff;
  --surface-hover: #ffffff;

  --line: rgba(24, 23, 20, 0.11);
  --line-strong: rgba(24, 23, 20, 0.26);

  --text: #171614;
  --text-2: #55534d;
  --text-3: #7d7b74;

  --accent: #b45309;
  --accent-ink: #ffffff;
  --accent-soft: rgba(180, 83, 9, 0.08);
  --accent-line: rgba(180, 83, 9, 0.32);

  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.06);
  --ok-line: rgba(21, 128, 61, 0.22);

  --shadow-sm: 0 1px 2px rgba(24, 23, 20, 0.06);
  --shadow-md: 0 16px 40px rgba(24, 23, 20, 0.08);
}

/* ─── 2. RESET & BASE ────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-main);
  font-size: var(--fs-md);
  line-height: 1.65;
  font-weight: 400;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  counter-reset: section;
}

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 550;
}

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

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

section[id] {
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

main:focus {
  outline: none;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 550;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline-offset: 2px;
}

/* ─── 3. LAYOUT PRIMITIVES ───────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  position: relative;
  padding: var(--section-py) 0;
}

/* Legacy hooks kept so markup needs no rewrite */
.gradient-text {
  color: var(--text);
}

.floating-shapes {
  display: none;
}

/* Small mono label used for eyebrows, field labels and meta */
.section-tag,
.skills-title,
.tech-title,
.stat-label,
.hero-badge,
.tag,
.contact-item h4,
.form-group label,
.scroll-indicator span {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ─── 4. BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    transform var(--duration) var(--ease),
    opacity var(--duration) var(--ease);
}

.btn i {
  font-size: 0.85em;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 550;
}

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.btn-primary:active {
  transform: translateY(0);
  opacity: 1;
}

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

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-3);
}

.btn-sm {
  min-height: 38px;
  padding: 8px 16px;
  font-size: var(--fs-sm);
}

.btn-full {
  width: 100%;
}

/* ─── 5. NAVBAR ──────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: height 0.3s var(--ease), background-color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.navbar.scrolled {
  height: var(--nav-h-scrolled);
  background: var(--bg-blur);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--line);
}

.nav-inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Reading-progress hairline, injected by script.js */
.nav-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.navbar.scrolled .nav-progress {
  opacity: 1;
}

/* A blurred ancestor would trap the fixed mobile drawer — drop it while open */
body.menu-open .navbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  transition: opacity var(--duration) var(--ease);
}

.nav-logo:hover {
  opacity: 0.7;
}

.logo-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  position: relative;
  display: block;
  padding: 8px 14px;
  font-size: var(--fs-base);
  font-weight: 450;
  color: var(--text-2);
  transition: color var(--duration) var(--ease);
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s var(--ease);
}

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

.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  transform: scaleX(1);
}

.nav-actions {
  position: relative;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--r);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.theme-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  z-index: 1100;
}

.hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
  z-index: 900;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ─── 6. HERO ────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: min(100svh, 940px);
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Faint column guides — technical, almost subliminal */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 120px 100%;
  background-position: center;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 25%, #000 55%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 55%, transparent);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 72px) var(--gutter) 112px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 36px;
  animation: fade-up 0.7s var(--ease-out) both 0.05s;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulse-dot 2.6s ease-in-out infinite;
}

.hero-name {
  font-size: var(--fs-3xl);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--text-3);
  margin-bottom: 18px;
  max-width: 16ch;
  animation: fade-up 0.7s var(--ease-out) both 0.12s;
}

.hero-name .gradient-text {
  color: var(--text);
}

.hero-title-wrapper {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 6px;
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--text-2);
  margin-bottom: 26px;
  min-height: 1.8em;
  animation: fade-up 0.7s var(--ease-out) both 0.19s;
}

.hero-title-typed {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-weight: 500;
  color: var(--accent);
}

.cursor {
  display: inline-block;
  color: var(--accent);
  font-weight: 300;
  animation: blink 1.1s step-end infinite;
}

.hero-description {
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--text-2);
  max-width: 54ch;
  margin-bottom: 40px;
  animation: fade-up 0.7s var(--ease-out) both 0.26s;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 72px;
  animation: fade-up 0.7s var(--ease-out) both 0.33s;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  max-width: 600px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  animation: fade-up 0.7s var(--ease-out) both 0.4s;
}

.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 550;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.625rem;
  color: var(--text-3);
}

.stat-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
}

/* Scroll cue — a line, not a mouse */
.scroll-indicator {
  position: absolute;
  bottom: 34px;
  left: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter)));
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1;
  animation: fade-in 1s ease both 1.2s;
}

.scroll-mouse {
  position: relative;
  width: 52px;
  height: 1px;
  background: var(--line-strong);
  overflow: hidden;
}

.scroll-wheel {
  position: absolute;
  inset: 0 auto 0 0;
  width: 18px;
  background: var(--accent);
  animation: scroll-line 2.4s var(--ease) infinite;
}

.scroll-indicator span {
  font-size: 0.625rem;
  color: var(--text-3);
}

@media (max-height: 720px), (max-width: 767px) {
  .scroll-indicator {
    display: none;
  }
}

/* ─── 7. SECTION HEADERS ─────────────────────────────────── */
.section-header {
  display: grid;
  gap: 14px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(40px, 5vw, 64px);
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
}

.section-tag::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  color: var(--accent);
  font-weight: 600;
}

.section-tag::after {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--line-strong);
}

.section-title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.section-subtitle {
  font-size: var(--fs-base);
  color: var(--text-2);
  max-width: 46ch;
}

@media (min-width: 900px) {
  .section-header {
    grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
    column-gap: 64px;
    align-items: end;
  }

  .section-header .section-tag,
  .section-header .section-title {
    grid-column: 1;
  }

  .section-header .section-subtitle {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
    padding-bottom: 0.35em;
  }
}

/* ─── 8. ABOUT ───────────────────────────────────────────── */
.about {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(40px, 5.5vw, 80px);
  align-items: start;
}

/* Profile */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: left;
}

.profile-img-wrapper {
  width: 100%;
  margin-bottom: 20px;
}

.profile-img-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.profile-img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92);
  transition: filter 0.4s var(--ease), transform 0.6s var(--ease-out);
}

.profile-card:hover .profile-img-placeholder img {
  filter: saturate(1);
  transform: scale(1.02);
}

.profile-name {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.profile-role {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 18px;
}

.profile-location,
.profile-edu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

.profile-edu {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.profile-location i,
.profile-edu i {
  width: 14px;
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: center;
}

.resume-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.resume-btn:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.profile-socials {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 0.9375rem;
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.social-link:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--bg-alt);
}

/* Bio */
.about-bio {
  color: var(--text-2);
  margin-bottom: 20px;
  max-width: 68ch;
}

.about-bio:first-of-type {
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--text);
}

.about-bio strong {
  color: var(--text);
  font-weight: 550;
}

/* Skills */
.skills-title,
.tech-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 18px;
}

.skills-title::after,
.tech-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.skills-section {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 450;
  color: var(--text-2);
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.skill-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.skill-chip-icon {
  display: inline-flex;
  font-size: 0.8125rem;
  color: var(--text-3);
  transition: color var(--duration) var(--ease);
}

.skill-chip:hover .skill-chip-icon {
  color: var(--accent);
}

/* Tech stack — a spec table, not a card wall */
.tech-stack {
  margin-top: clamp(56px, 6vw, 88px);
}

/* Nine items, so the column count always divides evenly — no ragged cells */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

@media (min-width: 1100px) {
  .tech-grid {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
}

.tech-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 88px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
  font-weight: 450;
  text-align: center;
  color: var(--text-2);
  transition: background-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.tech-card:hover {
  background: var(--surface);
  color: var(--text);
}

.tech-card.highlight {
  color: var(--text);
  background: var(--accent-soft);
}

.tech-icon {
  font-size: 1.0625rem;
  color: var(--text-3);
  transition: color var(--duration) var(--ease);
}

.tech-card:hover .tech-icon {
  color: var(--text);
}

.tech-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.7;
  transition: filter var(--duration) var(--ease), opacity var(--duration) var(--ease);
}

.tech-card:hover .tech-img,
.tech-card.highlight .tech-img {
  filter: grayscale(0);
  opacity: 1;
}

/* ─── 9. PROJECTS ────────────────────────────────────────── */
.projects {
  border-top: 1px solid var(--line);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 2.6vw, 34px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s var(--ease);
}

/* Accent hairline sweeps in on hover — the single flourish */
.project-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--ease-out);
}

.project-card:hover {
  background: var(--surface);
}

.project-card:hover::before,
.project-card:focus-within::before {
  transform: scaleX(1);
}

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

.card-icon-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

.card-icon {
  font-size: 0.9375rem;
  color: var(--text-2);
  transition: color var(--duration) var(--ease);
}

.project-card:hover .card-icon-wrap {
  border-color: var(--accent-line);
}

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

/* Category labels read as one quiet line, not a second tag system */
.card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tag {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
}

.card-tags .tag + .tag::before,
.proj-badge-row .tag + .tag::before {
  content: '·';
  margin: 0 7px;
  color: var(--line-strong);
}

.card-title {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 10px;
}

.card-desc {
  flex-grow: 1;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 24px;
  max-width: 52ch;
}

.card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 26px;
}

.tech-tag,
.tech-pill {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-3);
  white-space: nowrap;
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.project-card:hover .tech-tag {
  color: var(--text-2);
  border-color: var(--line-strong);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.btn-card {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  transition: color var(--duration) var(--ease);
}

.btn-card i {
  font-size: 0.75rem;
  color: var(--accent);
  transition: transform 0.25s var(--ease-out);
}

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

.btn-card:hover i {
  transform: translateX(4px);
}

.btn-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 0.9375rem;
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.btn-card-icon:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

/* ─── 10. CONTACT ────────────────────────────────────────── */
.contact {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(40px, 5.5vw, 80px);
  align-items: start;
}

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

.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.contact-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 0.9375rem;
  color: var(--text-2);
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.contact-item:hover .contact-icon {
  color: var(--accent);
  border-color: var(--accent-line);
}

.contact-item h4 {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 3px;
}

.contact-item a {
  font-size: var(--fs-base);
  font-weight: 450;
  color: var(--text);
  overflow-wrap: anywhere;
  transition: color var(--duration) var(--ease);
}

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

.availability-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  padding: 16px 18px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  border-radius: var(--r);
}

.avail-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse-dot 2.6s ease-in-out infinite;
}

.availability-card strong {
  display: block;
  font-size: var(--fs-base);
  font-weight: 550;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.availability-card p {
  font-size: var(--fs-sm);
  color: var(--text-2);
}

/* Form */
.contact-form-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 36px);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.form-group label {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-3);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: 1.6;
  outline: none;
  resize: vertical;
  transition: border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.form-group input {
  min-height: 46px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-3);
  opacity: 0.8;
}

.form-group input:hover,
.form-group textarea:hover {
  border-color: var(--line-strong);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: none;
}

/* ─── 11. FOOTER ─────────────────────────────────────────── */
.footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 36px 0;
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logo {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.footer-copy {
  font-size: var(--fs-sm);
  color: var(--text-3);
}

.footer-copy .gradient-text {
  color: var(--text-2);
  font-weight: 500;
}

.footer-socials {
  display: flex;
  gap: 8px;
}

.footer-socials a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 0.875rem;
  transition: color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
}

.footer-socials a:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--text-2);
  font-size: 0.8125rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease),
    visibility 0.25s, color var(--duration) var(--ease),
    border-color var(--duration) var(--ease);
  z-index: 500;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* ─── 12. MOTION ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes scroll-line {
  0% { transform: translateX(-18px); }
  100% { transform: translateX(52px); }
}

/* ─── 13. RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --container: 960px;
  }

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

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

  /* One column beats two cramped ones — keeps the reading measure intact */
  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .profile-img-wrapper {
    margin-bottom: 0;
  }

  .profile-socials {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
}

@media (max-width: 767px) {
  :root {
    --gutter: 20px;
  }

  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(320px, 84vw);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: calc(var(--nav-h) + 24px) 24px 32px;
    background: var(--bg);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.35s var(--ease), visibility 0.35s;
    z-index: 1000;
    overflow-y: auto;
  }

  .nav-links.open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-links li {
    border-bottom: 1px solid var(--line);
  }

  .nav-link {
    padding: 16px 0;
    font-size: 1rem;
    font-weight: 500;
  }

  .nav-link::after {
    left: 0;
    right: auto;
    bottom: 50%;
    width: 0;
    height: 1px;
  }

  .nav-link.active {
    color: var(--accent);
  }

  .profile-card {
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 20px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .profile-card {
    display: block;
  }

  .profile-img-wrapper {
    width: 128px;
    margin-bottom: 20px;
  }

  .profile-socials {
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .hero-content {
    padding: calc(var(--nav-h) + 56px) var(--gutter) 80px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 56px;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .stat-divider {
    display: none;
  }

  .stat-num {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.5625rem;
    letter-spacing: 0.08em;
  }

  .card-header {
    margin-bottom: 20px;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
  }
}

/* ─── 14. 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;
  }

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

  .hero::before {
    display: none;
  }
}
