@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin.4c8b93f4.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg-light: #eef0f2;   --bg-dark: #101214;
  --text-light: #15171a; --text-dark: #e6e8eb;
  --muted-light: #5b6168; --muted-dark: #9aa1a9;
  --line-light: #c9cdd2; --line-dark: #2a2e33;
  --accent-light: #2b45e0; --accent-dark: #8c9bff;

  --bg: var(--bg-light); --text: var(--text-light); --muted: var(--muted-light);
  --line: var(--line-light); --accent: var(--accent-light);
  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-dark); --text: var(--text-dark); --muted: var(--muted-dark);
    --line: var(--line-dark); --accent: var(--accent-dark);
  }
  color-scheme: light dark;
  accent-color: var(--accent);

  --panel-light: #f8f9fa;
  --panel-dark: #15171a;
  --gap: clamp(0.5rem, 0.3rem + 0.8vw, 1rem);
  --side: 15rem;
  --pad: clamp(1.25rem, 0.6rem + 2.6vw, 3rem);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;

}
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
.statement { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
[role="list"] { list-style: none; }
::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
[id] { scroll-margin-top: 1.5rem; }

.skip {
  position: absolute; left: var(--pad); top: 0.75rem; z-index: 10;
  background: var(--text); color: var(--bg); padding: 0.5rem 0.9rem;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- estructura ---------- */
.layout {
  max-width: 1760px;
  margin-inline: auto;
  padding-inline: var(--pad);
}
.name { font-size: 1.25rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.name a { text-decoration: none; }
.index a { text-decoration: none; color: var(--muted); }
.index a:hover { color: var(--text); text-decoration: underline; }
.index a[aria-current="true"] { color: var(--text); }
.side-mail { font-size: 0.9375rem; overflow-wrap: anywhere; }

/* celular y tablet: el índice pasa a una franja horizontal fija arriba */
@media (width < 1024px) {
  .side { display: contents; }
  .name { padding-top: 1.5rem; }
  .side-top { display: contents; }
  .index {
    position: sticky; top: 0; z-index: 5;
    margin-inline: calc(var(--pad) * -1);
    padding: 0.75rem var(--pad);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    display: flex; gap: 1.25rem;
    margin-top: 1rem;
  }
  .index ul { display: flex; gap: 1.25rem; white-space: nowrap; }
  .index-group { display: contents; }
  .index-label { display: none; }
  .index a { font-size: 0.9375rem; padding-block: 0.35rem; display: inline-block; }
  .side-mail { display: none; }
  [id] { scroll-margin-top: 4rem; }
}

@media (width >= 1024px) {
  .layout {
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr);
    column-gap: clamp(2rem, 4vw, 5rem);
  }
  .side {
    position: sticky; top: 0;
    height: 100dvh;
    padding-block: 2.5rem;
    display: flex; flex-direction: column; justify-content: space-between;
  }
  .index { margin-top: 2.5rem; }
  .index li + li { margin-top: 0.2rem; }
  .index a { display: inline-block; padding-block: 0.1rem; }
  .index a[aria-current="true"] { font-weight: 600; }
  .index-group + .index-group { margin-top: 1.5rem; }
  .index-label { font-size: 0.8125rem; color: var(--muted); margin-bottom: 0.35rem; }
}

/* ---------- apertura ---------- */
.intro { padding-block: clamp(2.5rem, 1rem + 8vw, 9rem) clamp(2rem, 1rem + 4vw, 5rem); }
.statement {
  font-size: clamp(2.35rem, 1rem + 5.2vw, 5.75rem);
  line-height: 1.0;
  letter-spacing: -0.035em;
  max-width: 16ch;
}
.intro-focus { color: var(--muted); font-weight: 500; }
.intro-where { margin-top: 1.5rem; color: var(--muted); max-width: 40ch; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.actions:empty { display: none; }
.btn {
  display: inline-flex; align-items: baseline; gap: 0.5em;
  padding: 0.7em 1.1em;
  border: 1px solid var(--text);
  border-radius: 2px;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.2;
}
.btn:hover { color: var(--accent); border-color: var(--accent); }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { background: var(--accent); color: var(--bg); }
.meta { font-size: 0.8em; opacity: 0.75; }

/* ---------- proyectos ---------- */
.project { padding-top: clamp(4rem, 2rem + 6vw, 7rem); }
.chapter-title + .project { padding-top: 0; }
.project-head {
  display: grid; gap: 0.6rem;
  margin-bottom: clamp(1.25rem, 0.8rem + 1.5vw, 2rem);
}
@media (width >= 1280px) {
  .project-head { grid-template-columns: minmax(0, 1fr) minmax(0, 34rem); align-items: end; column-gap: 3rem; }
}
.project h3 {
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.cv h2 {
  font-size: clamp(1.75rem, 1.1rem + 2.2vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.project-head p { color: var(--muted); max-width: 46ch; }

/* filas: cada pieza crece según su proporción → todas a la misma altura */
.row { display: flex; gap: var(--gap); }
.row + .row, .loops + .row { margin-top: var(--gap); }
.piece { margin: 0; flex: var(--r) 1 0; min-width: 0; }
.piece img { width: 100%; }
@media (width < 640px) {
  .row:not(.row--pair) { flex-direction: column; }
  .row:not(.row--pair) .piece { flex: none; }
}

.zoom {
  display: block; width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: zoom-in;
}
.zoom img { outline: 1px solid color-mix(in srgb, var(--text) 9%, transparent); outline-offset: -1px; }
.zoom:hover img { outline-color: var(--accent); }

/* logos sobre paño */
.piece--panel .zoom {
  aspect-ratio: var(--r);
  display: grid; place-items: center;
  padding: 12%;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
}
.piece--light .zoom { background: var(--panel-light); }
.piece--dark .zoom { background: var(--panel-dark); }
.piece--panel .zoom picture, .piece--panel .zoom > img { width: 100%; height: 100%; display: grid; place-items: center; }
.piece--panel img { outline: 0; width: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.piece--panel .zoom:hover { border-color: var(--accent); }
.piece figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted); }

.piece--video video { width: 100%; height: auto; background: #000; }

/* videos en loop */
.loops {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
}
@media (width >= 900px) { .loops { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.loops video { width: 100%; height: auto; aspect-ratio: 4 / 5; background: var(--line); }
.loops-bar { display: flex; justify-content: flex-end; margin-bottom: 0.5rem; }
.loops-toggle {
  font: inherit; font-size: 0.9375rem; color: var(--muted);
  background: none; border: 0; padding: 0.4rem 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px;
}
.loops-toggle:hover { color: var(--accent); }

/* ---------- CV ---------- */
.cv {
  margin-top: clamp(5rem, 3rem + 6vw, 9rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.cv h2 { margin-bottom: 2rem; }
.lead {
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.75rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  max-width: 34ch;
}
.jobs > li {
  display: grid; gap: 0.25rem 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line);
}
.jobs > li:first-child { border-top: 0; padding-top: 0; }
@media (width >= 720px) { .jobs > li { grid-template-columns: 9rem minmax(0, 44rem); } }
.years { color: var(--muted); font-variant-numeric: tabular-nums; }
.jobs h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
.job-role { color: var(--muted); margin-bottom: 0.6rem; }
.jobs ul { padding-left: 1.1em; }
.jobs ul li + li { margin-top: 0.3rem; }
.cv-cols { display: grid; gap: 2rem 3rem; margin-top: 3rem; }
@media (width >= 720px) { .cv-cols { grid-template-columns: repeat(2, minmax(0, 24rem)); } }
.cv-cols h3 { font-size: 1.0625rem; margin-bottom: 0.6rem; }
.plain li + li { margin-top: 0.3rem; }
.muted { color: var(--muted); }

.contact { padding-bottom: clamp(4rem, 2rem + 6vw, 8rem); min-height: 66vh; }
.contact-mail {
  font-size: clamp(1.5rem, 0.8rem + 3.4vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  margin-bottom: 1rem;
}
.contact > p:not(.contact-mail, .contact-phone) { color: var(--muted); }
.contact-phone { font-size: clamp(1.125rem, 1rem + 0.8vw, 1.5rem); margin-bottom: 1.25rem; }

/* ---------- visor ---------- */
.lightbox {
  width: 100vw; max-width: none;
  height: 100dvh; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: color-mix(in srgb, var(--bg) 97%, transparent);
  color: var(--text);
}
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lightbox:modal { overscroll-behavior: contain; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.5); overflow: hidden; overscroll-behavior: contain; }
.lightbox figure {
  margin: 0; min-height: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); place-items: center;
  padding: var(--pad) var(--pad) 0.5rem;
  gap: 0.75rem;
}
.lightbox picture { min-height: 0; height: 100%; display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; object-fit: contain; }
.lightbox[data-panel] picture { width: 100%; padding: 6%; }
.lightbox[data-panel] img { width: min(70%, 44rem); height: calc(100dvh - 20rem); max-height: none; object-fit: contain; }
.lightbox[data-panel="light"] picture { background: var(--panel-light); }
.lightbox[data-panel="dark"] picture { background: var(--panel-dark); }
.lightbox figcaption { color: var(--muted); font-size: 0.9375rem; max-width: 70ch; text-align: center; }
.lb-controls {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem 1.5rem; flex-wrap: wrap;
  padding: 0.75rem var(--pad) 1.25rem;
}
.lb-controls form { margin: 0; }
.lb-controls button {
  font: inherit; color: inherit; background: none;
  border: 1px solid var(--line); border-radius: 2px;
  padding: 0.5em 1em; cursor: pointer; min-height: 44px;
}
.lb-controls button:hover { border-color: var(--accent); color: var(--accent); }
.lb-controls button[hidden] { display: none; }
.lb-count { color: var(--muted); min-width: 4ch; text-align: center; }

/* ---------- portada: índice visual ---------- */
.covers ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem var(--gap);
}
.cover--case { grid-column: 1 / -1; }
@media (width >= 640px) {
  .covers ol { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cover { grid-column: span 2; }
}
@media (width >= 1024px) {
  .cover { grid-column: span 1; }
  .cover--case { grid-column: span 2; }
}
.cover a { display: grid; gap: 0.3rem; text-decoration: none; }
.cover-img { display: block; overflow: hidden; aspect-ratio: 4 / 3; background: var(--line); margin-bottom: 0.35rem; }
.cover-img picture { display: contents; }
.cover-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, center); }
.cover--case .cover-img { aspect-ratio: 3 / 2; }
.cover-name { font-weight: 600; line-height: 1.2; }
.cover--case .cover-name { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.5rem); letter-spacing: -0.015em; }
.cover-tag { color: var(--muted); font-size: 0.875rem; }
.cover a:hover .cover-name { color: var(--accent); }

/* ---------- capítulos ---------- */
.chapter { margin-top: clamp(5rem, 3rem + 6vw, 10rem); }
.chapter-title {
  font-size: clamp(2.5rem, 1rem + 5vw, 5.75rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(2rem, 1rem + 3vw, 4rem);
}

/* ---------- casos de identidad: bloque con el color de la marca ---------- */
.case {
  --pb: clamp(3rem, 2rem + 5vw, 7rem);
  --pi: var(--pad);
  --text: var(--c-fg); --muted: var(--c-muted); --line: var(--c-line); --accent: var(--c-accent);
  color-scheme: dark;
  background: var(--c-bg);
  color: var(--c-fg);
  margin-inline: calc(var(--pad) * -1);
  padding: var(--pb) var(--pi);
}
@media (width >= 1024px) {
  .case {
    --pi: clamp(2rem, 3.5vw, 4.5rem);
    margin-left: calc(clamp(2rem, 4vw, 5rem) * -0.5);
    margin-right: calc(var(--pad) * -1);
  }
}
.case a:hover { color: var(--accent); }
.case-head { margin-bottom: clamp(2.5rem, 2rem + 3vw, 5rem); }
.case--head .case-head {
  --muted: color-mix(in srgb, var(--c-head-fg) 72%, transparent);
  --line: color-mix(in srgb, var(--c-head-fg) 22%, transparent);
  background: var(--c-head);
  color: var(--c-head-fg);
  margin: calc(var(--pb) * -1) calc(var(--pi) * -1) clamp(2.5rem, 2rem + 3vw, 5rem);
  padding: var(--pb) var(--pi);
}
.case-tag { color: var(--accent); font-weight: 500; margin-bottom: 0.75rem; }
.case--head .case-tag { color: inherit; opacity: 0.8; }
.case-head h3 {
  font-size: clamp(3.25rem, 0.5rem + 9vw, 9.5rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
}
.case-what { font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); line-height: 1.35; max-width: 34ch; margin-top: 1.75rem; }
.facts { display: grid; gap: 0 2rem; margin: 2.5rem 0 0; }
@media (width >= 900px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.facts div { border-top: 1px solid var(--line); padding: 0.75rem 0 1rem; }
.facts dt { color: var(--muted); font-size: 0.875rem; }
.facts dd { margin: 0.2rem 0 0; }

.part { margin-top: clamp(2.5rem, 2rem + 3vw, 5rem); }
.case-system .part:first-child { margin-top: 0; }
.part h4 {
  font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em;
  padding-top: 0.75rem; margin-bottom: 1.25rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 -1px / 48px 2px;
}
.part-note { color: var(--muted); margin: -0.75rem 0 1.25rem; }

.palette { display: flex; flex-wrap: wrap; gap: var(--gap); }
.palette li {
  flex: 1 1 calc(33% - var(--gap));
  min-height: clamp(6.5rem, 4rem + 6vw, 10rem);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 0.8rem 0.9rem;
  background: var(--sw); color: var(--sw-fg);
  border: 1px solid color-mix(in srgb, var(--c-fg) 14%, transparent);
}
@media (width >= 900px) { .palette li { flex-basis: 0; } }
.sw-name { font-weight: 600; font-size: 0.9375rem; }
.sw-hex { font-size: 0.875rem; font-variant-numeric: tabular-nums; opacity: 0.85; }

/* ---------- movimiento (solo si no se pidió reducirlo) ---------- */
.zoom { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .zoom img, .cover-img img { transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .zoom:hover img { transform: scale(1.025); }
  .piece--panel .zoom:hover img { transform: scale(1.06); }
  .cover a:hover .cover-img img { transform: scale(1.045); }
}

.lightbox[open] {
  opacity: 1;
  @starting-style { opacity: 0; }
  @media (prefers-reduced-motion: no-preference) {
    & figure { transform: none; }
  }
}
.lightbox {
  opacity: 0;
  transition-property: opacity, display, overlay;
  transition-duration: 0.25s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}
@media (prefers-reduced-motion: no-preference) {
  .lightbox figure { transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .lightbox[open] figure { @starting-style { transform: scale(0.97); } }
}
@media (prefers-reduced-motion: reduce) { .lightbox { transition-duration: 0.1s; } }
.lightbox::backdrop {
  transition-property: background-color, display, overlay;
  transition-duration: 0.25s;
  transition-behavior: allow-discrete;
}
.lightbox[open]::backdrop { @starting-style { background-color: transparent; } }
