/* =========================================================
   HILVÁN — BASE
   Lenguaje del taller: papel de molde (claro) y mesa de corte (oscuro).
   Un solo hilo naranja recorre toda la marca.
   ========================================================= */

:root {
  /* Claro — papel de molde */
  --paper: #f3efe6;        /* fondo general */
  --kraft: #e6dcc6;        /* pieza A, bandas */
  --sheet: #fbf9f3;        /* superficies elevadas (láminas, formulario) */
  --ink: #171512;          /* texto y tinta */
  --ink-2: #3b3630;
  --muted: #6b6359;        /* texto secundario: 5,4:1 sobre --paper */
  --rule: #d3c9b6;         /* líneas finas */
  --rule-strong: #b3a790;
  --grid: rgba(23, 21, 18, 0.06);
  --thread: #e0491f;       /* el hilo: acentos y fondos */
  --thread-ink: #b23b17;   /* el hilo para texto chico: 5,1:1 */
  --on-thread: #ffffff;
  --ok: #2f6b45;
  --warn-bg: #f7dccf;
  --shadow: 0 1px 0 rgba(23, 21, 18, 0.06), 0 18px 40px -24px rgba(23, 21, 18, 0.35);
  --needle-eye: #f3efe6;
  --band-bg: #171512;      /* bandas oscuras: orillo, a medida, contacto, pie */
  --band-fg: #f3efe6;
  --band-muted: #bdb2a0;
  --band-rule: rgba(243, 239, 230, 0.18);
  --error: #b3261e;

  --f-sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --f-serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

  --t-display: clamp(3rem, 0.9rem + 8.2vw, 8.2rem);
  --t-h2: clamp(2.05rem, 1.25rem + 3.1vw, 4.1rem);
  --t-h3: clamp(1.3rem, 1.1rem + 0.7vw, 1.75rem);
  --t-lead: clamp(1.04rem, 0.98rem + 0.3vw, 1.22rem);

  --gutter: clamp(1.15rem, 0.4rem + 3.4vw, 4rem);
  --max: 1400px;
  --section: clamp(5rem, 3rem + 7vw, 10rem);
  --nav-h: 66px;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Oscuro — mesa de corte de noche: no es el claro invertido.
   El papel pasa a ser una superficie cálida casi negra; el hilo se aviva para mantener contraste. */
:root[data-theme="dark"] {
  --paper: #141210;
  --kraft: #1f1b16;
  --sheet: #1b1815;
  --ink: #efe8db;
  --ink-2: #d2c8b6;
  --muted: #a39a8b;        /* 6,6:1 sobre --paper */
  --rule: #34302a;
  --rule-strong: #4c463d;
  --grid: rgba(239, 232, 219, 0.05);
  --thread: #ff6b3d;
  --thread-ink: #ff8b65;   /* 7:1 sobre --paper */
  --on-thread: #141210;
  --ok: #7fc59a;
  --warn-bg: #3a2218;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 22px 50px -26px rgba(0, 0, 0, 0.9);
  --needle-eye: #141210;
  --band-bg: #0b0a09;
  --band-fg: #efe8db;
  --band-muted: #a39a8b;
  --band-rule: rgba(239, 232, 219, 0.12);
  --error: #ff8a7a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
html:focus-within { scroll-behavior: smooth; }
html.is-locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 1.02rem;
  line-height: 1.6;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, dl, dd, figure, pre { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--thread); color: var(--on-thread); }
:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; }

/* Cambio de tema: transición suave solo mientras dura el cambio (nunca al cargar) */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease), border-color 0.45s var(--ease), fill 0.45s var(--ease), stroke 0.45s var(--ease) !important;
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal 0.6s var(--ease-out); }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--tx, 100%) var(--ty, 0%)); } to { clip-path: circle(150% at var(--tx, 100%) var(--ty, 0%)); } }

.sr-only, .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 1rem; top: -60px; z-index: 100; padding: 0.7rem 1rem; background: var(--ink); color: var(--paper); }
.skip:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.mono { font-family: var(--f-mono); font-size: 0.78em; letter-spacing: 0.02em; }

/* ---------- Tipografía ---------- */
.h2 {
  font-size: var(--t-h2);
  font-weight: 760;
  font-variation-settings: 'wdth' 92;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.h2 em, .h3 em, .hero__title em {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 450;
  letter-spacing: -0.02em;
  font-variation-settings: normal;
}
.h3 { font-size: var(--t-h3); font-weight: 680; line-height: 1.1; letter-spacing: -0.02em; }
.h4 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.lead { font-size: var(--t-lead); line-height: 1.55; color: var(--muted); max-width: 46ch; text-wrap: pretty; }

/* Etiqueta de pieza de molde: "A — Servicios". Reemplaza al típico rótulo de sección. */
.piece-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  padding: 0 1.6rem 0 0;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%);
}
.piece-tag span {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 2.1rem;
  margin-right: 0.8rem;
  padding: 0.6rem 0;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
}
.piece-tag--light { color: rgba(255, 255, 255, 0.82); border-color: rgba(255, 255, 255, 0.28); }
.piece-tag--light span { background: var(--thread); color: var(--on-thread); }

/* ---------- Botones: tela con costura interna ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 54px;
  padding: 0 1.6rem;
  border-radius: 2px;
  font-size: 0.98rem;
  font-weight: 640;
  letter-spacing: 0.005em;
  white-space: nowrap;
  isolation: isolate;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.2s var(--ease);
}
.btn::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px dashed currentColor;
  opacity: 0.38;
  pointer-events: none;
  transition: inset 0.3s var(--ease), opacity 0.3s var(--ease);
}
.btn:hover::after { inset: 3px; opacity: 0.7; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn--sm { min-height: 44px; padding: 0 1.15rem; font-size: 0.9rem; }
.btn--sm::after { inset: 4px; }
.btn--block { width: 100%; }
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { background: var(--ink-2); }
.btn--accent { background: var(--thread); color: var(--on-thread); }
.btn--accent:hover { background: color-mix(in srgb, var(--thread) 86%, var(--ink)); }
.btn--line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--line::after { opacity: 0; }
.btn--line:hover { background: var(--ink); color: var(--paper); }
.btn--line:hover::after { opacity: 0.4; }

/* Link con flecha que "avanza" una puntada al pasar el mouse */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 640;
  font-size: 0.96rem;
  padding-block: 0.4rem;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: background-size 0.35s var(--ease);
}
.link-arrow::after {
  content: '';
  width: 1.4rem;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--thread) 0 5px, transparent 5px 8px);
  transition: width 0.35s var(--ease);
}
.link-arrow:hover::after { width: 2.1rem; }
.text-link, .inline-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--thread);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-style: dashed;
}
.text-link:hover, .inline-link:hover { color: var(--thread-ink); }

/* El "más" de los desplegables: dos puntadas que se cruzan */
.plus { position: relative; width: 18px; height: 18px; flex: none; }
.plus::before, .plus::after {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  height: 2px;
  margin-top: -1px;
  background: currentColor;
  transition: transform 0.35s var(--ease);
}
.plus::after { transform: rotate(90deg); }
details[open] > summary .plus::after { transform: rotate(0deg); }

/* ---------- Entradas al hacer scroll ---------- */
.anim [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.anim [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .anim [data-reveal] { opacity: 1; transform: none; }
}
