/* =========================================================
   HECTOR GALLARDO · PORTAFOLIO  —  styles.css
   Identidad: paleta vino (#73030D · #732F3B · #F2F2F2 ·
   #8C8C8C · #0D0D0D), Anton para títulos, Inter + Noto Sans SC
   para texto. Tema oscuro por defecto y tema claro.
   ========================================================= */

/* ---------- Tokens: tema oscuro (por defecto) ---------- */
:root {
  /* Paleta de marca */
  --wine: #73030D;
  --wine-2: #732F3B;
  --paper: #F2F2F2;
  --steel: #8C8C8C;
  --ink: #0D0D0D;
  --wine-hi: #8E0A18;

  /* Superficies y texto */
  --bg: #0D0D0D;
  --bg-2: #131011;
  --surface: #171314;
  --surface-2: #1F191B;
  --text: #F2F2F2;
  --text-2: #D2CDCF;
  --muted: #A39C9E;
  --line: rgba(242, 242, 242, .10);
  --line-strong: rgba(242, 242, 242, .22);
  --line-red: rgba(170, 26, 42, .42);

  /* Acentos: vino para rellenos, vino encendido para texto sobre negro */
  --accent: #E0566B;
  --fill: #73030D;
  --fill-hover: #8E0A18;
  --on-fill: #FFFFFF;
  --giant: #73030D;
  --glow: rgba(115, 3, 13, .38);

  /* Formularios, sombras, marcadores de imagen */
  --input: #141112;
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, .85);
  --ph-a: #1E1416;
  --ph-b: #0F0C0D;
  --ph-ink: #CFC8CA;
  --head-bg: rgba(13, 13, 13, .78);

  /* Tipografía */
  --f-display: 'Anton', 'Noto Sans SC', Impact, 'Arial Narrow', sans-serif;
  --f-body: 'Inter', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-script: 'Mrs Saint Delafield', 'Allura', cursive;
  --w-display: 400;

  /* Layout */
  --maxw: 1320px;
  --pad: max(16px, clamp(20px, 3.2vw, 44px));
  --head-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

/* ---------- Tokens: tema claro ---------- */
:root[data-theme="light"] {
  --bg: #F2F2F2;
  --bg-2: #EAE6E7;
  --surface: #FFFFFF;
  --surface-2: #E8E3E4;
  --text: #0D0D0D;
  --text-2: #2E292B;
  --muted: #5E5759;
  --line: rgba(13, 13, 13, .10);
  --line-strong: rgba(13, 13, 13, .22);
  --line-red: rgba(115, 3, 13, .30);

  --accent: #73030D;
  --fill: #73030D;
  --fill-hover: #8E0A18;
  --on-fill: #FFFFFF;
  --giant: #73030D;
  --glow: rgba(115, 3, 13, .12);

  --input: #FFFFFF;
  --shadow: 0 24px 48px -26px rgba(60, 10, 18, .35);
  --ph-a: #E6DFE0;
  --ph-b: #D6CCCE;
  --ph-ink: #3A3335;
  --head-bg: rgba(242, 242, 242, .84);
  color-scheme: light;
}

/* Chino: los títulos caen a Noto Sans SC en negrita (sin negrita falsa en Anton) */
:root:lang(zh-Hans) { --w-display: 700; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s ease, color .4s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--wine); color: #fff; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--fill); color: var(--on-fill); padding: 10px 16px; border-radius: 6px;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Utilidades ---------- */
.ico { width: 18px; height: 18px; flex: none; }
.arrow { width: 40px; height: 16px; flex: none; }
.arrow--up { width: 14px; height: 24px; transform: rotate(-90deg); }
.red { color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.display { font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none; }
.h-sm { font-family: var(--f-body); font-weight: 600; font-size: clamp(1.05rem, 1.4vw, 1.3rem); letter-spacing: .02em; text-transform: uppercase; }
.h-md { font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: .02em; line-height: 1.05; }
.h-lg { font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none; font-size: clamp(2.4rem, 4.6vw, 4.2rem); line-height: .98; letter-spacing: .01em; text-wrap: balance; }
.h-xl { font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none; font-size: clamp(2.6rem, 5.6vw, 5.2rem); line-height: .94; letter-spacing: .005em; text-wrap: balance; }
.h-red { color: var(--accent); font-size: .78rem; font-weight: 600; letter-spacing: .1em; margin: 26px 0 14px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--accent); font-size: .68rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
}
.eyebrow::before { content: ''; width: 18px; height: 1px; background: currentColor; }
:lang(zh-Hans) .eyebrow, :lang(zh-Hans) .h-sm { letter-spacing: .08em; }

.section { padding: clamp(40px, 5vw, 72px) var(--pad); }

/* Mientras se aplica un idioma distinto al español (ver <script> del <head>) */
.i18n-wait body { visibility: hidden; }

/* Aparición al hacer scroll: JS solo marca los elementos que están debajo del pliegue */
.reveal-pending { opacity: 0; transform: translateY(18px); }
.reveal-pending.is-visible { opacity: 1; transform: none; transition: opacity .8s var(--ease), transform .8s var(--ease); }

/* ---------- Espacios para imágenes ---------- */
/* La imagen cubre el marcador. Si el archivo no existe, se oculta y queda el marcador con la ruta. */
.slot { position: relative; overflow: hidden; background: var(--ph-b); }
.slot > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; transition: transform .8s var(--ease), opacity .4s; }
.slot > img.is-missing { display: none; }
img.is-loaded ~ .ph { display: none; }
.js .slot > img:not(.is-loaded) { opacity: 0; }
.ph {
  position: absolute; inset: 0; z-index: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 6px;
  padding: clamp(14px, 1.8vw, 22px); text-align: left; color: var(--ph-ink);
  background:
    radial-gradient(70% 60% at 78% 22%, var(--glow), transparent 70%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(127, 127, 127, .06) 14px 15px),
    linear-gradient(160deg, var(--ph-a), var(--ph-b));
}
.ph .ico { width: 22px; height: 22px; opacity: .55; margin-bottom: auto; }
.ph b { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.ph small { font-size: .6rem; letter-spacing: .04em; opacity: .6; word-break: break-all; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; }

/* =========================================================
   HEADER
   ========================================================= */
.site-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: var(--pad); padding-right: var(--pad);
  background: var(--head-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-red);
  transition: background .4s, border-color .4s;
}
.site-head__inner { max-width: var(--maxw); margin: 0 auto; height: var(--head-h); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; margin-right: auto; }
.brand__name { font-family: var(--f-display); font-size: 1.12rem; letter-spacing: .06em; color: var(--text); white-space: nowrap; }
.brand__sub { font-size: .58rem; letter-spacing: .16em; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.site-nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); }
.site-nav a { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-2); font-weight: 500; transition: color .25s; position: relative; padding: 6px 0; }
.site-nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.site-nav a:hover { color: var(--accent); }
.site-nav a:hover::after, .site-nav a[aria-current="true"]::after { transform: scaleX(1); }

.tools { display: flex; align-items: center; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text);
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; white-space: nowrap;
  transition: border-color .25s, background .25s, color .25s;
}
.tool:hover { border-color: var(--accent); }
.tool .ico { width: 16px; height: 16px; }
.tool--geo { max-width: 250px; }
.geo-text { overflow: hidden; text-overflow: ellipsis; }
.geo-flag { font-size: .95rem; line-height: 1; }
.tool--lang { padding-right: 8px; cursor: pointer; }
.tool--lang select {
  appearance: none; -webkit-appearance: none; border: 0; background: transparent; cursor: pointer;
  font-weight: 700; font-size: .72rem; letter-spacing: .06em; padding: 0 16px 0 0; height: 100%;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 6px center, right 2px center; background-size: 4px 4px; background-repeat: no-repeat;
}
.tool--lang select:focus-visible { outline: none; }
.tool--lang:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool--lang option { color: #0D0D0D; background: #F2F2F2; }
.tool--theme, .tool--menu { width: 38px; padding: 0; justify-content: center; }
.tool--theme .ic-moon { display: none; }
:root[data-theme="light"] .tool--theme .ic-sun { display: none; }
:root[data-theme="light"] .tool--theme .ic-moon { display: block; }
.tool--menu { display: none; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr;
  min-height: min(100svh, 920px);
  padding: calc(var(--head-h) + env(safe-area-inset-top, 0px)) var(--pad) 0;
  overflow: hidden;
  background: radial-gradient(60% 55% at 50% 38%, var(--glow), transparent 70%), var(--bg);
  border-bottom: 1px solid var(--line-red);
}
.hero__title {
  position: absolute; z-index: 1; left: 0; right: 0; top: calc(var(--head-h) + clamp(4px, 2vw, 28px));
  text-align: center;
  font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none;
  font-size: clamp(5rem, 21vw, 20rem); line-height: .86; letter-spacing: -.005em;
  color: var(--giant); white-space: nowrap; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, rgba(0, 0, 0, .12) 100%);
          mask-image: linear-gradient(to bottom, #000 35%, rgba(0, 0, 0, .12) 100%);
  transition: transform .25s ease-out;
}
.hero__photo {
  position: absolute; z-index: 2; left: 50%; bottom: 0;
  width: min(44vw, 540px); height: 86%;
  transform: translateX(-50%);
  background: transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
}
.hero__photo > img { object-fit: contain; object-position: bottom center; }
.slot--portrait .ph {
  align-items: center; text-align: center; justify-content: center; border-radius: 48% 48% 0 0 / 30% 30% 0 0;
  background:
    radial-gradient(42% 26% at 50% 30%, rgba(127, 127, 127, .12), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--ph-a) 85%, transparent), var(--ph-b) 70%);
  border: 1px dashed var(--line-strong); border-bottom: 0;
}
.slot--portrait .ph .ico { margin: 0 0 6px; }

.hero__intro { grid-column: 1; grid-row: 1; align-self: end; position: relative; z-index: 4; padding-bottom: clamp(26px, 3.4vw, 44px); }
.hero__name {
  font-family: var(--f-display); font-weight: var(--w-display); font-synthesis: none;
  font-size: clamp(3.4rem, 8vw, 7.6rem); line-height: .92; letter-spacing: .005em; text-transform: uppercase;
}
.hero__role { margin-top: 18px; color: var(--accent); font-weight: 600; letter-spacing: .06em; font-size: clamp(.85rem, 1.15vw, 1.05rem); }
.hero__bio { margin-top: 14px; max-width: 38ch; font-size: .84rem; color: var(--text-2); line-height: 1.7; }
.hero__cta { margin-top: 22px; }

.hero__side {
  grid-column: 3; grid-row: 1; position: relative; z-index: 4;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: 28px;
  padding-bottom: clamp(26px, 3.4vw, 44px);
}
.mx-pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line-red); background: color-mix(in srgb, var(--bg) 70%, transparent);
  font-size: .62rem; letter-spacing: .16em; font-weight: 600; transition: border-color .3s, background .3s;
}
.mx-pill:hover { border-color: var(--accent); background: var(--glow); }
.mx-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--glow); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

.stats { width: min(100%, 250px); }
.stats li { display: flex; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line-red); }
.stats li:last-child { border-bottom: 0; }
.stats strong {
  font-family: var(--f-display); font-weight: 400; color: var(--accent);
  font-size: clamp(2rem, 3vw, 2.8rem); line-height: 1; min-width: 3.4ch; flex: none; font-variant-numeric: tabular-nums;
}
.stats span { font-size: .58rem; letter-spacing: .14em; color: var(--muted); line-height: 1.6; }

/* =========================================================
   PROYECTOS
   ========================================================= */
.projects { border-bottom: 1px solid var(--line-red); max-width: none; }
.section__head { display: flex; align-items: center; gap: 28px; margin-bottom: 28px; }
.section__line { flex: 1; height: 1px; background: var(--line); }
.section__count { font-size: .62rem; letter-spacing: .16em; color: var(--muted); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 16px;
  font-size: .64rem; letter-spacing: .16em; color: var(--text-2); font-weight: 600; transition: color .3s;
}
.link-arrow .arrow { transition: transform .35s var(--ease); }
.link-arrow:hover { color: var(--accent); }
.link-arrow:hover .arrow { transform: translateX(6px); }

.projects__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 34px) clamp(16px, 2vw, 28px); }
.project { position: relative; min-width: 0; }
.project__thumb {
  display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  aspect-ratio: 16 / 10; text-align: left;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .3s;
}
.project:hover .project__thumb { transform: translateY(-6px); box-shadow: 0 26px 44px -22px var(--glow), var(--shadow); border-color: var(--line-red); }
.project:hover .project__thumb > img { transform: scale(1.04); }
.project__tag {
  position: absolute; z-index: 2; left: 14px; top: 14px;
  padding: 6px 10px; border-radius: 999px; font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
  background: rgba(13, 13, 13, .7); color: #F2F2F2; border: 1px solid rgba(242, 242, 242, .16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.project__meta { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-top: 16px; }
.project__num { font-family: var(--f-display); font-size: 2.2rem; color: var(--accent); line-height: 1; }
.project__meta h3 { font-size: .8rem; letter-spacing: .14em; font-weight: 600; }
.project__meta h3 a, .project__meta h3 button { color: inherit; background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; text-transform: uppercase; transition: color .3s; }
.project__meta h3 a::after, .project__meta h3 button::after { content: ''; position: absolute; inset: 0; z-index: 3; }
.project__meta p { font-size: .62rem; letter-spacing: .14em; color: var(--muted); margin-top: 2px; }
.project__meta .arrow { color: var(--text-2); transition: transform .35s var(--ease), color .3s; }
.project:hover .project__meta .arrow { transform: translateX(6px); color: var(--accent); }
.project:hover .project__meta h3 a, .project:hover .project__meta h3 button { color: var(--accent); }
.project:focus-within .project__thumb { border-color: var(--accent); }

/* =========================================================
   SERVICIOS · METEORO MX
   ========================================================= */
.services {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.6fr); gap: clamp(28px, 4vw, 64px);
  border-bottom: 1px solid var(--line-red);
  background: radial-gradient(50% 70% at 0% 0%, var(--glow), transparent 70%), var(--bg);
}
.services__intro { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.mx-logo { position: relative; height: 56px; width: 220px; max-width: 100%; }
.mx-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.mx-logo img:not(.is-loaded) { opacity: 0; }
.mx-logo img.is-missing { display: none; }
.mx-logo__text {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  font-family: var(--f-display); font-size: 2.3rem; letter-spacing: .04em; line-height: 1; color: var(--text);
}
.mx-logo__text b { font-weight: 400; color: var(--accent); margin-left: 4px; }
.mx-logo img.is-loaded + .mx-logo__text { display: none; }
.services__lead { color: var(--text-2); font-size: .92rem; line-height: 1.75; max-width: 46ch; }

.services__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line-red); border-radius: 8px; overflow: hidden; align-self: start; }
.svc { padding: clamp(22px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 12px; min-width: 0; background: var(--bg); transition: background .4s; }
.svc + .svc { border-left: 1px solid var(--line-red); }
.svc:hover { background: var(--bg-2); }
.svc__num { font-family: var(--f-display); font-size: 2.2rem; color: var(--accent); line-height: 1; }
.svc h3 { font-size: .8rem; letter-spacing: .12em; font-weight: 700; }
.svc p { font-size: .84rem; color: var(--text-2); }
.svc__list { display: grid; gap: 10px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.svc__list li { position: relative; padding-left: 18px; font-size: .78rem; color: var(--text-2); line-height: 1.5; }
.svc__list li::before { content: ''; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; background: var(--accent); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }

.svc-band {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(16px, 3vw, 40px);
  padding: clamp(18px, 2.4vw, 28px) clamp(18px, 2.6vw, 32px);
  border-radius: 8px; color: #F2F2F2;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 7px),
    linear-gradient(100deg, #73030D, #4A020A 60%, #2A0106);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.svc-band:hover { box-shadow: 0 22px 40px -20px rgba(115, 3, 13, .7); }
.svc-band__k { font-family: var(--f-display); font-size: clamp(1.8rem, 3.4vw, 2.8rem); letter-spacing: .04em; line-height: 1; }
.svc-band__t { font-size: .88rem; color: rgba(242, 242, 242, .86); }
.svc-band .arrow { color: #fff; transition: transform .35s var(--ease); }
.svc-band:hover .arrow { transform: translateX(8px); }

/* =========================================================
   TRIO: Skills | Workflow | Citas
   ========================================================= */
.trio { display: grid; grid-template-columns: 1fr 1.25fr .9fr; border-bottom: 1px solid var(--line-red); }
.trio__col { min-width: 0; }
.trio__edu, .trio__process { border-right: 1px solid var(--line-red); }

.edu li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; font-size: .76rem; }
.edu strong { display: block; font-weight: 500; }
.edu span { color: var(--muted); font-size: .68rem; }
.edu time { color: var(--accent); font-size: .66rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.edu li + li { border-top: 1px solid var(--line); }
.edu { border-bottom: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: .58rem; letter-spacing: .1em; text-align: center; white-space: nowrap;
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--text-2);
  transition: border-color .3s, color .3s, background .3s, transform .3s var(--ease);
}
.chips li:hover { border-color: var(--accent); color: var(--text); background: var(--glow); }

.process { margin-top: 24px; }
.process li { display: grid; grid-template-columns: 30px 46px minmax(0, 1fr); gap: 16px; align-items: start; padding-bottom: 22px; position: relative; }
.process li:last-child { padding-bottom: 0; }
.process__num { font-size: .78rem; color: var(--accent); padding-top: 12px; font-variant-numeric: tabular-nums; }
.process__icon {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-red); background: var(--bg); color: var(--text);
  transition: background .3s, border-color .3s, transform .3s var(--ease), color .3s;
}
.process li:not(:last-child) .process__icon::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: 26px; background: var(--line-red); }
.process li:hover .process__icon { background: var(--fill); border-color: var(--fill); color: var(--on-fill); transform: scale(1.08); }
.process h3 { font-size: .7rem; letter-spacing: .12em; color: var(--accent); font-weight: 700; margin-top: 2px; }
.process p { font-size: .74rem; color: var(--text-2); line-height: 1.6; max-width: 40ch; margin-top: 3px; }

.trio__quote {
  position: relative; display: flex; flex-direction: column; gap: 18px; color: #F2F2F2;
  padding: clamp(28px, 3.4vw, 44px);
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 7px),
    radial-gradient(90% 70% at 20% 0%, #8E0A18, transparent 70%),
    linear-gradient(180deg, #73030D, #320207);
}
.quote__mark { width: 28px; color: #F08A98; }
.quote__mark--2 { margin-top: 10px; }
.trio__quote blockquote { font-size: clamp(1rem, 1.35vw, 1.18rem); line-height: 1.55; font-weight: 300; }
.signature { font-family: var(--f-script); font-size: 3rem; line-height: 1; margin-top: auto; padding-top: 18px; transform: rotate(-4deg); transform-origin: left; }

/* =========================================================
   SOBRE MÍ + POEMARIO
   ========================================================= */
.about { border-bottom: 1px solid var(--line-red); }
.about__grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); gap: clamp(28px, 5vw, 80px); align-items: start; }
.about__photo { aspect-ratio: 4 / 5; border-radius: 6px; border: 1px solid var(--line); }
.about__copy { display: flex; flex-direction: column; gap: 18px; }
.about__lead { font-size: clamp(1rem, 1.35vw, 1.2rem); line-height: 1.6; color: var(--text); max-width: 56ch; }
.about__copy > p:not(.about__lead) { font-size: .9rem; color: var(--text-2); line-height: 1.75; max-width: 60ch; }
.facets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 10px; border-top: 1px solid var(--line-red); }
.facets li { padding: 22px 22px 22px 0; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line-red); min-width: 0; }
.facets li:nth-child(even) { padding-left: 22px; border-left: 1px solid var(--line-red); }
.facets__k { font-family: var(--f-display); font-size: 1.5rem; color: var(--accent); line-height: 1; }
.facets h3 { font-size: .72rem; letter-spacing: .14em; font-weight: 700; }
.facets p { font-size: .8rem; color: var(--text-2); line-height: 1.6; }
.facets__link { display: inline-flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 6px; font-size: .6rem; letter-spacing: .16em; font-weight: 600; color: var(--accent); }
.facets__link .arrow { width: 28px; height: 12px; transition: transform .35s var(--ease); }
.facets__link:hover .arrow { transform: translateX(6px); }

.book {
  display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center;
  margin-top: clamp(40px, 6vw, 80px); padding: clamp(22px, 3vw, 40px);
  border: 1px solid var(--line-red); border-radius: 10px;
  background: radial-gradient(70% 90% at 100% 0%, var(--glow), transparent 70%), var(--bg-2);
}
.book__cover { aspect-ratio: 2 / 3; border-radius: 3px 8px 8px 3px; box-shadow: -10px 0 0 -4px var(--wine) inset, 0 30px 50px -24px rgba(0, 0, 0, .7); transform: perspective(900px) rotateY(-10deg); transition: transform .6s var(--ease); }
.book:hover .book__cover { transform: perspective(900px) rotateY(-2deg); }
.book__copy { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; min-width: 0; }
.book__title { font-family: var(--f-display); font-weight: 400; font-size: clamp(2.2rem, 4.4vw, 3.8rem); line-height: .96; letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.book__copy > p { font-size: .9rem; color: var(--text-2); line-height: 1.75; max-width: 60ch; }
.book__for { font-style: italic; color: var(--text) !important; }
.chips--row li { white-space: normal; }

.about__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: clamp(28px, 4vw, 48px); }
.motto { font-family: var(--f-display); font-size: clamp(1.3rem, 2.4vw, 2rem); letter-spacing: .02em; text-transform: uppercase; color: var(--accent); line-height: 1.1; max-width: 30ch; }
:lang(zh-Hans) .motto { font-weight: 700; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; }
.socials a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .7rem; letter-spacing: .1em; font-weight: 600; transition: border-color .3s, color .3s; }
.socials a:hover { border-color: var(--accent); color: var(--accent); }
.socials .ico { width: 15px; height: 15px; }

/* =========================================================
   BOTONES
   ========================================================= */
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.btn-solid {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 50px;
  padding: 14px 22px; border: 0; border-radius: 6px;
  background: var(--fill); color: var(--on-fill); font-size: .7rem; letter-spacing: .16em; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: background .3s, transform .3s var(--ease), box-shadow .3s;
}
.btn-solid:hover { background: var(--fill-hover); box-shadow: 0 14px 28px -14px rgba(115, 3, 13, .8); }
.btn-solid:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-solid .arrow { width: 26px; height: 12px; }
.btn-solid--full { width: 100%; justify-content: space-between; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 14px 22px;
  border: 1px solid var(--line-strong); border-radius: 6px; font-size: .7rem; letter-spacing: .16em; font-weight: 600;
  transition: border-color .3s, color .3s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-circle { display: inline-flex; align-items: center; gap: 14px; background: none; border: 0; padding: 0; font-size: .62rem; letter-spacing: .16em; font-weight: 600; color: var(--accent); }
.btn-circle__ring { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--accent); transition: background .3s, color .3s; }
.btn-circle:hover .btn-circle__ring { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }

/* =========================================================
   CONTACTO
   ========================================================= */
.contact {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: clamp(20px, 3vw, 48px); align-items: center;
  background: radial-gradient(60% 90% at 85% 70%, var(--glow), transparent 70%), var(--bg);
}
.contact__cta { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.contact__cta p { max-width: 34ch; font-size: .84rem; color: var(--text-2); }
.contact__cta .btn-row { margin-top: 10px; }
.contact__list li { display: flex; align-items: center; gap: 16px; padding: 14px 0; font-size: .8rem; border-bottom: 1px solid var(--line-red); min-width: 0; }
.contact__list li:last-child { border-bottom: 0; }
.contact__list a { transition: color .3s; overflow-wrap: anywhere; }
.contact__list a:hover { color: var(--accent); }
.c-ico { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-red); display: grid; place-items: center; flex: none; }
.c-ico .ico { width: 15px; height: 15px; }
.contact__media { aspect-ratio: 7 / 5; border-radius: 8px; border: 1px solid var(--line); transform: perspective(1000px) rotateY(-8deg); transform-origin: right center; box-shadow: var(--shadow); }

/* Footer */
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 20px var(--pad) calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line);
  font-size: .66rem; color: var(--muted); letter-spacing: .06em;
}

/* =========================================================
   VENTANAS (dialog) + FORMULARIO
   ========================================================= */
.dialog {
  width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line-red); border-radius: 12px;
  background: var(--bg-2); color: var(--text); overflow: auto;
}
.dialog--wide { width: min(1180px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop .35s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog__close { position: absolute; right: 14px; top: 14px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg-2); display: grid; place-items: center; transition: border-color .3s, color .3s; }
.dialog__close:hover { border-color: var(--accent); color: var(--accent); }

.form { position: relative; padding: clamp(24px, 4vw, 38px); display: grid; gap: 18px; }
.form__intro { font-size: .84rem; color: var(--muted); margin-top: -6px; }
.field { display: grid; gap: 6px; }
.field label { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; font-size: .9rem; color: var(--text);
  background: var(--input); border: 1px solid var(--line-strong); border-radius: 6px; padding: 12px 14px;
  transition: border-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
.field.has-error input, .field.has-error textarea { border-color: #E0566B; }
.error { min-height: 1em; font-size: .7rem; color: #E0566B; }
.form__status { min-height: 1.2em; font-size: .8rem; }
.form__status.ok { color: #4FBF83; }
.form__status.fail { color: #E0566B; }
.form__alt { font-size: .76rem; color: var(--muted); }
.form__alt a { color: var(--accent); font-weight: 600; }

/* Ventana de proyectos web */
.webd { position: relative; padding: clamp(24px, 4vw, 48px); display: grid; gap: 12px; }
.webd__lead { max-width: 60ch; color: var(--text-2); font-size: .9rem; }
.sites { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 26px); margin-top: 18px; }
.site { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); min-width: 0; transition: border-color .3s, transform .4s var(--ease); }
.site:hover { border-color: var(--line-red); }
.site__shot { display: block; aspect-ratio: 16 / 10; }
.site:hover .site__shot > img { transform: scale(1.04); }
.site__body { display: flex; flex-direction: column; gap: 10px; padding: 20px; flex: 1; }
.site__num { font-family: var(--f-display); font-size: 1.6rem; color: var(--accent); line-height: 1; }
.site h3 { font-size: .86rem; letter-spacing: .12em; font-weight: 700; }
.site__type { font-size: .68rem; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.site__body > p:not(.site__type) { font-size: .8rem; color: var(--text-2); line-height: 1.65; }
.site__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.site__tags li { font-size: .56rem; letter-spacing: .1em; text-transform: uppercase; padding: 5px 9px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--text-2); }
.site .link-arrow { margin-top: auto; padding-top: 8px; }

/* =========================================================
   CHATBOT
   ========================================================= */
.chat {
  position: fixed; z-index: 80;
  right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
.chat-launch {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #8E0A18, #73030D 60%, #4A020A); color: #F2F2F2;
  box-shadow: 0 14px 30px -10px rgba(115, 3, 13, .9), 0 0 0 4px rgba(115, 3, 13, .18);
  transition: transform .25s var(--ease);
}
.chat-launch:hover { transform: scale(1.06); }
.chat-launch .ico { width: 26px; height: 26px; grid-area: 1 / 1; transition: opacity .2s, transform .25s; }
.chat-launch .ic-x { opacity: 0; transform: rotate(-90deg); }
.chat.is-open .chat-launch .ic-x { opacity: 1; transform: none; }
.chat.is-open .chat-launch .ic-c { opacity: 0; transform: rotate(90deg); }
.chat-launch__dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #3DDC84; border: 2px solid #73030D; }
.chat.is-open .chat-launch__dot { display: none; }

.chat-panel {
  width: min(380px, calc(100vw - 36px)); height: min(580px, calc(100dvh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line-red); border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
  transform-origin: 100% 100%; animation: pop .25s var(--ease);
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; color: #F2F2F2; background: linear-gradient(120deg, #73030D, #3C0108); }
.chat-avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(242, 242, 242, .12); font-family: var(--f-display); font-size: 1.05rem; letter-spacing: .04em; flex: none; }
.chat-id { min-width: 0; }
.chat-id h2 { font-size: .95rem; font-weight: 700; }
.chat-id p { font-size: .74rem; opacity: .85; display: flex; align-items: center; gap: 6px; }
.chat-id .dot { width: 7px; height: 7px; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .25); }
.chat-agent {
  display: flex; align-items: center; justify-content: center; gap: 9px; margin: 12px 14px 0; padding: 11px 14px; border-radius: 10px;
  background: #1F8F4E; color: #fff; font-weight: 700; font-size: .84rem; transition: background .2s;
}
.chat-agent:hover { background: #18773F; }
.chat-agent .ico { width: 18px; height: 18px; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .86rem; line-height: 1.55; overflow-wrap: anywhere; }
.msg--bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg--user { align-self: flex-end; background: var(--fill); color: var(--on-fill); border-bottom-right-radius: 4px; }
.msg a.msg__wa { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 12px; border-radius: 999px; background: #1F8F4E; color: #fff; font-weight: 700; font-size: .78rem; }
.msg a.msg__link { display: inline-block; margin-top: 6px; color: var(--accent); font-weight: 600; font-size: .78rem; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typing 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { transform: translateY(-4px); opacity: .5; } }
.chat-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
.chat-chips::-webkit-scrollbar { display: none; }
.chat-chips button { flex: none; border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 7px 12px; font-size: .74rem; font-weight: 600; white-space: nowrap; transition: border-color .2s, color .2s; }
.chat-chips button:hover { border-color: var(--accent); color: var(--accent); }
.chat-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); }
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button { width: 44px; height: 44px; flex: none; border-radius: 10px; border: 0; background: var(--fill); color: var(--on-fill); display: grid; place-items: center; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1180px) {
  .site-nav { gap: 16px; }
  .tool--geo .geo-text { display: none; }
  .tool--geo { width: 38px; padding: 0; justify-content: center; }
  .trio { grid-template-columns: 1fr 1fr; }
  .trio__process { border-right: 0; }
  .trio__quote { grid-column: 1 / -1; }
  .services { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr 1fr; }
  .contact__media { grid-column: 1 / -1; transform: none; aspect-ratio: 16 / 7; }
}

@media (max-width: 980px) {
  .tool--menu { display: inline-flex; }
  .site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--pad) 16px; background: var(--bg-2); border-bottom: 1px solid var(--line-red);
    box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .25s, transform .25s, visibility .25s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .site-nav a { padding: 14px 0; font-size: .78rem; border-bottom: 1px solid var(--line); }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a::after { display: none; }
  .services__grid { grid-template-columns: 1fr; }
  .svc + .svc { border-left: 0; border-top: 1px solid var(--line-red); }
  .sites { grid-template-columns: 1fr 1fr; }
  .sites .site:last-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  :root { --head-h: 62px; }
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; min-height: 0; padding-bottom: 0; }
  .hero__title { font-size: clamp(4rem, 21vw, 10rem); top: calc(var(--head-h) + 14px); }
  .hero__photo { position: relative; left: auto; bottom: auto; transform: none; width: min(100%, 420px); height: 440px; margin: 40px auto 0; grid-row: 1; }
  .hero__intro { grid-column: 1; grid-row: 2; margin-top: -80px; padding-bottom: 20px; }
  .hero__side { grid-column: 1; grid-row: 3; align-items: stretch; gap: 20px; }
  .mx-pill { align-self: flex-start; }
  .stats { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats li { flex-direction: column; align-items: flex-start; gap: 6px; border-bottom: 0; border-right: 1px solid var(--line-red); padding: 10px 10px 10px 0; }
  .stats li + li { padding-left: 12px; }
  .stats li:last-child { border-right: 0; }
  .hero__bio { max-width: 56ch; }

  .projects__grid { grid-template-columns: minmax(0, 1fr); }
  .section__line { display: none; }
  .section__head { justify-content: space-between; }

  .trio { grid-template-columns: minmax(0, 1fr); }
  .trio__edu, .trio__process { border-right: 0; border-bottom: 1px solid var(--line-red); }

  .about__grid { grid-template-columns: minmax(0, 1fr); }
  .about__photo { max-width: 420px; }
  .book { grid-template-columns: minmax(0, 1fr); }
  .book__cover { width: min(240px, 70%); }

  .contact { grid-template-columns: minmax(0, 1fr); }
  .sites { grid-template-columns: minmax(0, 1fr); }
  .sites .site:last-child { grid-column: auto; }
}

@media (max-width: 520px) {
  .brand__sub { display: none; }
  .brand__name { font-size: 1rem; }
  .tools { gap: 6px; }
  .tool { height: 36px; }
  .tool--theme, .tool--menu, .tool--geo { width: 36px; }
  .facets { grid-template-columns: minmax(0, 1fr); }
  .facets li:nth-child(even) { padding-left: 0; border-left: 0; }
  .process li { grid-template-columns: 24px 40px minmax(0, 1fr); gap: 12px; }
  .stats span { font-size: .52rem; letter-spacing: .1em; }
  .svc-band { grid-template-columns: minmax(0, 1fr); }
  .svc-band .arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-pending { opacity: 1; transform: none; }
}
