/* Santiago Weinbinder, portfolio.
   Sistema visual: ver DESIGN.md (afiche editorial brutalista sobre papel cálido). */

:root {
  --ink: #191919;
  --bone: #efedea;
  --stone: #e3e1de;

  --bg: var(--bone);
  --fg: var(--ink);
  --surface: var(--stone);

  --font-sans: 'Geist', 'Neue Haas Grotesk Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-alt: 'Kumbh Sans', 'Geist', 'Helvetica Neue', Arial, sans-serif;

  --text-caption: 16px;
  --text-body: clamp(18px, 1.6vw, 21px);
  --text-sub: clamp(24px, 2.6vw, 34px);
  --text-heading: clamp(32px, 5vw, 69px);
  --text-display: clamp(52px, 13.2vw, 185px);

  --gutter: clamp(16px, 2.4vw, 32px);
  --section-gap: clamp(112px, 14vw, 200px);
  --max: 1400px;
  --edge: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --fg: var(--bone);
    --surface: #232322;
    color-scheme: dark;
  }
}

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

html {
  background: var(--bg);
  color: var(--fg);
  scroll-behavior: smooth;
  scrollbar-color: var(--fg) var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-caption);
  line-height: 1.2;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::selection { background: var(--fg); color: var(--bg); }

img { display: block; max-width: 100%; height: auto; }

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

:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

h1, h2, h3, p, figure, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 30;
  padding: 8px 12px; background: var(--fg); color: var(--bg);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Escala de capas: 10 menú, 20 navegación, 30 skip link, 39 y 40 cursor. */

/* ---------- Tipografía base ---------- */

.display {
  font-size: var(--text-display);
  line-height: 0.8;
  letter-spacing: -0.05em;
  font-weight: 400;
  text-transform: uppercase;
}

/* Cada renglón es una máscara para la entrada de texto. El padding deja lugar a tildes y a la Ñ. */
.line { display: block; overflow: hidden; padding-top: 0.14em; margin-top: -0.14em; }
.line > span { display: inline-block; }
/* Renglón con Ñ debajo de otro renglón: un poco más de aire para que la tilde no toque las letras de arriba. */
html:lang(es) .line-tilde { margin-top: -0.02em; }

.label { font-size: var(--text-caption); font-weight: 400; letter-spacing: -0.02em; }

.text-link {
  display: inline-block;
  padding-bottom: 2px;
  border-bottom: 1px solid currentColor;
  font-size: var(--text-caption);
  transition: border-bottom-width 0.2s var(--ease-out), padding-bottom 0.2s var(--ease-out);
}
.text-link:hover { border-bottom-width: 3px; padding-bottom: 0; }

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--section-gap) var(--gutter) 0;
}

/* ---------- Navegación ---------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px var(--edge);
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-caption);
  transition: transform 0.5s var(--ease-out);
}
.nav.is-hidden { transform: translateY(-100%); }
.nav.is-top { background: transparent; }
.menu-open .nav { background: transparent; color: var(--bg); transform: none; }
.nav-logo { font-weight: 700; letter-spacing: -0.03em; }
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { padding-bottom: 2px; border-bottom: 1px solid transparent; transition: border-color 0.2s var(--ease-out); }
.nav-links a:hover { border-color: currentColor; }

.nav-actions { display: flex; align-items: center; gap: 20px; }
.lang-toggle {
  padding: 4px 0 2px; border: 0; border-bottom: 1px solid currentColor; background: none; color: inherit;
  font: inherit; letter-spacing: 0.02em; cursor: pointer;
}
.lang-toggle:hover { border-bottom-width: 3px; padding-bottom: 0; }

.nav-toggle {
  display: none;
  padding: 4px 0; border: 0; background: none; color: inherit;
  font: inherit; letter-spacing: inherit; cursor: pointer;
}
.nav-toggle-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-close { display: inline; }

.menu {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: flex-end;
  padding: 96px var(--edge) 32px;
  background: var(--fg); color: var(--bg);
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition: clip-path 0.6s var(--ease-out), visibility 0s linear 0.6s;
}
.menu.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path 0.6s var(--ease-out), visibility 0s; }
.menu nav { display: flex; flex-direction: column; gap: 4px; }
.menu a {
  font-size: clamp(44px, 13vw, 96px);
  line-height: 0.9; letter-spacing: -0.05em; text-transform: uppercase;
}

@media (max-width: 767px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: clamp(32px, 5vw, 64px);
  padding: 96px var(--gutter) 32px;
  max-width: var(--max); margin: 0 auto;
}
.hero-title { text-align: center; }


.hero-foot {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
}
.hero-meta { max-width: 34ch; font-size: var(--text-caption); }
.hero .text-link { white-space: nowrap; }

@media (max-width: 767px) {
  .hero { gap: 40px; min-height: auto; padding-top: 160px; }
  .hero-title { font-size: 15vw; }
  .hero-foot { flex-direction: column; align-items: flex-start; }
}

.js-anim .hero-title { visibility: hidden; }

/* ---------- Perfil ---------- */

.profile { display: grid; gap: 48px; }
.profile-body .label { margin-bottom: 24px; }
.profile-body 
.profile-photo {
  width: min(72%, 420px);
  aspect-ratio: 473 / 517;
  overflow: hidden;
  background: var(--surface);
}
.profile-photo img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.8s var(--ease-out);
}
.profile-photo:hover img { filter: grayscale(0) contrast(1); }

@media (min-width: 900px) {
  .profile { grid-template-columns: repeat(12, 1fr); gap: 24px; align-items: start; }
  .profile-photo { grid-column: 1 / span 4; width: 100%; position: sticky; top: 96px; }
  .profile-body { grid-column: 6 / -1; }
}
.profile-lead {
  max-width: 20ch;
  font-size: var(--text-heading);
  line-height: 1;
  letter-spacing: -0.03em;
  text-wrap: pretty;
}
@media (min-width: 768px) { .profile-lead { max-width: 22ch; } }

.profile-cols {
  display: grid; gap: 32px;
  margin-top: clamp(56px, 8vw, 112px);
}
.profile-cols p { font-size: var(--text-caption); max-width: 36ch; }

@media (min-width: 768px) {
  .profile-cols { grid-template-columns: 5fr 4fr 5fr; gap: 24px; }
}

/* ---------- Sistemas (índice tipográfico, sin capturas) ---------- */

.systems .display { margin-bottom: 32px; }
.sys-intro { font-size: var(--text-body); max-width: 40ch; margin-bottom: clamp(48px, 7vw, 112px); }

.sys-item {
  display: grid; gap: 16px 24px;
  padding: 20px 0 clamp(32px, 4vw, 56px);
  border-top: 1px solid currentColor;
}
.sys-item:last-child { border-bottom: 1px solid currentColor; }
.sys-main { display: grid; gap: 12px; align-content: start; }
.sys-title { font-size: var(--text-sub); font-weight: 400; line-height: 1; letter-spacing: -0.015em; }
.sys-main p { max-width: 52ch; }
.sys-main .text-link { justify-self: start; }

.sys-meta { display: grid; gap: 6px; margin: 0; align-content: start; }
.sys-meta div { display: grid; grid-template-columns: 9ch 1fr; gap: 12px; }
.sys-meta dd { margin: 0; }

@media (min-width: 900px) {
  .sys-item { grid-template-columns: repeat(12, 1fr); }
  .sys-num { grid-column: 1 / span 1; }
  .sys-main { grid-column: 2 / span 6; }
  .sys-meta { grid-column: 9 / -1; }
}

/* ---------- Sitios ---------- */

.work .display { margin-bottom: clamp(48px, 7vw, 112px); }
.count {
  font-size: 0.16em; letter-spacing: -0.02em;
  vertical-align: top; position: relative; top: 0.5em; margin-left: 0.2em;
}

.work-grid { display: grid; gap: 64px 24px; }

.work-item { display: block; }
.work-media { overflow: hidden; background: var(--surface); aspect-ratio: 2 / 1; }
.work-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: top;
  transition: transform 0.9s var(--ease-out);
}
.work-item:hover .work-media img { transform: scale(1.03); }

.work-meta { display: grid; gap: 8px; padding-top: 20px; }
.work-title { font-size: var(--text-sub); font-weight: 400; letter-spacing: -0.015em; line-height: 1; }
.work-title-lg { font-size: var(--text-heading); letter-spacing: -0.03em; }
.work-meta p { max-width: 44ch; }
.work-title { justify-self: start; padding-bottom: 2px; border-bottom: 1px solid transparent; transition: border-color 0.2s var(--ease-out); }
.work-item:hover .work-title { border-color: currentColor; }
.work-tag { margin-top: 4px; }

@media (min-width: 768px) {
  .work-grid { grid-template-columns: repeat(12, 1fr); row-gap: 112px; }
  .w-a { grid-column: 1 / span 7; }
  .w-b { grid-column: 9 / span 4; margin-top: 200px; }
  .w-c { grid-column: 1 / -1; }
  .w-d { grid-column: 2 / span 5; }
  .w-e { grid-column: 7 / span 6; margin-top: 160px; }
  .w-f { grid-column: 3 / span 8; }
}

/* ---------- Herramientas ---------- */

.tools { padding-left: 0; padding-right: 0; max-width: none; }
.tools-label, .tools-note { padding: 0 var(--edge); }
.tools-label { margin-bottom: 24px; }
.tools-note { margin-top: 24px; text-align: right; }

.marquee { overflow: hidden; border-block: 1px solid currentColor; padding: 24px 0 20px; }
.marquee-track {
  display: flex; width: max-content;
  font-family: var(--font-alt);
  font-size: clamp(48px, 9vw, 128px);
  line-height: 0.8; letter-spacing: -0.05em;
  animation: marquee 48s linear infinite;
}
.marquee-group { display: flex; }
.marquee-track span { padding-right: 0.5em; }
.marquee-track span::after { content: "/"; padding-left: 0.5em; }
.marquee:hover .marquee-track { animation-play-state: paused; }

@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Formación (superficie invertida) ---------- */

.invert { background: var(--fg); color: var(--bg); }
.invert ::selection { background: var(--bg); color: var(--fg); }

.education {
  margin-top: var(--section-gap);
  padding: clamp(80px, 10vw, 160px) var(--edge);
}
.education .display { margin-bottom: clamp(48px, 7vw, 112px); }

.edu-list { display: grid; gap: 48px; }
.edu-item { display: grid; gap: 8px; align-content: start; padding-top: 20px; border-top: 1px solid currentColor; }
.edu-item h3 { font-size: var(--text-sub); font-weight: 400; line-height: 1; letter-spacing: -0.015em; max-width: 20ch; }
.edu-item p { max-width: 40ch; }
.edu-item .text-link { justify-self: start; margin-top: 8px; }
.edu-links { display: flex; flex-wrap: wrap; gap: 0 20px; }

@media (min-width: 768px) {
  .edu-list { grid-template-columns: 1fr 1fr; gap: 80px 24px; }
}
/* 8 ítems: el primero ocupa 2 columnas y los 7 restantes completan 3 filas exactas. */
@media (min-width: 1100px) {
  .edu-list { grid-template-columns: repeat(3, 1fr); }
  .edu-item:first-child { grid-column: span 2; }
  .edu-item:first-child h3 { font-size: var(--text-heading); letter-spacing: -0.03em; max-width: 18ch; }
}

/* ---------- Contacto ---------- */

.contact { padding-bottom: var(--section-gap); }
.contact .display { margin-bottom: 32px; }
.contact-intro { font-size: var(--text-body); max-width: 40ch; margin-bottom: 32px; }
.contact-mail {
  display: inline-block;
  font-size: var(--text-heading); line-height: 1; letter-spacing: -0.04em;
  padding-bottom: 4px; border-bottom: 2px solid currentColor;
  overflow-wrap: anywhere;
}
.contact-mail:hover { border-bottom-width: 6px; padding-bottom: 0; }
.contact-links { display: flex; gap: 24px; margin-top: 48px; }

.footer {
  width: calc(100% - 2 * var(--edge)); margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 24px 0 32px;
  border-top: 1px solid currentColor;
}

/* ---------- Scroll suave (Lenis) ---------- */

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Cursor ---------- */

.has-cursor, .has-cursor * { cursor: none !important; }

.cursor {
  position: fixed; top: 0; left: 0; z-index: 40;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bone);
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  will-change: transform;
}
.cursor.is-visible { opacity: 1; }

.cursor-trail {
  position: fixed; inset: 0; z-index: 39;
  width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: difference;
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .marquee-track { animation: none; width: auto; padding: 0 var(--edge); line-height: 1; }
  .marquee-group { flex-wrap: wrap; row-gap: 0.1em; }
  .marquee-group + .marquee-group { display: none; }
}
