/* Edwar Bechara · Marketing Creativo Innovador
   Sistema visual del portafolio. Sin frameworks: todo cabe en este archivo. */

:root {
  --bg: #0d0e0b;
  --bg-2: #12140f;
  --surface: #171a13;
  --surface-2: #1d2118;
  --line: #2a2f22;
  --line-strong: #3b4230;
  --text: #ecebe3;
  --muted: #a3a397;
  --soft: #74756a;
  --accent: #c8f031;
  --accent-ink: #11140a;
  --accent-text: #c8f031;
  --warn: #ff8a3d;
  --grid: rgba(200, 240, 49, 0.045);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f3f1e8;
    --bg-2: #ebe8dc;
    --surface: #fbfaf5;
    --surface-2: #f1efe5;
    --line: #dcd8c8;
    --line-strong: #c3bea9;
    --text: #171811;
    --muted: #55564b;
    --soft: #7d7e71;
    --accent: #c8f031;
    --accent-ink: #11140a;
    --accent-text: #4a6400;
    --warn: #c2410c;
    --grid: rgba(23, 24, 17, 0.045);
    color-scheme: light;
  }
}

:root[data-theme='light'] {
  --bg: #f3f1e8;
  --bg-2: #ebe8dc;
  --surface: #fbfaf5;
  --surface-2: #f1efe5;
  --line: #dcd8c8;
  --line-strong: #c3bea9;
  --text: #171811;
  --muted: #55564b;
  --soft: #7d7e71;
  --accent-text: #4a6400;
  --warn: #c2410c;
  --grid: rgba(23, 24, 17, 0.045);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent-text); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.mono { font-family: var(--font-mono); font-feature-settings: 'zero' 1; letter-spacing: -0.01em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before { content: ''; width: 18px; height: 1px; background: currentColor; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }

/* ───────── Header ───────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.04em;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-name span { font-size: 11.5px; color: var(--soft); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  text-decoration: none;
  font-size: 14.5px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav .btn { margin-left: 8px; }

.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }

.menu-toggle { display: none; }

@media (max-width: 860px) {
  .menu-toggle {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    background: transparent; border: 1px solid var(--line); border-radius: 9px;
    color: var(--text); cursor: pointer;
  }
  .nav {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s var(--ease);
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { padding: 12px; font-size: 16px; }
  .nav .btn { margin: 8px 0 0; justify-content: center; }
  .nav .theme-toggle { width: 100%; }
}

/* ───────── Botones ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink) !important; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--text); }
.nav .btn-primary { padding: 9px 16px; font-size: 14px; }

/* ───────── Hero ───────── */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 120px) 0 clamp(56px, 8vw, 96px);
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.4vw, 82px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 22px 0 24px;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--accent-text); }
.hero-lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 40ch; margin: 0 0 32px; }
.hero-lead strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.availability { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }

/* Panel en vivo */
.live-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.6);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  gap: 12px;
}
.panel-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head .live { flex-shrink: 0; }
.panel-head .live { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-text); }
.panel-head .live .status-dot { width: 6px; height: 6px; }
.panel-body { padding: 18px 16px 16px; }
.vitals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.vital { background: var(--surface); padding: 14px 12px; min-width: 0; }
.vital dt { font-family: var(--font-mono); font-size: 10.5px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.08em; }
.vital dd { margin: 6px 0 0; font-family: var(--font-mono); font-size: clamp(18px, 2.2vw, 24px); font-weight: 600; letter-spacing: -0.03em; white-space: nowrap; }
.vital dd small { font-size: 12px; color: var(--soft); font-weight: 400; margin-left: 2px; }
.vital .grade { display: inline-block; margin-top: 6px; font-family: var(--font-mono); font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.vital .grade.is-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.spark { margin-top: 16px; }
.spark-label { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--soft); margin-bottom: 8px; }
.waterfall { display: grid; gap: 5px; }
.wf-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.wf-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-track { position: relative; height: 8px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.wf-bar { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; opacity: 0.85; transform-origin: left; animation: grow 0.9s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }

.panel-foot { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); line-height: 1.5; }
.panel-foot strong { color: var(--text); }

/* ───────── Contador global ───────── */
.ticker { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.ticker dl { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.ticker div { padding: 26px var(--gutter); border-right: 1px solid var(--line); }
.ticker div:last-child { border-right: 0; }
.ticker dt { font-size: 13.5px; color: var(--muted); order: 2; }
.ticker dd { margin: 0 0 4px; font-family: var(--font-mono); font-size: clamp(26px, 3.2vw, 38px); font-weight: 600; letter-spacing: -0.04em; }
.ticker div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
@media (max-width: 760px) {
  .ticker dl { grid-template-columns: repeat(2, 1fr); }
  .ticker div:nth-child(2) { border-right: 0; }
  .ticker div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

/* ───────── Secciones ───────── */
.section { padding: clamp(72px, 10vw, 128px) 0; border-bottom: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 14px 0 0;
  text-wrap: balance;
}
.section-head p { color: var(--muted); margin: 0; max-width: 48ch; justify-self: end; }
@media (max-width: 860px) {
  .section-head { grid-template-columns: 1fr; }
  .section-head p { justify-self: start; }
}

/* ───────── Proyecto destacado ───────── */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.3s;
  margin-bottom: 20px;
}
.feature:hover { border-color: var(--line-strong); }
.feature-copy { padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; gap: 18px; }
.feature-copy h3 { font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 42px); line-height: 1.02; letter-spacing: -0.03em; margin: 0; }
.feature-copy p { color: var(--muted); margin: 0; max-width: 48ch; }
.feature-visual { background: var(--bg-2); border-left: 1px solid var(--line); padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 14px; justify-content: center; min-width: 0; }
@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
  .feature-visual { border-left: 0; border-top: 1px solid var(--line); }
}

.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.metric { background: var(--surface); padding: 16px; }
.metric b { display: block; font-family: var(--font-mono); font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.04em; font-weight: 600; }
.metric span { font-size: 13px; color: var(--muted); }

.module-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.module-cloud span { font-family: var(--font-mono); font-size: 11.5px; padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.module-cloud span.is-hot { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text); margin-top: auto; }
.link-arrow svg { transition: transform 0.25s var(--ease); }
a:hover .link-arrow svg, .link-arrow:hover svg { transform: translateX(4px); }

/* ───────── Filtros y rejilla ───────── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.filter:hover { color: var(--text); border-color: var(--line-strong); }
.filter[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter .count { opacity: 0.55; margin-left: 4px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  min-height: 100%;
  transition: border-color 0.25s, transform 0.25s var(--ease), background 0.25s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); background: var(--surface-2); }
.card[hidden] { display: none; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--font-mono); font-size: 11.5px; color: var(--soft); }
.card h3 { font-family: var(--font-display); font-size: 23px; line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .card-metrics { display: flex; gap: 20px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: auto; }
.card .card-metrics b { display: block; font-family: var(--font-mono); font-size: 19px; letter-spacing: -0.03em; }
.card .card-metrics span { font-size: 12px; color: var(--soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--muted); padding: 3px 8px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--line); }

/* ───────── Servicios ───────── */
.services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.service { padding: clamp(24px, 3.5vw, 40px); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; background: var(--surface); }
.service:nth-child(2n) { border-right: 0; }
.service:nth-last-child(-n + 2) { border-bottom: 0; }
.service .num { font-family: var(--font-mono); font-size: 12px; color: var(--accent-text); }
.service h3 { font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
.service p { margin: 0; color: var(--muted); }
.service ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.service li { position: relative; padding-left: 20px; font-size: 15px; }
.service li::before { content: '→'; position: absolute; left: 0; color: var(--soft); font-family: var(--font-mono); font-size: 13px; top: 2px; }
@media (max-width: 760px) {
  .services { grid-template-columns: 1fr; }
  .service { border-right: 0; }
  .service:nth-last-child(2) { border-bottom: 1px solid var(--line); }
}

/* ───────── Principios ───────── */
.principles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; counter-reset: p; }
.principle { padding-top: 18px; border-top: 2px solid var(--text); }
.principle h3 { font-size: 19px; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 10px; font-weight: 650; }
.principle p { margin: 0; color: var(--muted); font-size: 15px; }
@media (max-width: 960px) { .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 20px; } }
@media (max-width: 540px) { .principles { grid-template-columns: 1fr; } }

/* ───────── Sobre mí ───────── */
.about { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 88px); }
.about-card { position: sticky; top: 96px; align-self: start; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.about-portrait {
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg-2);
  display: grid; place-items: center;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: clamp(64px, 9vw, 112px);
  font-weight: 700;
  letter-spacing: -0.06em;
  color: var(--text);
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-facts { margin: 0; padding: 8px 20px 12px; }
.about-facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.about-facts div:last-child { border-bottom: 0; }
.about-facts dt { color: var(--soft); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px; }
.about-facts dd { margin: 0; text-align: right; }
.about-text h2 { font-family: var(--font-display); font-size: clamp(30px, 4vw, 48px); letter-spacing: -0.03em; line-height: 1.05; margin: 14px 0 28px; text-wrap: balance; }
.about-text p { color: var(--muted); font-size: 18px; margin: 0 0 20px; max-width: 60ch; }
.about-text p strong { color: var(--text); font-weight: 600; }
.stack-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 36px 0 0; padding: 0; list-style: none; }
.stack-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.stack-list li span { font-family: var(--font-mono); font-size: 12px; color: var(--soft); text-align: right; }
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about-card { position: static; }
  .stack-list { grid-template-columns: 1fr; }
}

/* ───────── Contacto ───────── */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.contact h2 { font-family: var(--font-display); font-size: clamp(38px, 5.6vw, 72px); line-height: 0.98; letter-spacing: -0.035em; margin: 14px 0 22px; text-wrap: balance; }
.contact p { color: var(--muted); max-width: 44ch; }
.form { display: grid; gap: 14px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--font-mono); font-size: 11.5px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.08em; }
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { cursor: pointer; position: relative; }
.chips input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; font-size: 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); transition: all 0.2s; }
.chips input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form .btn { justify-content: center; margin-top: 6px; }
.form-note { font-size: 13px; color: var(--soft); margin: 0; text-align: center; }

/* ───────── Footer ───────── */
.site-footer { padding: 40px 0 56px; font-size: 14px; color: var(--soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ───────── Caso de estudio ───────── */
.case-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--line); }
.back { display: flex; width: max-content; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); text-decoration: none; margin-bottom: 36px; }
.back:hover { color: var(--text); }
.case-hero h1 { font-family: var(--font-display); font-size: clamp(40px, 6.5vw, 84px); line-height: 0.98; letter-spacing: -0.04em; margin: 16px 0 22px; text-wrap: balance; }
.case-hero .lead { font-size: clamp(18px, 1.9vw, 23px); color: var(--muted); max-width: 46ch; margin: 0; }
.case-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 40px; }
.case-meta div { background: var(--surface); padding: 16px 18px; }
.case-meta dt { font-family: var(--font-mono); font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.08em; }
.case-meta dd { margin: 6px 0 0; font-size: 15px; }
@media (max-width: 640px) { .case-meta { grid-template-columns: 1fr; } }

.case-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-bottom: 1px solid var(--line); background: var(--bg-2); }
.case-metrics div { padding: 28px var(--gutter); border-right: 1px solid var(--line); }
.case-metrics div:last-child { border-right: 0; }
.case-metrics b { display: block; font-family: var(--font-mono); font-size: clamp(30px, 4vw, 46px); letter-spacing: -0.05em; font-weight: 600; color: var(--accent-text); }
.case-metrics span { color: var(--muted); font-size: 14px; }

.case-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); padding-block: clamp(56px, 8vw, 104px); }
.case-toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 2px; font-family: var(--font-mono); font-size: 12.5px; }
.case-toc a { text-decoration: none; color: var(--soft); padding: 6px 0 6px 14px; border-left: 1px solid var(--line); }
.case-toc a:hover { color: var(--text); border-left-color: var(--text); }
.case-section { margin-bottom: clamp(48px, 6vw, 72px); }
.case-section h2 { font-family: var(--font-display); font-size: clamp(26px, 3vw, 36px); letter-spacing: -0.025em; line-height: 1.1; margin: 10px 0 18px; }
.case-section p { font-size: 18px; color: var(--muted); max-width: 66ch; margin: 0; }
.case-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: c; max-width: 72ch; }
.case-list li { counter-increment: c; display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.case-list li::before { content: counter(c, decimal-leading-zero); font-family: var(--font-mono); font-size: 12px; color: var(--accent-text); padding-top: 4px; }
.case-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
@media (max-width: 860px) {
  .case-body { grid-template-columns: 1fr; }
  .case-toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .case-toc a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
}

.next-case { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: clamp(32px, 5vw, 56px) 0; text-decoration: none; }
.next-case span { font-family: var(--font-mono); font-size: 12px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.08em; }
.next-case strong { display: block; font-family: var(--font-display); font-size: clamp(28px, 4vw, 48px); letter-spacing: -0.03em; line-height: 1.05; margin-top: 8px; }
.next-case:hover strong { color: var(--accent-text); }

/* ───────── Indicador de velocidad flotante ───────── */
.perf-chip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s var(--ease);
}
.perf-chip.is-visible { opacity: 1; transform: none; }
@media (max-width: 640px) { .perf-chip { display: none; } }
.perf-chip b { color: var(--text); font-weight: 600; }
.perf-chip .status-dot { width: 6px; height: 6px; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ═════════ Animaciones de scroll ═════════ */

/* Barra de progreso de lectura */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}

/* Aparición base: subir, aparecer y enfocar */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  filter: blur(6px);
  transition:
    opacity 0.8s var(--ease) var(--delay, 0ms),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0ms),
    filter 0.8s var(--ease) var(--delay, 0ms);
  will-change: opacity, transform;
}
.js .reveal.is-in { opacity: 1; transform: none; filter: none; }

/* Titulares de sección: barrido con máscara */
.js .section-head h2,
.js .about-text h2,
.js .contact h2,
.js .case-section h2 {
  clip-path: inset(0 0 100% 0);
  transform: translate3d(0, 0.35em, 0);
  transition:
    clip-path 1s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--delay, 0ms) + 120ms),
    transform 1s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--delay, 0ms) + 120ms);
}
.js .is-in h2,
.js h2.is-in { clip-path: inset(0 0 -0.2em 0); transform: none; }

/* Hero: entrada palabra por palabra */
.hero h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero h1 .w > span {
  display: inline-block;
  transform: translate3d(0, 105%, 0);
  animation: word-up 0.95s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--wi, 0) * 55ms + 80ms);
}
@keyframes word-up { to { transform: none; } }

.js .hero .availability,
.js .hero .hero-lead,
.js .hero .hero-cta,
.js .hero .live-panel {
  opacity: 0;
  animation: fade-up 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.js .hero .availability { animation-delay: 0ms; }
.js .hero .hero-lead { animation-delay: 520ms; }
.js .hero .hero-cta { animation-delay: 640ms; }
.js .hero .live-panel { animation-delay: 380ms; animation-duration: 1.1s; }
@keyframes fade-up {
  from { opacity: 0; transform: translate3d(0, 24px, 0); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* Parallax sutil del hero */
.hero::before { transform: translate3d(0, calc(var(--sy, 0) * 0.25px), 0); }
.hero .live-panel { translate: 0 calc(var(--sy, 0) * -0.06px); }

/* Filas de la cascada: crecen en orden */
.wf-row:nth-child(2) .wf-bar { animation-delay: 0.08s; }
.wf-row:nth-child(3) .wf-bar { animation-delay: 0.16s; }
.wf-row:nth-child(4) .wf-bar { animation-delay: 0.24s; }
.wf-row:nth-child(5) .wf-bar { animation-delay: 0.32s; }
.wf-row:nth-child(n + 6) .wf-bar { animation-delay: 0.4s; }

/* Foco de luz que sigue al cursor */
.card, .feature, .service { position: relative; }
.card::after, .feature::after, .service::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%);
}
.card:hover::after, .feature:hover::after, .service:hover::after { opacity: 1; }

/* Índice del caso: sección activa */
.case-toc a { transition: color 0.25s, border-color 0.25s, padding 0.3s var(--ease); }
.case-toc a.is-active { color: var(--accent-text); border-left-color: var(--accent); padding-left: 18px; }
@media (max-width: 860px) {
  .case-toc a.is-active { border-color: var(--accent); padding-left: 12px; }
}

/* Líneas de principios: se dibujan al entrar */
.principle { border-top: 0; position: relative; }
.principle::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--text);
  transform-origin: 0 50%;
}
.js .principle.reveal::before { transform: scaleX(0); transition: transform 1.1s cubic-bezier(0.16, 1, 0.3, 1) calc(var(--delay, 0ms) + 150ms); }
.js .principle.reveal.is-in::before { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; filter: none; }
  .js .section-head h2, .js .about-text h2, .js .contact h2, .js .case-section h2 { clip-path: none; transform: none; }
  .hero h1 .w > span { transform: none; }
  .js .hero .availability, .js .hero .hero-lead, .js .hero .hero-cta, .js .hero .live-panel { opacity: 1; }
  .hero::before, .hero .live-panel { transform: none; translate: none; }
  .js .principle.reveal::before { transform: none; }
  .scroll-progress { display: none; }
}

/* ═════════ Páginas legales ═════════ */
.legal-hero h1 { font-size: clamp(38px, 5.6vw, 72px); }
.legal-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.legal-tabs a {
  font-family: var(--font-mono); font-size: 12.5px; text-decoration: none;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.legal-tabs a:hover { color: var(--text); border-color: var(--line-strong); }
.legal-tabs a[aria-current='page'] { background: var(--text); color: var(--bg); border-color: var(--text); }

.legal-body { grid-template-columns: 240px minmax(0, 1fr); }
.legal-aside { position: sticky; top: 96px; align-self: start; display: grid; gap: 28px; }
.legal-aside .case-toc { position: static; }
.legal-meta { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.legal-meta div { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.legal-meta div:last-child { border-bottom: 0; }
.legal-meta dt { font-family: var(--font-mono); font-size: 10.5px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.08em; }
.legal-meta dd { margin: 4px 0 0; font-size: 14px; }

.legal-prose { max-width: 70ch; counter-reset: none; }
.legal-prose h2 {
  font-family: var(--font-display); font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; line-height: 1.15;
  margin: 48px 0 14px; padding-top: 24px; border-top: 1px solid var(--line); scroll-margin-top: 96px;
}
.legal-prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal-prose h3 { font-size: 18px; margin: 24px 0 8px; }
.legal-prose p, .legal-prose li { font-size: 17px; color: var(--muted); line-height: 1.7; }
.legal-prose p { margin: 0 0 14px; }
.legal-prose strong { color: var(--text); font-weight: 600; }
.legal-prose ul, .legal-prose ol { padding-left: 0; list-style: none; margin: 0 0 16px; display: grid; gap: 8px; }
.legal-prose ul li { position: relative; padding-left: 22px; }
.legal-prose ul li::before { content: '→'; position: absolute; left: 0; color: var(--accent-text); font-family: var(--font-mono); font-size: 13px; top: 3px; }
.legal-prose a { color: var(--text); }
.legal-cta {
  margin-top: 56px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.legal-cta p { margin: 0; color: var(--text); font-weight: 600; font-size: 18px; }

@media (max-width: 860px) {
  .legal-body { grid-template-columns: 1fr; }
  .legal-aside { position: static; }
  .legal-aside .case-toc { display: none; }
}
