/* ============================================================
   Landing page styles — extracted from tomas-portfolio-landing.html
   Design tokens + base styles + component styles
   ============================================================ */

/* --- Design tokens --- */
:root {
  --bg: #fff7ed;
  --surface: #ffffff;
  --surface-warm: #ffedd5;
  --fg: #2d2a26;
  --fg-2: #574f45;
  --muted: #7c6f64;
  --border: #eadfd3;
  --accent: #cc3e00;
  --accent-on: #ffffff;
  /* --accent is AA-compliant on light surfaces (>= 4.5:1) for text AND as
     button background. --accent-strong lets dark mode keep a bright text
     accent while buttons stay dark enough for white text to pass AA. */
  --accent-strong: #cc3e00;
  --accent-strong-hover: color-mix(in oklab, var(--accent-strong), black 8%);
  --accent-hover: color-mix(in oklab, var(--accent), black 8%);
  --success: #15803d;
  --success-hover: color-mix(in oklab, var(--success), black 8%);
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, Menlo, monospace;
  --font-editorial: "Cormorant Garamond", Georgia, serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-step: clamp(2rem, 4vw, 2.4rem);
  --leading-body: 1.5;
  --tracking-display: -0.025em;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --section-y-desktop: 96px;
  --section-y-tablet: 68px;
  --section-y-phone: 48px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --focus-ring: 0 0 0 4px rgba(255, 79, 0, 0.24);
  --motion-fast: 140ms;
  --motion-base: 220ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --container-max: 1160px;
  --container-gutter-desktop: 32px;
}

/* --- Reset --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

/* --- Dark mode --- */
html.dark {
  color-scheme: dark;
  --bg: #1a1714;
  --surface: #242019;
  --surface-warm: #2d2821;
  --fg: #f0ebe4;
  --fg-2: #c4b8a8;
  --muted: #938679;
  --border: #3a3429;
  --accent: #ff4f00;
  --accent-on: #ffffff;
  /* Bright orange passes AA on dark for TEXT, but white text on it is only
     3.3:1 — buttons use --accent-strong so white text passes 4.5:1. */
  --accent-strong: #cc3e00;
  --accent-strong-hover: color-mix(in oklab, var(--accent-strong), black 8%);
  /* On dark, text hovers BRIGHTEN (white mix) so contrast keeps rising
     instead of dropping below AA (black-mix would give only 4.23:1). */
  --accent-hover: color-mix(in oklab, var(--accent), white 12%);
  --focus-ring: rgba(255, 79, 0, 0.35);
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  transition: background 0.2s, color 0.2s;
}

/* --- Skip link --- */
.skip-link {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* NOTE: scoped under `body` to win over Tailwind's preflight reset
   (`h1-h6 { font-size/weight: inherit }`), which ships in a stylesheet
   loaded AFTER /landing.css and would otherwise nullify the scale. */
body h1, body h2, body h3, body h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
  color: var(--fg);
}

body h1 {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

body h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p { max-width: 100ch; }

/* --- Eyebrow --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: var(--space-4);
}
/* .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
} */

/* --- Editorial --- */
.editorial {
  font-family: var(--font-editorial);
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.012em;
}

/* --- Links --- */
a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color var(--motion-fast), text-decoration-color var(--motion-fast);
}
a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* --- Container --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-gutter-desktop);
}

/* --- Section defaults --- */
section {
  padding: var(--section-y-desktop) 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: var(--space-12);
}

.section-head .eyebrow { margin-bottom: var(--space-8); }
.section-head h2 { margin-bottom: var(--space-4); }
.section-head .lede {
  font-size: var(--text-lg);
  color: var(--fg-2);
  line-height: 1.45;
  max-width: 56ch;
}

/* --- Site nav --- */
/* Top state (default, no-JS): transparent, no border, brand hidden — the nav
   merges with the hero and shows links/toggles only. JS adds .is-scrolled
   past the 16px threshold; the class is the ONLY scrolled-state trigger. */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  transition: background var(--motion-base) var(--ease-standard),
              border-color var(--motion-base) var(--ease-standard);
}
/* Brand ALWAYS occupies its flex slot (32px photo + gap + name) in both states,
   so .nav-links/.lang-toggle/.theme-toggle/.nav-cta/.nav-toggle never move. */
.site-nav .nav-brand {
  opacity: 0;
  visibility: hidden;   /* leaves tab order + a11y tree; blocks pointer events */
  pointer-events: none; /* defensive — visibility already blocks interaction */
  transform: translateY(4px);          /* subtle exit drift */
  transition: opacity var(--motion-base) var(--ease-standard),
              transform var(--motion-base) var(--ease-standard),
              visibility 0s linear var(--motion-base); /* flips AFTER fade-out */
}
.site-nav .nav-brand .brand-photo {
  transform: scale(0.85);
  transition: transform var(--motion-base) var(--ease-standard);
}
.site-nav.is-scrolled {
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.site-nav.is-scrolled .nav-brand {
  opacity: 1;
  visibility: visible;  /* flips instantly so the fade-in is visible */
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity var(--motion-base) var(--ease-standard),
              transform var(--motion-base) var(--ease-standard),
              visibility 0s linear 0s;
}
.site-nav.is-scrolled .nav-brand .brand-photo { transform: scale(1); }
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px; /* locked in both states — dropdown top: 64px stays valid */
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--fg);
}
.nav-brand:hover { color: var(--fg); text-decoration: none; }
.nav-brand .brand-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.nav-brand .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: var(--tracking-display);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-2);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--motion-fast), background var(--motion-fast);
}
.nav-links a:hover {
  color: var(--fg);
  background: var(--surface-warm);
}
.nav-links a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 0 var(--accent);
  border-radius: 0;
  background: transparent;
}

/* --- Nav CTA --- */
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 14px;
  background: var(--accent-strong);
  color: var(--accent-on);
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--motion-fast), opacity var(--motion-base), visibility var(--motion-base);
}
.nav-cta:hover {
  background: var(--accent-strong-hover);
  color: var(--accent-on);
  text-decoration: none;
}
.nav-cta.bg-success {
  background: var(--success);
}
.nav-cta.bg-success:hover {
  background: var(--success-hover);
}
/* The lang/theme/available controls form a compact cluster on the right,
   instead of being spread across the bar. */
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-cta .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 color-mix(in oklab, #fff 100%, transparent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* --- Lang toggle --- */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.lang-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 5px 10px;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color var(--motion-fast), background var(--motion-fast);
  line-height: 1;
}
.lang-btn:hover { color: var(--fg); }
.lang-btn.is-active {
  background: var(--fg);
  color: var(--bg);
}
.lang-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* --- Theme toggle --- */
.theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--fg-2);
  padding: 0;
  transition: color var(--motion-fast), background var(--motion-fast);
}
.theme-toggle:hover {
  color: var(--fg);
  background: var(--surface-warm);
}
.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
html.dark .theme-toggle .sun-icon { display: block; }
html.dark .theme-toggle .moon-icon { display: none; }

/* --- Nav toggle (mobile) --- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.nav-toggle:hover { background: var(--surface-warm); }
.nav-toggle svg { width: 20px; height: 20px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  padding: 14px 22px;
  background: var(--accent-strong);
  color: var(--accent-on);
  border-color: var(--accent-strong);
  border-radius: var(--radius-md);
}
.btn-primary:hover {
  background: var(--accent-strong-hover);
  border-color: var(--accent-strong-hover);
  color: var(--accent-on);
}
.btn-ghost {
  padding: 14px 22px;
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
  border-radius: var(--radius-md);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--fg);
  color: var(--fg);
}
.btn-cv {
  position: relative;
  padding-left: 36px;
}
.btn-cv::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px var(--bg);
}
.btn-cv:hover::before {
  background: var(--accent-strong-hover);
}

/* --- Unified card system --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  transition: border-color var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card .card__num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}
.card h3 {
  margin-bottom: var(--space-2);
}
.card .card__role {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--space-3);
}
.card .card__desc {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: 1.6;
  flex: 1;
  margin-bottom: var(--space-5);
}
.card .card__techs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--space-5);
}
.card .card__techs span {
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}
.card .card__links {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.card .card__links a {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.card .card__links a::after {
  content: "\2192";
  transition: transform var(--motion-fast);
}
.card .card__links a:hover { color: var(--accent); text-decoration: none; }
.card .card__links a:hover::after { transform: translateX(3px); }

/* Card: service modifier */
.card--service { padding: var(--space-6); }
.card--service h3 { margin-bottom: var(--space-3); }
.card--service p {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: 1.55;
  margin-bottom: var(--space-4);
}
.card--service .card__deliverables {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
}
.card--service .card__deliverables li {
  font-size: var(--text-xs);
  color: var(--muted);
  padding: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card--service .card__deliverables li::before { content: "\2022"; color: var(--accent); }

/* Card: project modifier */
.card--project .card__num { margin-bottom: var(--space-3); }

/* Card: callout modifier */
.card--callout {
  padding: clamp(24px, 4vw, 40px);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-8);
  align-items: start;
  transform: none;
}
.card--callout:hover { transform: none; border-color: var(--border); }
.card--callout h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--space-3);
}
.card--callout h2 .accent { color: var(--accent); }
.card--callout p {
  color: var(--fg-2);
  font-size: var(--text-base);
  line-height: 1.55;
}

/* --- Section transitions --- */
.section-shift--warm {
  background: var(--surface-warm);
  border-radius: var(--radius-lg);
  padding-left: var(--container-gutter-desktop);
  padding-right: var(--container-gutter-desktop);
}

/* --- Hero --- */
.hero {
  padding-top: clamp(48px, 8vw, 96px);
  padding-bottom: clamp(48px, 8vw, 96px);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -200px;
  top: 50%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 12%, transparent) 0%, transparent 70%);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }

.hero-content {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hero-name { display: block; }

.hero h1 { margin-bottom: var(--space-5); }

.hero-lede {
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  color: var(--fg-2);
  max-width: 60ch;
  line-height: 1.55;
  margin-bottom: var(--space-8);
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-12);
  justify-content: center;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  max-width: 600px;
  margin: 0 auto;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  /* Up to 4 per line; fewer items grow to fill and stay centered.
     Beyond 4, the wrap kicks in and lines stay centered. */
  flex: 1 1 calc((100% - 3 * var(--space-6)) / 4);
}
.stat .num {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.stat .num .unit {
  color: var(--accent);
  font-size: 0.6em;
  margin-left: 2px;
}
.stat .label {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.3;
}

/* --- Callout (About) --- */
.callout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.callout-cell {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.callout-cell .k {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.callout-cell .v {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--fg);
  line-height: 1.4;
}
.callout-cell .v.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.callout-cell .v.tag::before {
  content: "\2713";
  color: var(--accent);
  font-weight: 700;
}

/* --- Timeline (Experience) --- */
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.tl-item {
  display: grid;
  grid-template-columns: 200px 1fr 300px;
  gap: var(--space-6);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border);
}
.tl-item:first-child { padding-top: 0; }
.tl-item:last-child { border-bottom: 0; padding-bottom: 0; }

.tl-date {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
  padding-top: 4px;
  font-weight: 500;
  line-height: 1.4;
}
.tl-role .top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.tl-role h3 { margin: 0; }
.tl-role .company {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg);
}
.tl-role .company-context {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 500;
  margin: 6px 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tl-role .company-context::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.tl-role .role-core {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg);
  line-height: 1.6;
  margin: 0 0 var(--space-3);
}

/* --- Timeline stack column (right) --- */
.tl-stack {
  padding-top: 2px;
}
.tl-stack-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--space-3);
}
.tl-stack-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.tl-stack-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-2);
  cursor: default;
  transition: color var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast);
}
.tl-stack-item:hover {
  color: var(--fg);
  border-color: var(--fg);
  background: var(--surface-warm);
}
.tl-stack-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.55;
  transform: scale(0.9) translateY(1px);
  transition: opacity var(--motion-fast), transform var(--motion-fast);
}
.tl-stack-item:hover .tl-stack-icon {
  opacity: 1;
  transform: scale(1.05) translateY(0);
}

/* --- Project grid --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}
/* Last-row stretch: fill incomplete rows */
.project-grid > :nth-child(3n+1):last-child {
  grid-column: 1 / -1;
}
.project-grid > :nth-child(3n+2):last-child {
  grid-column: span 2;
}
/* --- Services grid --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
}

/* --- Process grid --- */
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}
.process-step { position: relative; }
.process-step .step-num {
  font-family: var(--font-display);
  font-size: var(--text-step);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
}
.process-step h3 { margin-bottom: 6px; }
.process-step p {
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: 1.55;
  max-width: 26ch;
}

/* --- Contact --- */
.contact {
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-12);
  align-items: center;
}
.contact .eyebrow { color: var(--accent); }
.contact h2 {
  color: var(--bg);
  margin-bottom: var(--space-4);
}
.contact h2 .editorial { color: var(--accent); font-weight: 300; }
.contact p {
  color: color-mix(in oklab, var(--bg) 75%, transparent);
  font-size: var(--text-lg);
  line-height: 1.5;
  max-width: 50ch;
}
.contact-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.contact-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 14px 18px;
  background: color-mix(in oklab, var(--bg) 6%, transparent);
  border: 1px solid color-mix(in oklab, var(--bg) 14%, transparent);
  border-radius: var(--radius-md);
  color: var(--bg);
  text-decoration: none;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.contact-link:hover {
  background: color-mix(in oklab, var(--bg) 10%, transparent);
  border-color: var(--accent);
  color: var(--bg);
  text-decoration: none;
}
.contact-link .label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.contact-link .label .k {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: color-mix(in oklab, var(--bg) 60%, transparent);
  font-weight: 600;
}
.contact-link .label .v { font-size: var(--text-base); font-weight: 500; }
.contact-link .arrow { color: var(--accent); font-size: 1.2rem; transition: transform var(--motion-fast); }
.contact-link:hover .arrow { transform: translateX(3px); }

/* CV download block — sits on the inverted .contact card (bg: var(--fg),
   text: var(--bg)), so the ghost button needs card-scoped colors. */
.contact-cv {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid color-mix(in oklab, var(--bg) 14%, transparent);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}
.contact-cv__hint {
  margin: 0;
  font-size: var(--text-sm);
  color: color-mix(in oklab, var(--bg) 65%, transparent);
}
.contact-cv .btn-ghost {
  color: var(--bg);
  border-color: color-mix(in oklab, var(--bg) 35%, transparent);
}
.contact-cv .btn-ghost:hover {
  color: var(--bg);
  background: color-mix(in oklab, var(--bg) 10%, transparent);
  border-color: var(--accent);
}
/* The .btn-cv dot ring normally matches the page background; inside the
   card it must match the card background instead. */
.contact-cv .btn-cv::before {
  box-shadow: 0 0 0 2px var(--fg);
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--muted);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.site-footer a { color: var(--fg-2); font-weight: 500; }
.site-footer a:hover { color: var(--accent); }

/* --- 404 --- */
.not-found {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.not-found h1 {
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.not-found p {
  font-size: var(--text-lg);
  color: var(--fg-2);
  margin-bottom: var(--space-8);
}

/* --- Responsive: 980px --- */
@media (max-width: 980px) {
  .hero-content { max-width: 100%; }
  .hero::after { display: none; }
  .card--callout { grid-template-columns: 1fr; }
  .process-grid { grid-template-columns: 1fr 1fr; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid > :nth-child(3n+1):last-child,
  .project-grid > :nth-child(3n+2):last-child { grid-column: unset; }
  .project-grid > :nth-child(2n+1):last-child { grid-column: 1 / -1; }
  .contact { grid-template-columns: 1fr; padding: var(--space-8); }
  /* Nav fit: keep the full nav (links + toggles + CTA) from overflowing
     below 980px — the es CTA + link labels are the widest; tighter
     padding/font keeps scrollWidth within the viewport at 768px. */
  .nav-links a { padding: 8px 10px; }
  .nav-cta { padding: 8px 10px; font-size: var(--text-xs); }
  .lang-btn { padding: 4px 8px; }
}

/* --- Responsive: 1020px (timeline collapses like ≤720) --- */
@media (max-width: 1020px) {
  .tl-item { grid-template-columns: 1fr; gap: var(--space-2); }
  .tl-date { font-size: var(--text-xs); order: 1; }
  .tl-role { order: 3; }
  .tl-stack {
    order: 2;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3) 0;
    margin: var(--space-2) 0;
  }
  .tl-stack-list { gap: 6px; }
}

/* --- Responsive: 720px --- */
@media (max-width: 720px) {
  :root { --container-gutter-desktop: 24px; }
  section { padding: var(--section-y-tablet) 0; }
  .nav-links { display: none; }
  .nav-toggle { display: grid; place-items: center; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--space-3);
    gap: 2px;
  }
  .nav-links.open a { padding: 12px 16px; font-size: var(--text-base); }
  .process-grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .project-grid { grid-template-columns: 1fr; }
  .project-grid > * { grid-column: unset; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .callout-grid { grid-template-columns: 1fr; }
}

/* --- Responsive: 480px --- */
@media (max-width: 480px) {
  :root { --container-gutter-desktop: 16px; }
  section { padding: var(--section-y-phone) 0; }
  .nav-cta span:not(.pulse) { display: none; }
  .nav-cta .pulse { margin: 0; }
  .lang-toggle { padding: 2px; }
  .lang-btn { padding: 4px 8px; font-size: var(--text-xs); }
  .project-grid { grid-template-columns: 1fr; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  /* Brand visibility delay would otherwise lag 220ms after the global
     duration flattening above — force instant flip. */
  .site-nav .nav-brand { transition-delay: 0s !important; }
}

/* --- Contact Modal --- */
dialog {
  margin: auto;
  padding: 0;
  max-width: 480px;
  width: calc(100% - var(--space-6));
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-body);
  animation: modalEnter var(--motion-base) var(--ease-standard);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog {
    animation: none;
  }
}

/* NOTE: no backdrop-filter here on purpose — a full-viewport blur forces the
   browser to re-composite the entire page on every frame while the modal is
   open, which tanks the frame rate (especially on Windows). A slightly darker
   solid overlay reads just as well for a fraction of the cost. */
dialog::backdrop {
  background: rgba(26, 23, 20, 0.78);
  animation: backdropEnter var(--motion-fast) var(--ease-standard);
}

@keyframes backdropEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

html.dark dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

/* While the modal is open, kill the nav's own 14px blur too — two nested
   full-viewport backdrop-filters (nav + overlay) is the worst compositing
   case. The tinted overlay keeps the page behind legible either way. */
html:has(dialog[open]) .site-nav.is-scrolled {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.contact-modal__header {
  position: relative;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.contact-modal__header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg);
}

.contact-modal__subtitle {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-2);
  line-height: 1.4;
}

.contact-modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--fg-2);
  cursor: pointer;
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast);
}

.contact-modal__close:hover {
  color: var(--fg);
  background: var(--surface-warm);
  border-color: var(--fg);
}

.contact-modal__close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.contact-modal__body {
  padding: var(--space-6);
}

.contact-modal__field {
  margin-bottom: var(--space-5);
}

.contact-modal__field:last-of-type {
  margin-bottom: var(--space-6);
}

.contact-modal__field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg);
  margin-bottom: var(--space-2);
}

.contact-modal__field input,
.contact-modal__field select,
.contact-modal__field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}

.contact-modal__field input:focus,
.contact-modal__field select:focus,
.contact-modal__field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}

.contact-modal__field input::placeholder,
.contact-modal__field textarea::placeholder {
  color: var(--muted);
}

.contact-modal__field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c6f64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

html.dark .contact-modal__field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a7e70' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.contact-modal__field textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.contact-modal__error {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--accent);
  line-height: 1.4;
}

/* Chrome paints autofilled fields pale gray-blue, which reads as "gray form
   when data is loaded". Match the surface so filled fields keep the tokens. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--fg);
}

.contact-modal__actions {
  margin-top: var(--space-2);
}

.contact-modal__submit {
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Loading/disabled: NO opacity fade — a dimmed full-width button reads as
   "gray/off" and was the source of the "modal turns gray" complaint. The
   spinner + "Enviando…" text carry the loading state, and the form keeps
   aria-busy while the request is in flight. */
.contact-modal__submit:disabled {
  cursor: not-allowed;
}

.contact-modal__submit-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.contact-modal__submit-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.contact-modal__status {
  margin-top: var(--space-4);
  padding: var(--space-3);
  font-size: var(--text-sm);
  text-align: center;
  border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent);
}

/* Dark mode overrides for modal */
html.dark dialog {
  background: var(--surface);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

html.dark .contact-modal__close {
  background: var(--surface);
  border-color: var(--border);
  color: var(--fg-2);
}

html.dark .contact-modal__close:hover {
  background: var(--surface-warm);
  border-color: var(--fg);
  color: var(--fg);
}

html.dark .contact-modal__field input,
html.dark .contact-modal__field select,
html.dark .contact-modal__field textarea {
  background: var(--bg);
  border-color: var(--border);
  color: var(--fg);
}

html.dark .contact-modal__field input:focus,
html.dark .contact-modal__field select:focus,
html.dark .contact-modal__field textarea:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

html.dark .contact-modal__status {
  background: color-mix(in oklab, var(--accent) 15%, transparent);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
}

/* Responsive: modal on small screens */
@media (max-width: 520px) {
  dialog {
    max-width: calc(100% - var(--space-4));
    width: calc(100% - var(--space-4));
    margin: var(--space-4) auto;
  }

  .contact-modal__header,
  .contact-modal__body {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* --- Print --- */
@media print {
  @page { margin: 1.5cm 2cm; size: A4; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .site-nav, .nav-cta, .hero::after, .card--callout, .services-grid, .process-grid, .contact, .nav-toggle, .lang-toggle { display: none !important; }
  section { padding: 0.5cm 0 !important; }
  body h1 { font-size: 28pt; }
  body h2 { font-size: 16pt; }
  a { color: #000; text-decoration: underline; }
  .container { max-width: none !important; padding: 0 !important; }
}
