/* ============================================================
   Mariano Lampacrescia — Portfolio v2
   Two-panel layout: sticky 4-col left panel + scrolling 8-col right panel.
   Design tokens read straight off "Portfolio Nuevo" (Figma).
   Breakpoint: >=1000px two panels / <1000px single column.
   This file is self-contained: it does NOT touch css/styles.css.
   ============================================================ */

/* ---- Self-hosted variable fonts, shared with v1 (latin subset, 88 KB) ---- */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/geist-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../assets/fonts/geist-mono-latin-wght-normal.woff2') format('woff2');
}

:root {
  /* colour */
  --bg: #F9F8F4;            /* Blanco Tiza */
  --ink: #221A1A;           /* NegroMarron */
  --body: #000000;          /* the small copy in the left panel is pure black */
  --gray-22: #A19E9A;       /* Gris 22 — labels mono, nombre de proyecto, labels de About */
  --gray-1: #767676;        /* Grey 1 — secondary footer / card meta */
  --line: #E9E8E8;          /* Gris 2 — reglas y divider vertical */
  --muted-title: var(--gray-22);      /* nombre del proyecto, columna izquierda */

  /* dark theme (Logos) */
  --dark-bg: #151212;
  --dark-ink: #F9F8F4;
  --dark-body: #F9F8F4;
  --dark-line: rgba(249, 248, 244, .14);
  --dark-muted-title: rgba(249, 248, 244, .4);

  /* theme-aware aliases — redefined by .theme-dark */
  --page-bg: var(--bg);
  --page-ink: var(--ink);
  --page-body: var(--body);
  --page-line: var(--line);
  --page-muted-title: var(--muted-title);

  /* type */
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* grid — 12 columns, 12px gutter, 12px page margin (Figma: 1488 inside 1512) */
  --margin: 12px;
  --gutter: 12px;
  --nav-h: 42px;
  --radius-img: 12px;
  --radius-card: 16px;
  --bp: 1000px;
}

.theme-dark {
  --page-bg: var(--dark-bg);
  --page-ink: var(--dark-ink);
  --page-body: var(--dark-body);
  --page-line: var(--dark-line);
  --page-muted-title: var(--dark-muted-title);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--page-ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.menu-open { overflow: hidden; }

img {
  max-width: 100%;
  display: block;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}
a { color: inherit; text-decoration: none; }

/* Links that keep the rule hidden until you are on them: the left panel's
   publications, the web addresses inside a project description, and the
   footer. About is the exception — see .copy-link. */
.copy a,
.project-body a,
.foot-link {
  text-decoration: none;
  transition: opacity .2s ease;
}
.copy a:hover,
.project-body a:hover,
.foot-link:hover {
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: auto;
}

/* About keeps its links underlined at rest */
.copy-link a {
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: auto;
  transition: opacity .2s ease;
}
.copy-link a:hover { opacity: .55; }

/* ============================================================
   NAV — fixed, never hides. The links are painted white and
   blended with `difference`, so they read as the inverse of
   whatever image or colour happens to be underneath.
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin);
  pointer-events: none;             /* the bar itself never eats clicks */
  mix-blend-mode: difference;
  isolation: auto;
}
/* the menu panel must NOT invert — it is a solid sheet, so the bar
   drops the blend and paints its ink colour directly */
body.menu-open .nav { mix-blend-mode: normal; background: var(--page-bg); }
body.menu-open .nav-link { color: var(--page-ink); }

.nav-link {
  pointer-events: auto;
  display: block;
  font-weight: 500;                  /* Geist Medium 18 / 1 — la barra mide 12+18+12 = 42 */
  font-size: 18px;
  line-height: 1;
  color: #FFFFFF;                    /* inverted by mix-blend-mode */
  white-space: nowrap;
  transition: opacity .2s ease;
}
.nav-link:hover { opacity: .6; }

.nav-name { padding: 12px 24px 12px 0; }
.nav-links { display: flex; align-items: center; }
.nav-links .nav-link { padding: 12px 16px; }
.nav-links .nav-link:last-child { padding-right: 0; }

/* current page: quietly dimmed rather than underlined, so the blend stays clean */
.nav-link[aria-current="page"] { opacity: .45; }

/* ---- Mobile menu button (same component as v1, tighter side padding) ---- */
.menu-btn {
  display: none;
  pointer-events: auto;
  background: none;
  border: 0;
  padding: 5px;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-icon {
  width: 32px; height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.menu-icon span {
  display: block;
  width: 20px; height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.close-icon { width: 32px; height: 32px; display: none; }
body.menu-open .menu-icon { display: none; }
body.menu-open .close-icon { display: block; }
body.menu-open .menu-btn { color: var(--page-ink); }

.mobile-menu {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; bottom: 0;
  background: var(--page-bg);
  z-index: 55;
  overflow-y: auto;
}
.menu-divider {
  border: 0;
  width: calc(100% - 24px);
  margin: 0 12px;
  height: 1.5px;
  background: var(--page-line);
}
.mobile-menu-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 40px 12px 48px;
}
.mobile-menu-link {
  font-weight: 300;                  /* Geist Light 48 / 1.2 */
  font-size: 48px;
  line-height: 1.2;
  color: var(--page-ink);
  white-space: nowrap;
  transition: opacity .2s ease;
}
.mobile-menu-link:hover,
.mobile-menu-link:active { opacity: .55; }

/* ============================================================
   PAGE SHELL
   .page is the positioning context for the vertical divider, and
   it holds BOTH the two-panel grid and the footer as siblings —
   that is what lets one uncut rule run from the nav to the floor.
   Nothing in this chain may clip: no overflow other than visible.
   ============================================================ */
.page {
  position: relative;
  padding: var(--nav-h) var(--margin) 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* One continuous 1px rule, one gutter past the end of column 4.
   x = page margin + 4 columns + 3 gutters + 1 gutter
     = 12 + 4·(W−24−132)/12 + 36 + 12  →  calc(60px + (100% − 156px)/3)
   (100% resolves against .page's padding box = the viewport width) */
.rule-v {
  position: absolute;
  top: 12px;
  bottom: 0;
  left: calc(60px + (100% - 156px) / 3);
  width: 1px;
  background: var(--page-line);
  pointer-events: none;
}
/* About has no left panel, so its rule is just the stub under the nav */
.rule-v.is-stub { bottom: auto; height: 24px; }

.layout {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
  align-items: start;
  flex: 1 0 auto;
}

/* ---- Left panel: sticky, full viewport height, content pushed apart ---- */
.panel-left {
  grid-column: 1 / 5;
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  height: auto;                      /* sin los tags al piso, el panel mide
                                        lo que mide su contenido y por eso
                                        nunca se despega al final de la página */
  padding: 80px 24px 0 0;            /* 488 − 24 = 464, el ancho del Figma */
}

.panel-right {
  grid-column: 5 / 13;
  min-width: 0;
  /* el contenido empieza un gutter después del divider: 524 → 1500 = 976 */
  padding: 80px 0 0 12px;
}

/* ============================================================
   LEFT PANEL CONTENT
   ============================================================ */
/* Geist Medium 26 / 30 at 1512, scaling down with the column so the
   email never runs past the rule on a small laptop */
.lede {
  font-weight: 500;
  /* tracks the column so the email address always fits on one line:
     column = (100vw − 156px)/3 − 16 ; the address needs ≈16 em of it */
  font-size: clamp(15px, calc(2.09vw - 4.3px), 26px);
  line-height: 1.1;
  color: var(--page-ink);
  overflow-wrap: anywhere;
}

/* en el frame mobile la regla va debajo del showreel, no debajo del intro */
.rule-after-reel { display: none; }

.rule-h {
  border: 0;
  width: 100%;
  height: 1px;
  background: var(--page-ink);   /* NegroMarrón, no el gris de las otras reglas */
  margin: 30px 0;
}

.info-set {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.info-cols {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.info-cols .info-block:first-child { flex: 1 1 255px; min-width: 0; }
.info-cols .info-block:last-child  { flex: 1 1 189px; min-width: 0; }

.info-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.label {
  font-family: var(--mono);          /* Geist Mono Medium 12 / 1.2 */
  font-weight: 500;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--gray-22);
}
.copy {
  font-size: 14px;                   /* Geist Medium 14 / 1.2 */
  font-weight: 500;
  line-height: 1.2;
  color: var(--page-body);
}
.copy p + p { margin-top: 1.2em; }
.copy p.tight + p.tight { margin-top: 0; }


/* ============================================================
   RIGHT PANEL — showreel, projects
   ============================================================ */
.reel {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius-img);
  background: rgba(0, 0, 0, .04);
}
.reel img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .81s ease;
}
.reel img.active { opacity: 1; }

.project { padding-top: 120px; }
.project:first-child { padding-top: 0; }
#project-doceo { padding-top: 120px; }
.project { scroll-margin-top: 72px; }

.project-head {
  display: flex;
  gap: var(--gutter);
  align-items: flex-start;
  padding-bottom: 40px;
}
.project-name {
  flex: 1 1 0;
  min-width: 0;
  padding-right: 25px;
  font-weight: 400;                  /* Geist 18 / 19.66 — Medium cuando es link */
  font-size: 18px;
  line-height: 1.092;
  color: var(--page-muted-title);
  transition: opacity .2s ease;
}
a.project-name { font-weight: 500; }
a.project-name:hover { opacity: .7; }
.project-body {
  flex: 1 1 0;
  min-width: 0;
  font-size: clamp(17px, 1.59vw, 24px);   /* Geist Regular 24 / 1.0 */
  font-weight: 400;
  line-height: 1.05;
  color: var(--page-ink);
}
.project-body p + p { margin-top: 1em; }

/* ---- Media stack: every frame is full width unless it is a half ---- */
.media { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-img);
  background: rgba(0, 0, 0, .04);
}
.frame img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.media-pair { display: flex; gap: 12px; }
.media-pair .frame { flex: 1 1 0; min-width: 0; }

.coming-soon {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 3;
  min-width: 96px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(240, 240, 239, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
  text-align: center;
  color: #221A1A;
  pointer-events: none;
}

/* transparent shield: blocks the Pinterest button and the long-press menu */
.img-shield { position: absolute; inset: 0; z-index: 2; background: transparent; }

/* ============================================================
   PAGE TITLE (Logos, Archive)
   ============================================================ */
.section-title {
  font-weight: 500;                  /* Geist Medium 26 / 30 */
  font-size: clamp(20px, 1.72vw, 26px);
  line-height: 1.155;
  color: var(--page-ink);
  margin-bottom: 40px;
}

/* ---- Logos grid: two large cards per row ---- */
.logos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 12px;
}
.logo-card { display: flex; flex-direction: column; gap: 8px; }
.logo-figure {
  position: relative;
  aspect-ratio: 277 / 216;
  border-radius: var(--radius-card);
  overflow: hidden;
}
.logo-figure img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
}
.logo-figure.is-empty {
  border: 1px dashed var(--page-line);
}
.logo-figure.is-empty img { display: none; }
.logo-text { display: flex; flex-direction: column; gap: 4px; }
.logo-name {
  font-size: 15px;                   /* Text 3 — Geist Regular 15 / 1.3 */
  line-height: 1.3;
  color: var(--page-ink);
}
.logo-meta {
  font-size: 14px;                   /* Geist Regular 14 / 1.4 */
  line-height: 1.4;
  color: var(--gray-1);
}
.logo-meta p { margin: 0; }

/* ---- Archive: two-column masonry, built in js/v2.js ---- */
/* Masonry de dos columnas en orden alternado (1 izq, 2 der, 3 izq…).
   El reparto lo hace js/v2.js una sola vez y al cruzar el breakpoint
   MUEVE los nodos entre columnas — nunca los recrea. Al quedar una sola
   columna, la otra se vacía y desaparece sola. */
.archive-grid {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
}
.archive-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.archive-col:empty { display: none; }

/* ============================================================
   ABOUT — full-width rows, label in columns 1–4
   ============================================================ */
.about {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 80px 0 80px;
  flex: 1 0 auto;
}
.about-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
  align-items: start;
}
.about-label {
  grid-column: 1 / 5;
  font-weight: 500;                  /* Geist Medium 26 / 30, Gris 22 — fijo:
                                        no escala con el ancho, solo cambia
                                        al pasar al layout mobile */
  font-size: 26px;
  line-height: 30px;
  color: var(--gray-22);
}
.about-content {
  grid-column: 5 / 13;
  display: flex;
  gap: clamp(32px, 5.3vw, 80px);
  align-items: flex-start;
  padding-right: clamp(0px, 7.9vw, 120px);
  font-size: 16px;                   /* Text 2 — Geist Regular 16 / 1.3 */
  line-height: 1.3;
  color: var(--page-ink);
}
.about-content > .copy-16 { flex: 1 1 0; min-width: 0; }
.copy-16 { font-size: 16px; line-height: 1.3; }
.copy-16 p + p { margin-top: 1.3em; }
.about-portrait {
  position: relative;
  flex: 0 0 200px;
  width: 200px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-img);
  overflow: hidden;
}
.about-portrait img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

/* ============================================================
   FOOTER — sibling of the grid, so the vertical rule runs through it
   ============================================================ */
.site-footer {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gutter);
  align-items: end;
  padding: 12px 0;
  flex: 0 0 auto;
}
.footer-left {
  grid-column: 1 / 5;
  display: flex;
  align-items: flex-end;
  padding: 24px 40px 0 0;
}
.footer-left > div { flex: 1 1 0; min-width: 0; }
.footer-right {
  grid-column: 5 / 13;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}
.foot-link {
  display: block;
  font-weight: 500;                  /* Geist Medium 14 / 1.4 */
  font-size: 14px;
  line-height: 1.4;
  color: var(--page-ink);
  white-space: nowrap;
  transition: opacity .2s ease;
}
.foot-link:hover { opacity: .55; }
.foot-note {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.4;
  color: var(--gray-22);
  white-space: nowrap;
}
.copyright {
  font-weight: 500;
  font-size: 14px;
  line-height: 1.1;
  color: var(--page-ink);
  white-space: nowrap;
}
.footer-logo {
  width: 36.3px; height: 23.3px;
  display: block;
  color: var(--page-ink);
  flex-shrink: 0;
}
.footer-logo path { fill: currentColor; }
.footer-rule { display: none; }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.1s cubic-bezier(.22, 1, .36, 1), transform 1.1s cubic-bezier(.22, 1, .36, 1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .reel img { transition: none; }
}

/* ---- Between the tablet breakpoint and a comfortable laptop the two
        small columns in the left panel stop fitting side by side ---- */
@media (max-width: 1279px) {
  .info-cols { flex-direction: column; gap: 48px; }
  /* apilados, el flex-basis del desktop se convierte en alto y deja un hueco
     enorme entre las dos cajas: hay que soltarlo. Los selectores repiten
     :first-child / :last-child para igualar la especificidad de las reglas
     de arriba — si no, pierden y el basis sigue mandando. */
  .info-cols .info-block:first-child,
  .info-cols .info-block:last-child { flex: 0 0 auto; width: 100%; }
}

/* ============================================================
   TABLET / MOBILE  ( < 1000px )
   One column: the panels stack, nothing sticks, no vertical rule.
   ============================================================ */
@media (max-width: 999px) {
  /* la barra mobile del Figma mide 48, no 42 como la de desktop */
  :root { --nav-h: 48px; }

  .nav-links { display: none; }
  .menu-btn { display: flex; }
  .nav-name { padding: 12px 0; }

  .rule-v { display: none; }

  .layout { display: block; }

  .panel-left {
    position: static;
    height: auto;
    display: block;
    padding: 40px 0;
  }
  .panel-right { padding: 0; }

  .lede { font-size: 20px; line-height: 1.1; }

  /* la regla del panel se apaga y reaparece debajo del showreel:
     20 del bloque del divider arriba, 20 + 40 de aire abajo */
  .panel-top .rule-h { display: none; }
  .rule-after-reel { display: block; margin: 20px 0 60px; background: var(--page-line); }

  /* el showreel es más panorámico en el frame mobile */
  .reel { aspect-ratio: 351 / 220; }

  /* On a phone the left panel narrows to its opening line: the mobile frame
     leads with the work, and Information / Publications / Services already
     live on About. Delete these two rules to bring the full panel back. */
  .info-set { display: none; }

  .project { padding-top: 80px; }
  /* el aire sobre el primer proyecto ya lo da la regla de arriba */
  #project-doceo { padding-top: 0; }
  .project-head { flex-direction: column; gap: 24px; padding-bottom: 20px; }
  .project-name { padding-right: 0; flex: 0 0 auto; font-size: 22px; }
  .project-body { font-size: 22px; line-height: 1.05; }

  .media-pair { flex-direction: column; }

  .section-title { margin-bottom: 40px; }

  /* la grilla de logos baja a una sola columna (la de Archive la arma el JS) */
  .logos-grid { grid-template-columns: minmax(0, 1fr); }

  .about { padding: 40px 0 80px; gap: 32px; }
  .about-row { display: block; }
  .about-label { margin-bottom: 12px; font-size: 22px; line-height: 26px; }
  .about-content { display: block; padding-right: 0; }
  .about-portrait { width: 160px; flex: none; margin-top: 24px; }

  /* ---- Footer mobile (frame de Figma): regla de 80 de bloque, después
          contacto · redes · copyright, separados por 40 ---- */
  .site-footer { display: block; padding: 0 0 20px; }
  .footer-rule {
    display: block;
    border: 0;
    width: 100%;
    height: 1.5px;
    background: var(--page-line);
    margin: 40px 0;
  }
  /* en columna, align-items pasa a controlar el eje horizontal: hay que
     soltar el flex-end que usa el desktop o todo se va a la derecha */
  .footer-left { display: flex; flex-direction: column; align-items: flex-start; gap: 40px; padding: 0; }
  .footer-contact { order: -1; }
  .footer-right {
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
  }
  /* redes: Geist Medium 18 / 1.1 con 8 de aire arriba y abajo */
  .foot-link { padding: 8px 0; font-size: 18px; line-height: 1.1; }
  /* contacto: las dos líneas en 18 / 1.4, el rótulo en Gris 22 */
  .footer-contact .foot-link { padding: 0; font-size: 18px; line-height: 1.4; }
  .foot-note { font-size: 18px; line-height: 1.4; }
  .copyright { font-size: 12px; line-height: 1.1; color: var(--page-ink); }
}
