/* ===================================================================
   Kädet — dirección «Taller»
   Editorial cálido: papel hueso, serif de alto contraste para los
   titulares, Archivo para el texto y el verde de marca como bloque
   sólido, nunca como resplandor. Esquina recta, filetes de 1px.
=================================================================== */

:root {
  /* papel */
  --paper:    #f4f1ea;   /* fondo base, hueso cálido */
  --paper-2:  #ebe6db;   /* bloque del espécimen */

  /* tinta */
  --ink:      #1b1a16;
  --ink-70:   #56524a;
  --ink-45:   #6b6659;   /* 4.9:1 sobre papel */
  --rule:     rgba(27, 26, 22, .18);

  /* marca */
  --green:      #0cc143;  /* relleno y bloques, nunca texto sobre papel */
  --green-text: #0a6b2e;  /* 5.9:1 sobre papel */
  --on-green:   #06210e;
  --on-ink:     #f4f1ea;
  --ink-dim:    #b0aa9d;  /* texto secundario sobre tinta */

  /* tipografía */
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:  Archivo, "Helvetica Neue", system-ui, sans-serif;

  /* retícula */
  --shell: 1248px;
  --pad: clamp(1.25rem, 5vw, 6rem);
  --masthead-h: 72px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--green-text);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 0; left: -9999px;
  z-index: 100;
  padding: .7rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.skip-link:focus { left: 0; }

#top-sentinel { position: absolute; top: 0; height: 1px; width: 1px; }

.shell {
  width: min(100% - (var(--pad) * 2), var(--shell));
  margin-inline: auto;
}

/* ------------------------------ tipografía ----------------------------- */

.h2 {
  margin: 0 0 clamp(2.5rem, 5vw, 4.25rem);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.35rem, 4.6vw, 3.75rem);
  line-height: 1.06;
  letter-spacing: -.012em;
  text-wrap: balance;
}

.eyebrow {
  margin: 0 0 .875rem;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-45);
}

/* -------------------------------- botones ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.75rem;
  border: 1px solid transparent;
  border-radius: 0;                /* todo el sistema es de esquina recta */
  font-family: var(--sans);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease),
              border-color .25s var(--ease), transform .12s var(--ease);
}
.btn--sm { padding: .6875rem 1.25rem; font-size: .875rem; }
.btn--lg { padding: 1.125rem 2rem; font-size: 1rem; }
.btn:active { transform: translateY(1px); }

.btn--ink {
  background: var(--ink);
  color: var(--on-ink);
  border-color: var(--ink);
}
.btn--ink:hover { background: #000; color: #fff; }

.btn--green {
  background: var(--green);
  color: var(--on-green);
  border-color: var(--green);
}
.btn--green:hover { background: #0aa93a; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .5625rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--rule);
  font-size: .9375rem;
  font-weight: 600;
  transition: border-color .25s var(--ease), color .25s var(--ease);
}
.link-arrow svg { width: 15px; height: 15px; }
.link-arrow:hover { color: var(--green-text); border-bottom-color: var(--green-text); }

/* ------------------------------- cabecera ------------------------------ */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.masthead.is-stuck { border-bottom-color: var(--rule); }

.masthead__inner {
  position: relative;
  width: min(100% - (var(--pad) * 2), var(--shell));
  height: var(--masthead-h);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand { display: inline-flex; }
.brand__logo {
  width: 128px;
  transition: transform .4s var(--ease);
}
.brand:hover .brand__logo { transform: translateY(-1px); }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.6vw, 2.125rem);
  font-size: .9375rem;
  font-weight: 500;
}
.nav a:not(.btn) {
  position: relative;
  padding-block: .35rem;
  transition: color .25s var(--ease);
}
.nav a:not(.btn)::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav a:not(.btn):hover { color: var(--green-text); }
.nav a:not(.btn):hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-right: -12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    inset: calc(var(--masthead-h) - 1px) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem 0 1rem;
    background: var(--paper);
    border-block: 1px solid var(--rule);
    font-size: 1.0625rem;
    /* cerrado por defecto; se abre con el botón */
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a:not(.btn) {
    padding: .9375rem .25rem;
    border-bottom: 1px solid var(--rule);
  }
  .nav a:not(.btn)::after { content: none; }
  .nav .btn {
    margin-top: 1rem;
    height: 52px;
    padding-block: 0;
  }
}

/* --------------------------------- hero -------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  padding-top: clamp(2.5rem, 6vh, 5.25rem);
  padding-bottom: clamp(3rem, 7vh, 5.75rem);
}

/* Baño de luz sobre el papel. Dos manchas muy tenues que se desplazan detrás
   de la cabecera y del hero; la cabecera es translúcida, así que también lo
   recoge. Solo se anima `transform`: el compositor lo resuelve sin repintar. */
.hero__wash {
  position: absolute;
  inset: calc(var(--masthead-h) * -1) 0 0 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 78% 4%, #fcfaf6 0%, rgba(252, 250, 246, 0) 62%),
    radial-gradient(90% 75% at 6% 100%, #ece5d5 0%, rgba(236, 229, 213, 0) 72%);
  /* El borde inferior se desvanece: nunca corta en seco contra la siguiente banda. */
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}
.hero__wash::before,
.hero__wash::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.hero__wash::before {
  top: -28%;
  right: -8%;
  width: 62%;
  aspect-ratio: 1.25;
  background: radial-gradient(closest-side, rgba(12, 193, 67, .17), rgba(12, 193, 67, 0));
  animation: wash-verde 42s cubic-bezier(.45, .05, .55, .95) infinite alternate;
}
.hero__wash::after {
  bottom: -36%;
  left: -14%;
  width: 68%;
  aspect-ratio: 1.35;
  background: radial-gradient(closest-side, rgba(206, 194, 168, .62), rgba(206, 194, 168, 0));
  animation: wash-papel 56s cubic-bezier(.45, .05, .55, .95) infinite alternate;
}

@keyframes wash-verde {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-13%, 11%, 0) scale(1.18); }
}
@keyframes wash-papel {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(15%, -9%, 0) scale(1.12); }
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero__copy { max-width: 41rem; }

.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.25rem, 6.9vw, 6.125rem);
  line-height: 1.02;   /* holgura para los descendentes de la cursiva */
  letter-spacing: -.012em;
  text-wrap: balance;
}
.hero__title em { font-style: italic; }
.hero__title .dot { color: var(--green); }

.hero__sub {
  margin: clamp(1.25rem, 2.5vh, 1.625rem) 0 0;
  max-width: 33rem;
  font-size: 1.125rem;
  line-height: 1.62;
  color: var(--ink-70);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.625rem;
  margin-top: clamp(1.75rem, 3.5vh, 2.25rem);
}

/* ------------------------------ objeto 3D ------------------------------ */

.hero__object {
  position: relative;
  height: clamp(420px, 56vh, 560px);
}

.hero__block {
  position: absolute;
  top: 7%;
  left: 50%;
  width: min(300px, 72%);
  aspect-ratio: 1;
  transform: translateX(-56%);
  background: var(--green);
}

.stage {
  position: absolute;
  inset: 0;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity .9s var(--ease);
  cursor: grab;
  touch-action: pan-y;
}
.stage canvas:active,
.stage.is-dragging canvas { cursor: grabbing; }
.stage.is-ready canvas { opacity: 1; }

.stage__loader {
  position: absolute;
  inset: auto 0 8% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .625rem;
  transition: opacity .4s var(--ease);
}
.stage.is-ready .stage__loader { opacity: 0; pointer-events: none; }

.stage__bar {
  width: 148px;
  height: 2px;
  background: rgba(27, 26, 22, .18);
  overflow: hidden;
}
.stage__bar i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--ink);
  transition: width .3s var(--ease);
}
.stage__pct {
  margin: 0;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-45);
}

/* ------------------------------- secciones ----------------------------- */

.band {
  padding: clamp(3.5rem, 8vh, 5.75rem) 0 clamp(4rem, 9vh, 6.5rem);
  border-top: 1px solid var(--rule);
}

/* pilares: tres columnas con filete superior */

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem);
}
.pillar {
  padding-top: 1.375rem;
  border-top: 1px solid var(--ink);
}
.pillar__num {
  display: block;
  margin-bottom: .75rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--green-text);
}
.pillar h3 {
  margin: 0 0 .75rem;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -.015em;
}
.pillar p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-70);
  text-wrap: pretty;
}

/* Las tres columnas bajan escalonadas: rompe la simetría sin añadir contenido. */
@media (min-width: 900px) {
  .pillar:nth-child(2) { margin-top: 1.75rem; }
  .pillar:nth-child(3) { margin-top: 3.5rem; }
}

@media (max-width: 780px) {
  .pillars { grid-template-columns: 1fr; }
}

/* origen: texto + espécimen tipográfico */

.origin {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.origin__text .h2 { margin-bottom: 1.25rem; }
.origin__text p {
  margin: 0 0 1.125rem;
  max-width: 33rem;
  font-size: 1.125rem;
  line-height: 1.62;
  color: var(--ink-70);
  text-wrap: pretty;
}
.origin__text p:last-child { margin-bottom: 0; }
.origin__text em { font-style: italic; color: var(--ink); }

.specimen {
  margin: 0;
  padding: clamp(1.75rem, 3.2vw, 2.75rem);
  background: var(--paper-2);
}
.specimen__word {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(3.5rem, 6.4vw, 5.875rem);
  line-height: 1;
  padding-bottom: .25rem;   /* la cursiva de kädet baja por debajo de la línea */
  letter-spacing: -.02em;
}
.specimen__meta {
  margin: 1.25rem 0 0;
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--ink-45);
}
.specimen hr {
  margin: 1.375rem 0;
  border: 0;
  border-top: 1px solid rgba(27, 26, 22, .2);
}
.specimen__defs {
  display: grid;
  grid-template-columns: 1.625rem minmax(0, 1fr);
  gap: 1rem 1.125rem;
  margin: 0;
}
.specimen__defs dt {
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--green-text);
}
.specimen__defs dd {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.5;
}
.specimen__defs em { font-style: italic; }

@media (max-width: 900px) {
  .origin { grid-template-columns: 1fr; }
}

/* servicios: cabecera con el segundo objeto 3D + índice editorial */

.services__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.services__head .h2 { margin-bottom: 0; }

.services__object {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  margin: 0;
}
.services__object figcaption {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-45);
  transition: color .25s var(--ease);
}
.services__object:hover figcaption { color: var(--green-text); }

/* La escena del hero se posiciona sobre el bloque verde; esta va en flujo. */
/* Marco apaisado: la pieza es mucho más ancha que alta y en un marco casi
   cuadrado se veía pequeña. */
.stage--inline {
  position: relative;
  width: 100%;
  height: clamp(240px, 23vw, 330px);
}

@media (max-width: 900px) {
  .services__head {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .stage--inline { height: 260px; }
}

/* servicios: índice editorial de tres filas */

.index__row {
  /* El relleno del hover sobresale de la retícula sin mover el texto. Nunca
     excede el margen de la página, así que no genera desbordamiento lateral. */
  --row-bleed: min(1.5rem, var(--pad));
  display: grid;
  grid-template-columns: 120px minmax(0, 360px) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: baseline;
  padding: 2.125rem var(--row-bleed);
  margin-inline: calc(var(--row-bleed) * -1);
  border-top: 1px solid var(--rule);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.index__row:last-child { border-bottom: 1px solid var(--rule); }
.index__num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--ink-45);
  transition: color .3s var(--ease);
}
.index__row h3 {
  margin: 0;
  font-size: 1.4375rem;
  font-weight: 600;
  letter-spacing: -.015em;
  transition: color .3s var(--ease);
}
.index__row p {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-70);
  text-wrap: pretty;
  transition: color .3s var(--ease);
}

/* Al pasar el cursor, la fila se invierte: papel a tinta. Al salir vuelve sola
   con la misma transición. Solo donde hay cursor real: en táctil el :hover se
   queda pegado después del toque. */
@media (hover: hover) {
  .index__row:hover {
    background: var(--ink);
    border-top-color: transparent;
  }
  .index__row:hover + .index__row { border-top-color: transparent; }
  .index__row:last-child:hover { border-bottom-color: transparent; }
  .index__row:hover .index__num { color: var(--green); }
  .index__row:hover h3 { color: var(--on-ink); }
  .index__row:hover p { color: var(--ink-dim); }
}

@media (max-width: 900px) {
  .index__row {
    grid-template-columns: 1fr;
    gap: .625rem;
    padding: 1.75rem var(--row-bleed);
  }
  .index__num { font-size: 2.5rem; }
}

/* ------------------------------ cierre + pie --------------------------- */

.closing {
  padding: clamp(3.5rem, 8vh, 5.5rem) 0;
  background: var(--ink);
  color: var(--on-ink);
}
.closing__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(2rem, 4vw, 4.5rem);
}
.closing__title {
  margin: 0 0 1.125rem;
  max-width: 41rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.35rem, 4.8vw, 3.75rem);
  line-height: 1.06;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.closing__sub {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink-dim);
}

.colophon { padding: clamp(2.25rem, 5vh, 3.5rem) 0; }
.colophon__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.colophon__logo { width: 104px; opacity: .9; }
.colophon p {
  margin: 0;
  font-size: .875rem;
  color: var(--ink-45);
}

@media (max-width: 640px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__object { height: 392px; order: 2; }
  .hero__actions { align-items: stretch; flex-direction: column; gap: .625rem; }
  .hero__actions .btn { height: 52px; padding-block: 0; }
  .link-arrow {
    justify-content: center;
    height: 52px;
    padding-bottom: 0;
    border: 1px solid var(--rule);
  }
  .closing__inner .btn { width: 100%; height: 56px; padding-block: 0; }
}

/* --------------------------- botón de WhatsApp ------------------------- */

/* Flotante abajo a la derecha, con el número visible y no solo el icono.
   Esquina recta y verde de marca, como el resto del sistema. */
.wa {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2rem);
  bottom: clamp(1rem, 2.5vw, 2rem);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 12px 32px -14px rgba(27, 26, 22, .55);
  transition: background-color .25s var(--ease), transform .18s var(--ease),
              opacity .25s var(--ease);
}

/* Se aparta cuando el cierre entra en pantalla: ahí el visitante ya tiene
   delante el botón de contacto y el flotante lo taparía. */
.wa.is-away {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.wa svg {
  width: 28px;
  height: 28px;
  flex: none;
}
.wa:hover {
  background: #0aa93a;
  color: #ffffff;
}
.wa:active { transform: translateY(1px); }

@media (max-width: 420px) {
  .wa { width: 52px; height: 52px; }
  .wa svg { width: 26px; height: 26px; }
}

/* ------------------------------- revelado ------------------------------ */

/* Sin JS no hay revelado: el contenido nace visible (ver el <script> del head). */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* Las filas del índice se revelan al entrar y además se invierten al pasar el
   cursor. Su transición declara las dos cosas: la entrada es lenta y escalonada,
   la inversión es rápida y sin retardo. Sin esto, la del revelado pisa a la otra
   y el cambio de color ocurre de golpe. */
.js .index__row {
  transition:
    opacity .7s var(--ease) var(--reveal-delay, 0ms),
    transform .7s var(--ease) var(--reveal-delay, 0ms),
    background-color .28s var(--ease),
    border-color .28s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .hero__wash::before,
  .hero__wash::after { animation: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
