:root {
  --ink: #131313;
  --paper: #faf9f6;
  --muted: rgba(250, 249, 246, 0.55);
  --gutter: clamp(16px, 5.5vw, 112px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

.skip {
  position: absolute; left: 16px; top: -60px;
  padding: 8px 14px; background: var(--paper); color: var(--ink);
  font-size: 18px; z-index: 10;
}
.skip:focus { top: 16px; }

:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; }

/* ---------- Layout ---------- */

.home {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(28px, 5vh, 140px);
}

.cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: clamp(24px, 4vw, 80px);
  row-gap: 56px;
  padding: clamp(40px, 8vh, 120px) var(--gutter) 0;
}

.col { position: relative; min-width: 0; }

/* For now only "Qué es", aligned to the right column */
#que-es { grid-column: -4 / -1; } /* last three columns */

/* The brand name keeps the wordmark's serif inside sans text */
.col__brand {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-weight: 400;
  font-size: 1.28em; /* the serif runs smaller than Geist at the same size */
  letter-spacing: -0.01em;
  line-height: 0;
}

.col__text {
  margin: 0;
  max-width: 42ch;
  text-wrap: pretty; /* avoid a lone word on the last line */
  font-family: var(--sans);
  font-size: clamp(14px, 0.95vw, 17px);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: rgba(250, 249, 246, 0.82);
}
/* The description as a large statement; the second paragraph stays as support */
.col__text--statement {
  max-width: none;
  margin-bottom: 0.7em;
  font-size: clamp(24px, 2.5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--paper);
}
.col__text + .col__text { margin-top: 0.8em; }

.col__meta {
  margin: 0.9em 0 0;
  font-size: clamp(17px, 1.15vw, 20px);
  font-style: italic;
  color: var(--muted);
}

.col__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: clamp(20px, 1.55vw, 28px);
  line-height: 1.2;
}
.col__list li + li { margin-top: 0.55em; }

/* Animated underline links */
.link {
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px;
  transition: background-size 0.5s var(--ease);
  padding-bottom: 2px;
}
.link:hover, .link:focus-visible {
  background-position: 0 100%;
  background-size: 100% 1px;
}

/* Link + status on one row under the paragraphs */
.col__foot {
  display: flex; flex-wrap: wrap; align-items: baseline;
  column-gap: clamp(24px, 3vw, 48px); row-gap: 0.4em;
  margin-top: 0.9em;
}
.col__foot .col__meta { margin: 0; }

/* "Servicios ↓" link under the paragraph */
.more {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(16px, 1.15vw, 20px);
  line-height: 1.2;
}
.more:hover .link, .more:focus-visible .link {
  background-position: 0 100%;
  background-size: 100% 1px;
}
.more__arrow {
  width: 0.55em; height: 0.85em;
  transition: transform 0.45s var(--ease);
}
/* One move down on hover, back up when the cursor leaves */
.more:hover .more__arrow, .more:focus-visible .more__arrow { transform: translateY(5px); }

/* ---------- Services ---------- */

.services {
  padding: clamp(96px, 16vh, 200px) var(--gutter) clamp(96px, 14vh, 180px);
  scroll-margin-top: 0;
}

.services__title {
  margin: 0 0 clamp(40px, 6vw, 96px);
  font-weight: 400;
  font-size: clamp(56px, 7vw, 128px);
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.services__list { list-style: none; margin: 0; padding: 0; }

.service {
  display: grid;
  grid-template-columns: minmax(48px, 6rem) 1.3fr 1fr;
  column-gap: clamp(16px, 3vw, 56px);
  align-items: baseline;
  padding: clamp(22px, 2.4vw, 36px) 0;
  border-top: 1px solid rgba(250, 249, 246, 0.18);
  transition: opacity 0.5s var(--ease);
}
.service:last-child { border-bottom: 1px solid rgba(250, 249, 246, 0.18); }

.service__num {
  font-size: clamp(16px, 1.1vw, 20px);
  font-style: italic;
  color: var(--muted);
}

.service__name {
  margin: 0;
  font-weight: 400;
  font-size: clamp(30px, 3.4vw, 60px);
  line-height: 1;
  letter-spacing: -0.01em;
}

.service__text {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(18px, 1.3vw, 24px);
  line-height: 1.25;
  color: var(--muted);
  text-wrap: pretty;
}

/* Reveal on scroll */
.js .service { opacity: 0; transform: translateY(24px); }
.js .service.is-visible {
  opacity: 1; transform: none;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}

/* Hover: fade the rest of the list */
@media (hover: hover) {
  .services__list:hover .service,
  .services__list:hover .service.is-visible { opacity: 0.35; transition-delay: 0s; }
  .services__list .service:hover,
  .services__list .service.is-visible:hover { opacity: 1; }
}

/* ---------- Wordmark ---------- */

.mark {
  margin: 0;
  padding: 0 clamp(8px, 1.2vw, 24px);
  font-weight: 400;
  line-height: 0.8;
  white-space: nowrap;
  overflow: hidden;
}

.mark__fit {
  display: inline-block;
  font-size: 21vw; /* replaced by JS fit-to-width */
  letter-spacing: -0.035em;
  /* Stipple: the letters are drawn through a fine grid of dots */
  --dot: 4px;
  -webkit-mask-image: radial-gradient(circle at center, #000 0 46%, transparent 52%);
          mask-image: radial-gradient(circle at center, #000 0 46%, transparent 52%);
  -webkit-mask-size: var(--dot) var(--dot);
          mask-size: var(--dot) var(--dot);
}

.mark__w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.24em; /* keep the descender of the y */
}
.mark__w > span { display: inline-block; }

/* Particle version (JS): the canvas replaces the CSS wordmark visually,
   the real text stays in the DOM for search engines and screen readers. */
.mark--particles { position: relative; line-height: 0; }
.mark--particles .mark__fit {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.mark--particles { overflow: visible; }
.mark--particles canvas { position: absolute; bottom: 0; pointer-events: none; }

/* ---------- Load animation ---------- */

.js .mark__w > span { transform: translateY(105%); }
.js .col { opacity: 0; transform: translateY(16px); }

.is-in .mark__w > span {
  transform: none;
  transition: transform 1.4s var(--ease);
}
.is-in .mark__w + .mark__w > span { transition-delay: 0.12s; }

.is-in .col {
  opacity: 1; transform: none;
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.is-in .col { transition-delay: 0.5s; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .cols { grid-template-columns: repeat(2, 1fr); }
  #que-es { grid-column: 1 / -1; }
  .mark__fit { --dot: 3px; }
}

@media (max-width: 560px) {
  .cols { grid-template-columns: 1fr; row-gap: 44px; }
  #que-es { grid-column: auto; }
  .col__text { max-width: 24ch; }
  .service { grid-template-columns: 1fr; row-gap: 10px; }
  .home { gap: 56px; justify-content: flex-start; }
  .cols { padding-top: 0; padding-bottom: 72px; }
  /* Wordmark first on phones, stacked so "System" fills the width */
  .mark { order: -1; padding-top: 48px; line-height: 0.78; }
  .mark__w { display: block; }
  .mark__w + .mark__w { margin-top: -0.22em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .mark__w > span, .js .col { transform: none; opacity: 1; }
  .is-in .mark__w > span, .is-in .col { transition: none; }
  .js .service { opacity: 1; transform: none; transition: none; }
  .more__arrow { transition: none; }
}
