/* Colors are registered so the light → dark switch at the end of the page animates. */
@property --bg    { syntax: "<color>"; inherits: true; initial-value: #f4f3f1; }
@property --fg    { syntax: "<color>"; inherits: true; initial-value: #141312; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #6b6661; }
@property --line  { syntax: "<color>"; inherits: true; initial-value: #cfcac4; }

:root {
  --bg: #f4f3f1;
  --fg: #141312;
  --muted: #6b6661;
  --line: #cfcac4;
  --pad: clamp(1rem, 5vw, 4.5rem);
  --max: 80rem;
  --ease: cubic-bezier(.2, .7, 0, 1);
  interpolate-size: allow-keywords;
  transition: --bg 1s var(--ease), --fg 1s var(--ease), --muted 1s var(--ease), --line 1s var(--ease);
}
:root.dark { --bg: #141312; --fg: #f4f3f1; --muted: #9b958e; --line: #3b3834; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.7 Montserrat, system-ui, sans-serif;
  color: var(--fg);
  /* paper grain */
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; background: var(--fg); color: var(--bg); font-size: .8rem; text-decoration: none; }
.skip:focus { top: 1rem; }

/* ---------- Header ---------- */
.progress {
  position: fixed; inset: 0 0 auto; z-index: 60; height: 1px;
  background: var(--fg); transform-origin: 0 50%; transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
}
@keyframes grow { to { transform: scaleX(1); } }

.bar {
  position: fixed; inset: 0 0 auto; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 4.5rem; padding-inline: var(--pad);
  transition: background-color .5s, box-shadow .5s;
}
.bar.docked {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.home { width: clamp(8.5rem, 26vw, 12.5rem); aspect-ratio: 952.2 / 60.5; }
.bar nav { display: flex; gap: clamp(1.1rem, 2.6vw, 2.5rem); }
.bar nav a {
  font-size: .66rem; letter-spacing: .28em; text-transform: uppercase; text-decoration: none;
  color: var(--muted); transition: color .3s;
}
.bar nav .n { font-weight: 500; margin-right: .8em; }
.bar nav a:hover, .bar nav a[aria-current] { color: var(--fg); }
@media (max-width: 62rem) {
  .bar nav .t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bar nav .n { margin: 0; }
}

/* ---------- Hero: the wordmark starts here and flies into the header on scroll (main.js) ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.75rem;
  padding: 6rem var(--pad); text-align: center;
}
.hero-mark { width: min(86vw, 60rem); aspect-ratio: 952.2 / 60.5; }
.hero-mark svg { display: block; width: 100%; height: auto; aspect-ratio: 952.2 / 60.5; color: var(--fg); }
.js .hero-mark svg { position: fixed; top: 0; left: 0; z-index: 45; transform-origin: 0 0; pointer-events: none; }
.js .hero-mark path { transform-box: fill-box; transform: translateY(115%); }
.js .hero-mark path.up { transform: translateY(-140%); }
.go .hero-mark path, .go .hero-mark path.up {
  transform: none;
  transition: transform 1.3s var(--ease) calc(var(--i) * 40ms + .15s);
}
.hero-tag, .hero-foot { opacity: calc(1 - var(--t, 0) * 1.8); }
.js .hero-tag, .js .hero-foot { animation: rise 1.4s var(--ease) 1.1s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(.75rem); } }
.hero-tag { font-size: .68rem; letter-spacing: .5em; text-transform: uppercase; color: var(--muted); padding-left: .5em; }
.hero-tag i { font-style: normal; }
@media (max-width: 40rem) {
  .hero-tag { line-height: 2.4; }
  .hero-tag span { display: block; }
  .hero-tag i { display: none; }
}
.hero-foot {
  position: absolute; inset: auto var(--pad) 1.75rem;
  display: flex; justify-content: space-between; align-items: end;
  font-size: .64rem; letter-spacing: .32em; text-transform: uppercase; color: var(--muted);
}
.cue { display: flex; flex-direction: column; align-items: center; gap: .9rem; text-decoration: none; }
.cue::after {
  content: ""; width: 1px; height: 3.25rem;
  background: linear-gradient(var(--fg) 50%, transparent 0) 0 0 / 1px 200%;
  animation: drip 2.4s var(--ease) infinite;
}
@keyframes drip { from { background-position: 0 100%; } to { background-position: 0 -100%; } }

/* ---------- Sections ---------- */
.sec { max-width: var(--max); margin-inline: auto; padding: clamp(6rem, 16vh, 11rem) var(--pad); }
.eyebrow {
  position: relative; padding-bottom: 1.4rem; margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  font-size: .66rem; letter-spacing: .38em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: var(--line); transform-origin: 0 50%; }
.js .eyebrow::after { transform: scaleX(0); transition: transform 1.6s var(--ease) .1s; }
.js .eyebrow.in::after { transform: none; }

.title {
  font-weight: 300; font-size: clamp(2rem, 1rem + 4.3vw, 5.25rem); line-height: 1.08;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: clamp(2.25rem, 5vw, 3.75rem);
}
/* padding/negative margin keeps accents (Á, Ó) inside the clipping box */
.title .ln { display: block; overflow: hidden; padding-block: .2em .08em; margin-block: -.2em -.08em; }
.title .ln > span { display: inline-block; }
.js .title .ln > span { transform: translateY(110%); transition: transform 1.3s var(--ease); }
.js .title .ln + .ln > span { transition-delay: .12s; }
.js .title.in .ln > span { transform: none; }

.lead { font-size: clamp(1.3rem, 1rem + 1.25vw, 2rem); line-height: 1.42; max-width: 32em; }
.body { color: var(--muted); max-width: 36em; margin: 2rem 0 0 auto; font-size: 1.05rem; }
.ink .w { opacity: clamp(.14, (var(--p, 1) * (var(--n) + 5) - var(--i)) / 5, 1); }

.js .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 1.1s var(--ease) var(--d, 0s), transform 1.3s var(--ease) var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }
.js .wipe { clip-path: inset(0 100% 0 0); transition: clip-path 2s var(--ease) .1s; }
.js .wipe.in { clip-path: inset(0); }

/* ---------- 01 · Typeface morph: identity changes, the baseline (criterio) stays ---------- */
.morph { margin-block: clamp(4.5rem, 12vw, 9rem); }
.stage {
  position: relative; display: grid; place-items: center; min-height: clamp(9rem, 28vw, 21rem);
  cursor: pointer; -webkit-user-select: none; user-select: none;
}
.word { position: relative; z-index: 1; font-size: clamp(3.6rem, 15.5vw, 13rem); font-weight: 300; line-height: 1.25; white-space: nowrap; }
.bl { display: inline-block; width: 0; height: 0; }
.guide { position: absolute; inset: var(--base, 66%) 0 auto; height: 1px; background: var(--line); transition: top .6s var(--ease); }
.guide::after {
  content: "criterio"; position: absolute; right: 0; top: .7rem;
  font-size: .6rem; letter-spacing: .38em; text-transform: uppercase; color: var(--muted);
}
.morph figcaption {
  max-width: 34em; margin: 2.25rem auto 0; text-align: center; color: var(--muted);
  font-size: clamp(1.02rem, .9rem + .45vw, 1.25rem); line-height: 1.6;
}
.morph strong { color: var(--fg); font-weight: 500; }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: clamp(3.5rem, 7vw, 7rem); margin-block: clamp(3rem, 8vw, 7rem);
}
.num { font-size: clamp(5.5rem, 3rem + 10vw, 11rem); font-weight: 200; line-height: .85; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.num sup { font-size: .42em; vertical-align: top; position: relative; top: .12em; margin-right: .06em; }
.fact h3 { margin: 1.75rem 0 1rem; font-size: .7rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; }
.fact > p:last-child { color: var(--muted); max-width: 26em; }
.disc { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.disc li { padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }

.statement { display: grid; gap: 1rem; padding-top: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
.big { font-size: clamp(1.75rem, 1rem + 2.8vw, 3.5rem); font-weight: 300; line-height: 1.18; max-width: 20em; }

/* ---------- 02 · Scope builder ---------- */
.scope { margin-top: clamp(3.5rem, 8vw, 6rem); }
.scope-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .75rem 2rem; margin-bottom: 1.75rem; }
.hint { font-size: .66rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.scope-out { font-size: clamp(1.15rem, 1rem + .8vw, 1.6rem); }
.phases { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.phase {
  position: relative; display: grid; align-content: start; gap: 1rem;
  width: 100%; height: 100%; padding: 1.75rem 1.75rem 2rem 0; margin: 0;
  background: none; border: 0; border-top: 1px solid var(--line);
  text-align: left; color: var(--muted); cursor: pointer; transition: color .4s;
}
.phase::before {
  content: ""; position: absolute; inset: -1px 0 auto; height: 3px; background: var(--fg);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .7s var(--ease);
}
.phase:hover { color: var(--fg); }
.phase[aria-pressed="true"] { color: var(--fg); }
.phase[aria-pressed="true"]::before { transform: none; }
.ph-n {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid currentColor; border-radius: 50%;
  font-size: .7rem; letter-spacing: .08em; transition: background-color .4s, color .4s, border-color .4s;
}
.phase[aria-pressed="true"] .ph-n { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.ph-t { font-size: .74rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; line-height: 1.55; }
.ph-d { font-size: .95rem; line-height: 1.6; }
@media (max-width: 48rem) {
  .phases { grid-template-columns: 1fr; }
  .phase { border-top: 0; border-left: 1px solid var(--line); padding: 1.25rem 0 1.5rem 1.5rem; }
  .phase::before { inset: 0 auto 0 -1px; width: 3px; height: auto; transform: scaleY(0); transform-origin: 50% 0; }
}

/* ---------- 03 · Services ---------- */
.services { margin-top: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--line); }
.services details { border-bottom: 1px solid var(--line); }
.services summary {
  position: relative; display: grid; grid-template-columns: 4rem 1fr auto; align-items: center; gap: 1rem;
  padding-block: clamp(1.1rem, 2.4vw, 1.75rem); list-style: none; cursor: pointer;
}
.services summary::-webkit-details-marker { display: none; }
.services summary::after {
  content: ""; position: absolute; inset: auto 0 -1px; height: 1px; background: var(--fg);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .8s var(--ease);
}
.services summary:hover::after, .services [open] summary::after { transform: none; }
.sv-n { font-size: .7rem; letter-spacing: .2em; color: var(--muted); }
.sv-t { font-size: clamp(1.05rem, .8rem + 1.3vw, 2rem); font-weight: 300; letter-spacing: .07em; text-transform: uppercase; line-height: 1.3; transition: transform .6s var(--ease); }
.services summary:hover .sv-t, .services [open] .sv-t { transform: translateX(.6rem); }
.sv-x { position: relative; width: 1rem; height: 1rem; }
.sv-x::before, .sv-x::after { content: ""; position: absolute; inset: 50% 0 auto; height: 1px; background: currentColor; transition: transform .5s var(--ease); }
.sv-x::after { transform: rotate(90deg); }
.services [open] .sv-x::after { transform: none; }
.services details p { max-width: 40em; padding: 0 0 2rem 5rem; color: var(--muted); font-size: 1.05rem; }
.services details::details-content { block-size: 0; overflow: clip; transition: block-size .6s var(--ease), content-visibility .6s allow-discrete; }
.services details[open]::details-content { block-size: auto; }
@media (max-width: 48rem) {
  .services summary { grid-template-columns: 2.75rem 1fr auto; }
  .services details p { padding-left: 3.75rem; }
}

/* ---------- 04 · Relationship models ---------- */
.models { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(2.5rem, 6vw, 6rem); align-items: center; margin-top: clamp(3rem, 7vw, 5rem); }
.venn { width: 100%; height: auto; overflow: visible; }
.venn circle { fill: none; stroke: var(--fg); stroke-width: 1; vector-effect: non-scaling-stroke; }
.venn .c-x { fill: var(--fg); stroke: none; opacity: .92; }
.venn text { fill: var(--muted); font: 500 11px Montserrat, sans-serif; letter-spacing: .3em; }
.model-text { min-height: 11rem; }
.model-text h3 { font-size: clamp(1.6rem, 1rem + 2vw, 2.6rem); font-weight: 300; letter-spacing: .06em; text-transform: uppercase; line-height: 1.15; }
.model-text p { margin-top: 1rem; color: var(--muted); font-size: 1.1rem; max-width: 26em; }
.model-ctl { margin-top: 2.5rem; }
.model-ctl input { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 2rem; margin: 0; background: none; cursor: pointer; }
.model-ctl input::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
.model-ctl input::-moz-range-track { height: 1px; background: var(--line); }
.model-ctl input::-webkit-slider-thumb { -webkit-appearance: none; width: 1.1rem; height: 1.1rem; margin-top: -.53rem; border: 0; border-radius: 50%; background: var(--fg); }
.model-ctl input::-moz-range-thumb { width: 1.1rem; height: 1.1rem; border: 0; border-radius: 50%; background: var(--fg); }
.stops { display: flex; justify-content: space-between; margin-top: .6rem; }
.stops button {
  padding: .5rem 0; background: none; border: 0; cursor: pointer;
  font-size: .64rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); transition: color .3s;
}
.stops button:hover, .stops button[aria-pressed="true"] { color: var(--fg); }
@media (max-width: 52rem) {
  .models { grid-template-columns: 1fr; }
  .venn { max-width: 30rem; margin-inline: auto; }
}

/* ---------- Closing ---------- */
.end {
  min-height: 92svh; display: grid; place-content: center; justify-items: center; gap: 2.5rem;
  padding: 8rem var(--pad) 5rem; text-align: center;
}
.end-mark {
  width: min(84vw, 42rem); aspect-ratio: 952.2 / 60.5; background: var(--fg);
  -webkit-mask: url(assets/wordmark.svg) center / contain no-repeat; mask: url(assets/wordmark.svg) center / contain no-repeat;
}
.end-tag { font-size: .66rem; letter-spacing: .5em; text-transform: uppercase; color: var(--muted); padding-left: .5em; }
.mail {
  margin-top: 1.5rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line);
  font-size: clamp(.9rem, 4.2vw, 1.6rem); letter-spacing: .04em; text-decoration: none; transition: border-color .4s;
}
.mail:hover { border-color: var(--fg); }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem;
  padding: 1.5rem var(--pad); border-top: 1px solid var(--line);
  font-size: .62rem; letter-spacing: .28em; text-transform: uppercase; color: var(--muted);
}

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