﻿/* ==========================================================================
   CM. — Portafolio de proyectos digitales
   Dirección: monocromo oscuro, tipografía ligera del sistema, proyectos al frente.
   Colores, tipografía y espacios están en :root.
   ========================================================================== */

:root {
  /* Color */
  --bg: #080808;          /* fondo principal */
  --surface: #111111;     /* superficies secundarias */
  --surface-2: #151515;
  --raised: #1b1b1b;      /* superficies elevadas */
  --line: #292929;        /* bordes y separadores */
  --text: #f5f5f5;        /* texto principal */
  --muted: #a0a0a0;       /* texto secundario */
  --faint: #6e6e6e;       /* detalles no esenciales (no para texto de lectura) */

  /* Tipografía: San Francisco en Apple, Segoe UI Variable en Windows, Roboto en Android */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.1875rem, 1rem + 0.7vw, 1.5rem);
  --fs-h3: clamp(1.5rem, 1.15rem + 1.3vw, 2.25rem);
  --fs-h2: clamp(2.5rem, 1.4rem + 4.4vw, 5.5rem);
  --fs-display: clamp(3.5rem, 0.9rem + 10.4vw, 11.5rem);

  /* Espacio */
  --margin: clamp(1.25rem, 0.6rem + 3vw, 3.5rem);
  --gap: clamp(1rem, 0.5rem + 1.6vw, 2rem);
  --section: clamp(5rem, 3rem + 6.5vw, 9.5rem);  /* espacio vertical entre secciones */
  --content-max: 100rem;                          /* ancho máximo del contenido (1600 px) */
  --frame: max(var(--margin), calc((100% - var(--content-max)) / 2));
  --header-h: 4rem;
  --radius: 6px;

  /* Movimiento: las mismas curvas que GSAP usa en assets/js/tokens.js */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* entradas y respuestas */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* cambios de forma o lugar */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);   /* paneles tipo hoja (iOS) */
  --ease: var(--ease-out);
  --d-press: 120ms;   /* respuesta al pulsar */
  --d-ui: 240ms;      /* hover, foco, estados */
  --d-slow: 600ms;    /* superficies grandes */

  /* Materiales: translúcidos solo donde marcan jerarquía (encabezado, carpetas, ficha) */
  --glass: rgb(10 10 10 / 0.88);
  --glass-thick: rgb(13 13 13 / 0.86);
  --glass-edge: rgb(255 255 255 / 0.08);
  --glass-highlight: rgb(255 255 255 / 0.12);
}

/* ---------- Fondo ambiental: luz difusa en una capa fija detrás de todo ---------- */
.ambiente { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: var(--bg); contain: strict; }
.ambiente-luces { position: absolute; inset: -20% -12%; will-change: transform; }
.luz { position: absolute; border-radius: 50%; will-change: transform; }
/* taste-skill-ignore: los degradados de luz son el material del fondo pedido en el brief */
.luz--a { width: 88vmax; height: 88vmax; left: -28vmax; top: -24vmax; background: radial-gradient(closest-side, rgb(255 255 255 / 0.075), rgb(255 255 255 / 0.028) 46%, transparent); } /* taste-skill-ignore */
.luz--b { width: 72vmax; height: 72vmax; right: -24vmax; top: 34vh; background: radial-gradient(closest-side, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0.018) 50%, transparent); } /* taste-skill-ignore */
.luz--c { width: 96vmax; height: 58vmax; left: 12vw; bottom: -26vmax; background: radial-gradient(closest-side, rgb(255 255 255 / 0.055), rgb(255 255 255 / 0.02) 50%, transparent); } /* taste-skill-ignore */
.luz--cursor { width: 40rem; height: 40rem; left: 0; top: 0; opacity: 0; background: radial-gradient(closest-side, rgb(255 255 255 / 0.04), transparent); } /* taste-skill-ignore */
.ambiente-vineta { position: absolute; inset: 0; background: radial-gradient(130% 95% at 50% 38%, transparent 52%, rgb(0 0 0 / 0.6)); } /* taste-skill-ignore */
.ambiente-grano { position: absolute; inset: 0; opacity: 0.035; background-size: 160px 160px; }
@media (hover: none) { .luz--cursor { display: none; } }
main, .detail { position: relative; z-index: 1; }
.scroll-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--text); transform: scaleX(0); transform-origin: left center; opacity: 0.5; pointer-events: none; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  background: var(--bg);
}
@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: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, iframe { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--text); color: var(--bg); }
[hidden] { display: none !important; }
.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: var(--margin); top: -4rem; z-index: 100;
  background: var(--text); color: var(--bg); padding: 0.75rem 1rem; border-radius: 999px; text-decoration: none;
}
.skip:focus { top: 0.75rem; }
.dot { display: inline-block; }

/* Antes de que GSAP arranque, la entrada queda oculta (solo con movimiento permitido) */
.intro [data-intro], .intro .hero-title .line-in { visibility: hidden; }

/* ---------- Botones y enlaces ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 3rem; padding: 0 1.4rem;
  border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1; letter-spacing: 0;
  text-decoration: none; white-space: nowrap;
  transition: background-color var(--d-ui) var(--ease), box-shadow var(--d-ui) var(--ease), color var(--d-ui) var(--ease), transform var(--d-ui) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); transition-duration: var(--d-press); }
.btn--light { background: var(--text); color: var(--bg); }
.btn--light:hover { background: #ffffff; }
.btn--quiet { min-height: 2.5rem; padding: 0 1.1rem; background: rgb(255 255 255 / 0.03); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 var(--glass-edge); color: var(--text); } /* taste-skill-ignore: borde fino con reflejo superior */
.btn--quiet:hover { background: rgb(255 255 255 / 0.07); box-shadow: inset 0 0 0 1px #3a3a3a, inset 0 1px 0 var(--glass-highlight); } /* taste-skill-ignore */
.btn--lg { min-height: 3.5rem; padding: 0 1.75rem; font-size: var(--fs-body); }
.btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn[aria-disabled="true"]:active { transform: none; }
.arrow { display: inline-block; transition: transform 300ms var(--ease); }
a:hover > .arrow, button:hover > .arrow { transform: translateX(3px); }
a:hover > .arrow--out { transform: translate(2px, -2px); }
.btn--light:hover .arrow:not(.arrow--out) { transform: translateY(2px); }

/* ---------- Encabezado ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 var(--frame);
  padding-left: max(var(--frame), env(safe-area-inset-left));
  padding-right: max(var(--frame), env(safe-area-inset-right));
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 400ms var(--ease), border-color 400ms var(--ease);
}
.site-header.is-scrolled {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom-color: var(--glass-edge);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header.is-scrolled { background: rgb(8 8 8 / 0.96); }
}
.wordmark {
  font-family: var(--font-display); font-size: 1.375rem; font-weight: 500; letter-spacing: -0.03em;
  text-decoration: none; line-height: 1; padding-block: 0.5rem;
}
.nav { margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: clamp(1.25rem, 2.4vw, 2.25rem); }
.nav-links a:not(.btn) {
  font-size: var(--fs-sm); color: var(--muted); text-decoration: none; padding-block: 0.75rem;
  transition: color 250ms var(--ease);
}
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-toggle { display: none; min-height: 2.75rem; padding: 0 0.25rem; font-size: var(--fs-sm); font-weight: 500; }

@media (max-width: 40em) {
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--margin) 1.5rem;
    visibility: hidden; opacity: 0; transform: translateY(-6px);
    transition: opacity 220ms var(--ease), transform 300ms var(--ease), visibility 0s 300ms;
  }
  .nav-links a:not(.btn) { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 300; letter-spacing: -0.03em; color: var(--text); padding-block: 0.6rem; }
  .nav-links .btn { width: 100%; margin-top: 1rem; min-height: 3rem; }
  .nav[data-open="true"] .nav-links { visibility: visible; opacity: 1; transform: none; transition: opacity 220ms var(--ease), transform 300ms var(--ease); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92svh;
  display: grid; grid-template-rows: auto 1fr auto auto;
  padding: calc(var(--header-h) + clamp(1.5rem, 5vh, 4rem)) var(--frame) clamp(1.75rem, 5vh, 3rem);
}
.hero-label {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.hero-title {
  align-self: end;
  font-family: var(--font-display); font-weight: 300;
  font-size: var(--fs-display); line-height: 0.95; letter-spacing: -0.045em;
  margin: clamp(2rem, 8vh, 6rem) 0 clamp(2rem, 6vh, 4rem) -0.05em;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero-title .line-in { display: block; will-change: transform; }
.hero-title .line:nth-child(2) { padding-left: clamp(0rem, 8vw, 9rem); }
.hero-dot { display: inline-block; }
.hero-foot {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 1.75rem;
  align-items: end; padding-bottom: clamp(1.75rem, 4vh, 2.5rem);
}
.hero-copy { grid-column: 1 / 7; display: grid; gap: 1.75rem; justify-items: start; }
.hero-lead { font-size: var(--fs-lead); line-height: 1.45; color: var(--muted); max-width: 30ch; font-weight: 400; }
.hero-index { grid-column: 9 / 13; display: grid; }
.hero-index-item {
  width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.55rem 0; text-align: left;
  font-size: var(--fs-sm); color: var(--muted);
  border-top: 1px solid var(--line);
  transition: color 250ms var(--ease), padding 300ms var(--ease);
}
.hero-index li:last-child .hero-index-item { border-bottom: 1px solid var(--line); }
.hero-index-item:hover { color: var(--text); padding-left: 0.5rem; }
.hero-index-count { font-variant-numeric: tabular-nums; color: var(--faint); font-size: var(--fs-xs); }
.hero-rule { display: block; height: 1px; background: var(--line); transform-origin: left center; }
@media (max-width: 63.99em) {
  .hero-copy { grid-column: 1 / 8; }
  .hero-index { grid-column: 8 / 13; }
}
@media (max-width: 40em) {
  .hero { min-height: 100svh; --fs-display: 16.5vw; }
  .hero-title .line:nth-child(2) { padding-left: 0; }
  .hero-copy { grid-column: 1 / -1; justify-items: stretch; }
  .hero-index { display: none; }
}

/* ---------- Proyectos ---------- */
.work { padding: var(--section) var(--frame) 0; }
.work-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem 2rem;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}
.work-title { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 300; letter-spacing: -0.04em; line-height: 1; }
.work-total { font-size: 0.28em; font-weight: 400; letter-spacing: 0; color: var(--muted); vertical-align: super; margin-left: 0.2em; font-variant-numeric: tabular-nums; }
.work-title-text { display: inline-block; }
.work-intro { max-width: 36ch; font-size: var(--fs-lead); line-height: 1.4; color: var(--muted); }
.work-heading { display: grid; gap: 1.25rem; }
.work-empty { font-size: var(--fs-lead); color: var(--muted); }

/* ==========================================================================
   Explorador de proyectos: carpetas → carpeta abierta → ficha (panel)
   ========================================================================== */
.explorer { position: relative; }
.explorer-path {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem;
  min-height: 2.75rem; margin-bottom: clamp(1.25rem, 3vw, 2rem);
  font-size: var(--fs-sm); color: var(--muted);
}
.path-root { min-height: 2.75rem; padding: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 0.3em; transition: text-decoration-color 250ms var(--ease); }
.path-root:hover { text-decoration-color: var(--text); }
.path-root:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.path-sep { color: var(--line); }
.path-current { color: var(--muted); }
.explorer.is-open .path-current { color: var(--text); }

/* ---------- Carpetas ---------- */
.folders {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}
.folders[data-count="1"] { grid-template-columns: minmax(0, 46rem); }
.folders[data-count="2"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }

.folder {
  --tab: 2.5rem;
  position: relative; display: block; width: 100%;
  height: clamp(21rem, 18rem + 9vw, 28rem);
  text-align: left; color: var(--text);
  perspective: 1400px;
  -webkit-tap-highlight-color: transparent;
}
.folder:focus-visible { outline: none; }
.folder-back {
  position: absolute; inset: calc(var(--tab) - 1px) 0 0 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 0 14px 14px 14px;
  transition: border-color 400ms var(--ease);
}
.folder-tab {
  position: absolute; top: 0; left: 0; z-index: 1;
  display: flex; align-items: center; height: var(--tab); padding: 0 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 12px 12px 0 0;
  font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em;
  transition: color 300ms var(--ease), border-color 400ms var(--ease);
}
.folder-tab::after { /* une la pestaña con el cuerpo sin línea intermedia */
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; background: var(--surface);
}
.folder-sheets {
  position: absolute; left: 7%; right: 7%; top: calc(var(--tab) + 1.25rem); height: 58%; z-index: 2;
  pointer-events: none;
}
.sheet {
  --r: 0deg; --ty: 0%;
  position: absolute; top: 0; height: 100%; width: 44%;
  border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--raised);
  transform: translateY(var(--ty)) rotate(var(--r));
  transition: transform var(--d-slow) var(--ease-out);
}
.sheet:nth-child(1) { left: 0; --r: -5deg; }
.sheet:nth-child(2) { left: 28%; --r: 1.5deg; z-index: 1; transition-delay: 40ms; }
.sheet:nth-child(3) { right: 0; --r: 6deg; transition-delay: 80ms; }
.sheet:only-child { left: 28%; }
.sheet img { width: 100%; height: 100%; object-fit: cover; object-position: top center; filter: grayscale(0.35) brightness(0.8); transition: filter 600ms var(--ease); }
.sheet-blank { display: block; width: 100%; height: 100%; background: var(--raised); }
.folder-front {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  height: 56%;
  display: grid; align-content: end; gap: 0.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: rgb(18 18 18 / 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(0.15); /* el material es gris: no hereda el color de las capturas */
  backdrop-filter: blur(16px) saturate(0.15);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 -24px 40px -24px rgb(0 0 0 / 0.9); /* taste-skill-ignore: profundidad y reflejo del frente */
  transform-origin: 50% 100%;
  transition: transform var(--d-slow) var(--ease-out), border-color var(--d-ui) var(--ease), background-color var(--d-ui) var(--ease);
  overflow: hidden;
}
.folder-front::after { /* luz que sigue al cursor sobre el material */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(22rem circle at var(--lx, 50%) var(--ly, 0%), rgb(255 255 255 / 0.07), transparent 60%); /* taste-skill-ignore */
  opacity: 0; transition: opacity var(--d-slow) var(--ease);
}
.folder:hover .folder-front::after, .folder:focus-visible .folder-front::after { opacity: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .folder-front { background: #121212; }
}
.folder-name { font-family: var(--font-display); font-size: clamp(1.75rem, 1.2rem + 1.7vw, 2.75rem); font-weight: 300; line-height: 1.05; letter-spacing: -0.035em; text-wrap: balance; }
.folder-desc { font-size: var(--fs-sm); color: var(--muted); max-width: 36ch; }
.folder-cta { display: inline-flex; align-items: center; gap: 0.4em; margin-top: 0.5rem; font-size: var(--fs-sm); font-weight: 500; }

/* Abrir: las hojas suben, el frente se inclina hacia el visitante */
.folder:hover .sheet, .folder:focus-visible .sheet { --ty: -16%; }
.folder:hover .sheet img, .folder:focus-visible .sheet img { filter: none; }
.folder:hover .folder-front, .folder:focus-visible .folder-front { transform: rotateX(-9deg); background-color: #141414; border-color: #3a3a3a; }
.folder:hover .folder-back, .folder:hover .folder-tab, .folder:focus-visible .folder-back, .folder:focus-visible .folder-tab { border-color: #3a3a3a; }
.folder:hover .folder-tab, .folder:focus-visible .folder-tab { color: var(--text); }
.folder:hover .folder-cta .arrow, .folder:focus-visible .folder-cta .arrow { transform: translateX(4px); }
.folder:focus-visible .folder-front { outline: 2px solid var(--text); outline-offset: 4px; }
.folder:active .folder-front { transform: rotateX(-5deg) scale(0.985); transition-duration: var(--d-press); }
.folder { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: none) {
  .sheet { --ty: -6%; }
  .sheet img { filter: none; }
}

/* ---------- Carpeta abierta ---------- */
.folder-open {
  position: relative;
  background: rgb(17 17 17 / 0.9); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--glass-edge); /* taste-skill-ignore: reflejo del borde superior */
  padding: clamp(1.25rem, 3.5vw, 3.25rem);
}
.folder-open:focus { outline: none; }
/* el foco se mueve al panel al abrirlo; el botón "Todas las carpetas" muestra su propio anillo */
.open-head {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 1.25rem;
  align-items: end; padding-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.open-back {
  grid-column: 1 / -1; justify-self: start;
  display: inline-flex; align-items: center; gap: 0.5em; min-height: 2.75rem; padding: 0 1.1rem;
  border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); /* taste-skill-ignore */
  font-size: var(--fs-sm); color: var(--text);
  transition: box-shadow 250ms var(--ease);
}
.open-back:hover { box-shadow: inset 0 0 0 1px var(--muted); } /* taste-skill-ignore */
.open-back:hover .arrow { transform: translateX(-3px); }
.open-heading { grid-column: 1 / 8; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; }
.open-title { font-family: var(--font-display); font-size: clamp(2.25rem, 1.3rem + 3.4vw, 4.75rem); font-weight: 300; line-height: 1; letter-spacing: -0.045em; }
.open-count { font-size: var(--fs-sm); color: var(--muted); }
.open-desc { grid-column: 8 / 13; color: var(--muted); max-width: 34ch; }

.files { list-style: none; margin: 0; padding: 0; }
.file { border-top: 1px solid var(--line); padding-block: clamp(1.75rem, 3.5vw, 3rem); }
.file:last-child { padding-bottom: 0.5rem; }
.file-card { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 1.5rem; align-items: start; }
.file-visual { grid-column: 1 / 8; display: block; width: 100%; text-align: left; border-radius: 10px; cursor: pointer; }
.file-visual:focus-visible { outline: 2px solid var(--text); outline-offset: 6px; }
.file-visual { -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform var(--d-ui) var(--ease-out); }
.file-visual:active { transform: scale(0.985); transition-duration: var(--d-press); }
.strip {
  display: flex; gap: clamp(0.5rem, 1vw, 0.875rem);
  height: clamp(15rem, 10rem + 14vw, 26rem);
  overflow: hidden;
}
.strip-frame {
  flex: none; height: 100%; display: block; position: relative;
  border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--raised);
  transition: transform var(--d-slow) var(--ease-out), border-color var(--d-ui) var(--ease);
}
.strip-frame img { display: block; height: 100%; width: auto; max-width: none; }
.strip-frame:nth-child(2) { transition-delay: 50ms; }
.strip-frame:nth-child(3) { transition-delay: 100ms; }
.strip--empty { display: block; position: relative; aspect-ratio: 16 / 10; height: auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
@media (hover: hover) and (pointer: fine) {
  .file-visual:hover .strip-frame { transform: translateY(-6px); border-color: #3a3a3a; }
  .file-visual:hover .strip-frame:nth-child(2) { transform: translateY(-10px); }
}
.file-info { grid-column: 8 / 13; display: grid; gap: 0.9rem; align-content: start; }
.file-title { font-family: var(--font-display); font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.75rem); font-weight: 300; line-height: 1.05; letter-spacing: -0.035em; text-wrap: balance; }
.file-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em; }
.file-status { padding: 0.15rem 0.6rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); color: var(--text); } /* taste-skill-ignore */
.file-summary { color: var(--muted); max-width: 42ch; }
.file-features li { padding: 0.6rem 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.file-features li:last-child { border-bottom: 1px solid var(--line); }
.file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 0.5rem; }
.file-demo {
  display: inline-flex; align-items: center; gap: 0.4em; min-height: 2.75rem;
  font-size: var(--fs-sm); font-weight: 500; text-decoration: none;
  border-bottom: 1px solid var(--line); transition: border-color 250ms var(--ease);
}
.file-demo:hover { border-color: var(--text); }

@media (max-width: 63.99em) {
  .open-heading, .open-desc { grid-column: 1 / -1; }
  .file-visual, .file-info { grid-column: 1 / -1; }
}
@media (max-width: 40em) {
  .folder { height: 22rem; }
  .strip { height: 15rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .strip::-webkit-scrollbar { display: none; }
  .strip-frame { scroll-snap-align: start; }
  .file-actions .btn { flex: 1 1 auto; }
}

/* ---------- Ficha del proyecto (panel) ---------- */
html.dossier-abierto { overflow: hidden; }
.dossier {
  padding: 0; border: 0; margin: auto;
  width: min(100% - 2rem, 78rem); max-width: none;
  max-height: calc(100dvh - 2.5rem);
  background: transparent; color: var(--text); overflow: visible;
}
.dossier::backdrop { background: rgb(0 0 0 / 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dossier-inner {
  max-height: calc(100dvh - 2.5rem); overflow-y: auto; overscroll-behavior: contain;
  background: var(--glass-thick);
  -webkit-backdrop-filter: blur(28px) saturate(130%);
  backdrop-filter: blur(28px) saturate(130%);
  border: 1px solid var(--glass-edge); border-radius: 18px;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 50px 120px -40px rgb(0 0 0 / 0.95); /* taste-skill-ignore: superficie flotante */
  padding: 0 clamp(1.25rem, 3vw, 2.75rem) clamp(1.5rem, 3vw, 2.75rem);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.dossier-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding-top: clamp(1.25rem, 3vw, 2.5rem); padding-bottom: 1rem;
  background: rgb(14 14 14 / 0.92);
  margin-inline: calc(clamp(1.25rem, 3vw, 2.75rem) * -1); padding-inline: clamp(1.25rem, 3vw, 2.75rem);
}
.dossier-meta { font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em; margin-bottom: 0.5rem; }
.dossier-title { font-family: var(--font-display); font-size: clamp(2rem, 1.3rem + 2.6vw, 3.75rem); font-weight: 300; line-height: 1.02; letter-spacing: -0.04em; }
.dossier-close {
  flex: none; display: inline-flex; align-items: center; gap: 0.5em; min-height: 2.75rem; padding: 0 1.1rem;
  border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); /* taste-skill-ignore */
  font-size: var(--fs-sm); transition: box-shadow 250ms var(--ease);
}
.dossier-close:hover { box-shadow: inset 0 0 0 1px var(--muted); } /* taste-skill-ignore */
.dossier-gallery {
  display: flex; gap: 1rem; margin: 0.5rem 0 clamp(1.75rem, 3vw, 2.5rem);
  height: clamp(18rem, 52vh, 34rem);
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding-bottom: 0.75rem;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.dossier-gallery:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 10px; }
.dossier-shot { flex: none; position: relative; height: 100%; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--raised); scroll-snap-align: start; }
.dossier-shot img { display: block; height: 100%; width: auto; max-width: none; }
.dossier-gallery--empty .dossier-shot { width: 100%; }
.dossier-body { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2rem; align-items: start; }
.dossier-text { grid-column: 1 / 8; display: grid; gap: 1.75rem; }
.dossier-summary { font-family: var(--font-display); font-size: var(--fs-lead); font-weight: 300; line-height: 1.45; }
.dossier-block h4 { font-size: var(--fs-sm); font-weight: 400; color: var(--muted); margin: 0 0 0.6rem; }
.dossier-block p { color: var(--text); max-width: 60ch; }
.dossier-features li { padding: 0.65rem 0; border-top: 1px solid var(--line); }
.dossier-features li:last-child { border-bottom: 1px solid var(--line); }
.dossier-tags { font-size: var(--fs-xs); color: var(--muted); }
.dossier-actions { grid-column: 9 / 13; display: grid; gap: 1rem; justify-items: start; position: sticky; top: 7rem; }
.dossier-page { display: inline-flex; gap: 0.4em; align-items: center; min-height: 2.75rem; font-size: var(--fs-sm); color: var(--muted); text-decoration: none; transition: color 250ms var(--ease); }
.dossier-page:hover { color: var(--text); }
@media (max-width: 47.99em) {
  .dossier { width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; }
  .dossier-inner { height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .dossier-gallery { height: 62vh; }
  .dossier-text, .dossier-actions { grid-column: 1 / -1; }
  .dossier-actions { position: static; justify-items: stretch; }
}

/* Espacio para imagen pendiente */
.pending {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 0.5rem;
  background: var(--surface-2); color: var(--muted); text-align: center; padding: 1rem;
}
.pending-initials { font-family: var(--font-display); font-weight: 200; font-size: clamp(3rem, 9vw, 7rem); line-height: 1; letter-spacing: -0.05em; color: var(--line); }
.pending-label { font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em; }

/* ---------- Sobre mí ---------- */
.about {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2rem;
  padding: var(--section) var(--frame);
}
.about-label { grid-column: 1 / 4; align-self: start; font-size: var(--fs-sm); font-weight: 400; color: var(--muted); padding-top: 0.6em; }
.about-text {
  grid-column: 4 / 12;
  font-family: var(--font-display); font-size: clamp(1.5rem, 1.05rem + 1.7vw, 2.75rem); font-weight: 300;
  line-height: 1.25; letter-spacing: -0.025em; color: var(--muted);
  max-width: 30em;
}
.about-text p + p { margin-top: 0.9em; }
.about-text strong { font-weight: 400; color: var(--text); }
@media (max-width: 40em) {
  .about-label, .about-text { grid-column: 1 / -1; }
}

/* ---------- Contacto y pie ---------- */
.site-footer { position: relative; z-index: 1; border-top: 1px solid var(--line); overflow: hidden; }
.contact {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 2.5rem;
  align-items: end;
  padding: var(--section) var(--frame) clamp(3.5rem, 6vw, 6rem);
}
.contact-title {
  grid-column: 1 / 9;
  font-family: var(--font-display); font-size: clamp(3rem, 0.8rem + 8vw, 9.5rem); font-weight: 300;
  line-height: 0.98; letter-spacing: -0.045em;
}
.contact-side { grid-column: 9 / 13; display: grid; gap: 1.5rem; justify-items: start; padding-bottom: 0.75rem; }
.contact-lead { font-size: var(--fs-lead); color: var(--muted); line-height: 1.4; }
.whatsapp-note { font-size: var(--fs-xs); color: var(--muted); }
.footer-bottom {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1.5rem 2rem;
  padding: 0 var(--frame) max(1.5rem, env(safe-area-inset-bottom));
}
.footer-mark {
  grid-column: 1 / -1;
  font-family: var(--font-display); font-weight: 300; letter-spacing: -0.06em; line-height: 0.75;
  font-size: clamp(8rem, 30vw, 30rem); color: var(--surface-2);
  margin-left: -0.05em; user-select: none;
  -webkit-text-stroke: 1px var(--line);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; font-size: var(--fs-sm); }
.footer-links a { color: var(--muted); text-decoration: none; padding-block: 0.6rem; display: inline-block; transition: color 250ms var(--ease); }
.footer-links a:hover { color: var(--text); }
.footer-legal { font-size: var(--fs-xs); color: var(--muted); text-align: right; }
@media (max-width: 63.99em) {
  .contact-title, .contact-side { grid-column: 1 / -1; }
}
@media (max-width: 40em) {
  .contact-side .btn { width: 100%; }
  .footer-bottom { grid-template-columns: 1fr; }
  .footer-legal { text-align: left; }
}

/* ---------- Página de proyecto ---------- */
.detail { padding: calc(var(--header-h) + clamp(2rem, 6vw, 5rem)) var(--frame) var(--section); }
.back {
  display: inline-flex; gap: 0.5em; align-items: center; min-height: 2.75rem;
  font-size: var(--fs-sm); color: var(--muted); text-decoration: none; margin-bottom: clamp(2rem, 5vw, 4rem);
  transition: color 250ms var(--ease);
}
.back:hover { color: var(--text); }
.back:hover .arrow { transform: translateX(-3px); }
.detail-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 1.5rem; align-items: end; }
.detail-category { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.02em; }
.detail-category a { color: var(--muted); }
.detail-category a:hover { color: var(--text); }
.detail-title { grid-column: 1 / 10; font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 300; line-height: 1; letter-spacing: -0.04em; text-wrap: balance; }
.detail-title--long { font-size: clamp(2rem, 1.2rem + 3vw, 3.75rem); }
.detail-aside { grid-column: 10 / 13; display: grid; gap: 1rem; justify-items: start; }
.detail-summary { grid-column: 1 / 8; font-size: var(--fs-lead); line-height: 1.45; color: var(--muted); max-width: 42ch; }
.detail-head .provisional-note { grid-column: 1 / -1; }
.project-tags { font-size: var(--fs-xs); color: var(--muted); }
.detail-cover {
  position: relative; margin-top: clamp(3rem, 6vw, 5rem);
  aspect-ratio: 16 / 9; max-height: 88svh; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.detail-body { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: clamp(3.5rem, 7vw, 6rem); margin-top: clamp(4rem, 8vw, 8rem); }
.detail-block { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.detail-block h2 { grid-column: 1 / 5; font-size: var(--fs-sm); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.detail-block > :not(h2) { grid-column: 5 / 12; max-width: 60ch; }
.detail-block p { font-family: var(--font-display); font-size: var(--fs-lead); font-weight: 300; line-height: 1.45; letter-spacing: -0.01em; }
.feature-list { display: grid; }
.feature-list li { padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.feature-list li:first-child { padding-top: 0; }
.gallery { grid-column: 1 / -1 !important; max-width: none !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: var(--gap); }
.gallery figure { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery img { width: 100%; height: auto; }
.gallery figcaption { font-size: var(--fs-xs); color: var(--muted); padding: 0.75rem 1rem; background: var(--bg); }
.gallery .pending { position: relative; aspect-ratio: 16 / 10; }
.detail-next { margin-top: var(--section); display: grid; gap: 0.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.detail-next span { font-size: var(--fs-sm); color: var(--muted); }
.detail-next a { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 300; letter-spacing: -0.04em; line-height: 1.05; text-decoration: none; text-wrap: balance; }
.detail-next a:hover .arrow { transform: translateX(8px); }
.detail-missing { min-height: 70svh; display: grid; align-content: center; gap: 1.5rem; justify-items: start; }
.detail-missing h1 { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 300; letter-spacing: -0.04em; line-height: 1; max-width: 16ch; }
.detail-missing p { color: var(--muted); }
@media (max-width: 47.99em) {
  .detail-title, .detail-aside, .detail-summary { grid-column: 1 / -1; }
  .detail-block h2, .detail-block > :not(h2) { grid-column: 1 / -1; }
  .detail-cover { aspect-ratio: 4 / 5; }
  .detail-aside .btn { width: 100%; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* Máscaras de SplitText: margen para que no se corten descendentes (g, j, q) */
[data-split] .sl-mask { padding-bottom: 0.14em; margin-bottom: -0.14em; }

/* Portada de detalle para proyectos de celular: la captura entera, sin recortar */
.detail-cover--celular { background-image: radial-gradient(ellipse 60% 60% at 50% 45%, #1a1a1a, var(--surface) 70%); } /* taste-skill-ignore: iluminación neutra */
.detail-cover--celular img { position: absolute; inset: 7% 0; margin: auto; width: auto; height: 86%; max-width: 90%; object-fit: contain; border-radius: clamp(1rem, 2.6vw, 1.75rem); box-shadow: 0 0 0 1px var(--line), 0 30px 80px -30px rgb(0 0 0 / 0.9); } /* taste-skill-ignore: marco del celular */
.gallery img { max-height: 80svh; object-fit: contain; margin-inline: auto; width: auto; }


/* ---------- Preferencias del sistema ---------- */
@media (prefers-reduced-transparency: reduce) {
  .site-header.is-scrolled, .folder-front, .dossier-inner, .folder-open { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .site-header.is-scrolled { background: rgb(8 8 8 / 0.98); }
  .folder-front { background: #121212; }
  .dossier-inner { background: #0d0d0d; }
}
@media (prefers-contrast: more) {
  :root { --line: #5a5a5a; --muted: #c4c4c4; }
}

/* Mientras Flip mueve hojas y capturas, las transiciones CSS no deben competir con él */
.explorer.is-flipping .sheet, .explorer.is-flipping .strip-frame, .explorer.is-flipping .folder-front { transition: none !important; }


/* ---------- Proyectos: composición en dos columnas cuando hay pocas carpetas ---------- */
@media (min-width: 64em) {
  .work[data-carpetas="1"]:not(.is-open),
  .work[data-carpetas="2"]:not(.is-open) {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap);
    align-items: center;
  }
  .work[data-carpetas="1"]:not(.is-open) > .work-head,
  .work[data-carpetas="2"]:not(.is-open) > .work-head { grid-column: 1 / 6; margin-bottom: 0; }
  .work[data-carpetas="1"]:not(.is-open) > .explorer { grid-column: 7 / 13; }
  .work[data-carpetas="2"]:not(.is-open) > .explorer { grid-column: 6 / 13; }
  .work[data-carpetas="1"] .folders[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Toque en móviles: sin destello gris, sin selección accidental en controles ---------- */
html { -webkit-tap-highlight-color: transparent; }
a, button, [role="button"] { touch-action: manipulation; }
button, .btn, .folder, .open-back, .dossier-close, .hero-index-item, .path-root {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
