/* ============================================================
   JOTERMAN · hoja de estilo NEXUS en blanco
   Papel blanco, tinta, cian de la casa, Courier y marcas de registro.
   ============================================================ */

/* Courier Prime: una Courier más firme y legible (SIL Open Font License, ver fonts/) */
@font-face {
  font-family: 'Courier Prime'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/courier-prime-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Courier Prime'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/courier-prime-latin-700-normal.woff2) format('woff2');
}

:root {
  --paper:  #ffffff;
  --wash:   #f3f6f9;               /* fondo de marcos e imágenes */
  --ink:    #0b1219;               /* tinta */
  --cyan:   #04566f;               /* cian de la casa */
  --sky:    #a2d2ff;               /* azul NEXUS, solo como segunda tinta */
  --grey:   #262f39;
  --dim:    #4a5461;
  --rule:   #e1e7ed;               /* filetes */
  --frame:  rgba(11,18,25,.9);
  --verm:   #e4502f;
  --mono:   'Courier Prime', 'Courier New', Courier, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --reg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='%2304566f' stroke-width='1'%3E%3Ccircle cx='10' cy='10' r='5'/%3E%3Cpath d='M10 0v20M0 10h20'/%3E%3C/g%3E%3C/svg%3E");
  /* doble pasada desajustada, como un registro de imprenta */
  --misreg: 4px 3px 0 var(--sky);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--sky); color: var(--ink); }

:focus-visible { outline: 1px solid var(--cyan); outline-offset: 4px; }

.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 {
  position: fixed; left: 12px; top: -60px; z-index: 500;
  background: var(--cyan); color: #fff; padding: 8px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- barra de genoma (2 px, como en NEXUS GENESIS) ---------- */
#genome-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 210;
  background: linear-gradient(90deg, #2f7fc1, #6c56c9, #239a74, #d99a16, #d2557f);
  pointer-events: none;
}

/* ---------- HUD superior ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px;
  padding: clamp(12px, 2.4vh, 22px) var(--gutter) 26px;
  background: linear-gradient(to bottom, rgba(255,255,255,.97) 0%, rgba(255,255,255,.85) 65%, rgba(255,255,255,0) 100%);
}
.hud .brand {
  color: var(--cyan); text-decoration: none; font-weight: bold;
  font-size: 14px; letter-spacing: 6px;
}
.hud nav ul { display: flex; gap: clamp(14px, 2.4vw, 30px); list-style: none; }
.hud nav a {
  text-decoration: none; font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--grey); transition: color .2s;
}
.hud nav a:hover, .hud nav a[aria-current] { color: var(--cyan); }

@media (max-width: 900px) {
  .hud { flex-direction: column; gap: 6px; padding-bottom: 18px; }
  .hud nav ul { flex-wrap: wrap; gap: 4px 16px; }
  .hud nav a { font-size: 11px; letter-spacing: 1.5px; }
  html { scroll-padding-top: 118px; }
}

/* ---------- portada ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: clamp(18px, 3.2vh, 34px);
  padding: 110px var(--gutter) 48px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.7rem, 5vw, 3.4rem);
  font-weight: 400; line-height: 1;
  letter-spacing: clamp(6px, 1.6vw, 18px);
  margin-right: calc(-1 * clamp(6px, 1.6vw, 18px)); /* compensa el tracking final */
  color: var(--cyan); text-shadow: var(--misreg);
}
.nw { white-space: nowrap; }
.hero .intro {
  max-width: 46ch; color: var(--ink); font-size: clamp(15px, 1.7vw, 19px); line-height: 1.6;
}

.stage { width: min(calc(62vh * 3), 100%); }
.stage-frame {
  position: relative; aspect-ratio: 3 / 1;
  border: 1px solid var(--frame);
  cursor: crosshair; touch-action: manipulation; background: var(--paper);
}
.stage-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-readout {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 12px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--grey);
}
.stage-readout span { white-space: nowrap; }
.stage-readout b { color: var(--cyan); font-weight: bold; }
.stage-hint { margin-top: 6px; font-size: 12px; color: var(--dim); letter-spacing: 1px; }

@media (max-width: 760px) {
  .stage-frame { aspect-ratio: 4 / 3; }
  .stage-readout { justify-content: center; }
}

/* marcas de registro en las esquinas de cualquier marco */
.reg { position: relative; }
.reg::before {
  content: ""; position: absolute; inset: -9px; pointer-events: none; z-index: 2;
  background:
    var(--reg) 0 0 / 17px no-repeat,
    var(--reg) 100% 0 / 17px no-repeat,
    var(--reg) 0 100% / 17px no-repeat,
    var(--reg) 100% 100% / 17px no-repeat;
  opacity: .7;
}

/* ---------- secciones ---------- */
main { display: block; }
.section {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: clamp(72px, 11vh, 140px) var(--gutter) 0;
}
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  border-bottom: 1px solid var(--ink); padding-bottom: 12px; margin-bottom: 32px;
  flex-wrap: wrap; row-gap: 4px;
}
.section-head h2 {
  font-size: clamp(17px, 2.2vw, 22px); font-weight: bold;
  letter-spacing: .32em; text-transform: uppercase; color: var(--cyan);
}
.section-head .count { font-size: 13px; color: var(--dim); letter-spacing: 2px; white-space: nowrap; }

.prose { max-width: 64ch; }
.prose p + p { margin-top: 1em; }
.prose a { color: var(--cyan); text-underline-offset: 3px; }
.prose strong { color: var(--cyan); }

.family { margin-top: clamp(56px, 8vh, 96px); }
.family h3 {
  font-size: 15px; font-weight: bold; letter-spacing: 3px; text-transform: uppercase;
  display: flex; align-items: center; gap: 14px; margin-bottom: 8px;
}
.family h3::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.family > p { color: var(--grey); max-width: 64ch; margin-bottom: 36px; font-size: 16px; }

/* ---------- apps (fichas) ---------- */
.apps {
  display: grid; gap: 56px 36px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  list-style: none;
}
.app { display: flex; flex-direction: column; height: 100%; }
.app .frame { border: 1px solid var(--rule); background: var(--wash); aspect-ratio: 4 / 3; }
.app .frame img { width: 100%; height: 100%; object-fit: cover; }
.app h4 {
  margin-top: 18px; color: var(--cyan); font-size: 15px; font-weight: bold;
  letter-spacing: 3px; text-transform: uppercase;
}
.app p { font-size: 16px; margin-top: 8px; color: var(--ink); line-height: 1.6; }
.app p + p { color: var(--grey); }
.app p b { color: var(--cyan); }

.app .dosier { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.app .dosier-t { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; }
.dosier-grid { list-style: none; display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.dosier-grid.n4 { grid-template-columns: repeat(4, 1fr); }
.dosier-grid a { display: block; aspect-ratio: 1; border: 1px solid var(--rule); background: var(--wash); overflow: hidden; transition: border-color .2s; }
.dosier-grid img { width: 100%; height: 100%; object-fit: cover; }
.dosier-grid a:hover { border-color: var(--frame); }

/* ---------- proyectos de fotografía (portada) ---------- */
.project {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px);
  align-items: center; padding: 40px 0;
}
.project + .project { border-top: 1px solid var(--rule); }
.project h3 {
  font-size: clamp(26px, 3.4vw, 40px); font-weight: 400; letter-spacing: .3em;
  color: var(--cyan); text-shadow: 3px 2px 0 var(--sky); line-height: 1.1;
}
.project .since { font-size: 13px; color: var(--dim); letter-spacing: 2px; margin: 10px 0 18px; }
.project p { max-width: 52ch; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.strip a { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--rule); background: var(--wash); }
.strip img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.strip a:hover img { opacity: .85; }
@media (max-width: 820px) { .project { grid-template-columns: 1fr; } }

.btn, .project .more {
  display: inline-block; margin-top: 24px; font-size: 13px; letter-spacing: 3px;
  text-transform: uppercase; text-decoration: none; color: var(--cyan);
  border: 1px solid var(--cyan); padding: 10px 18px; transition: background .2s, color .2s;
}
.btn:hover, .project .more:hover { background: var(--cyan); color: #fff; }

/* ---------- hoja de contactos (galerías) ---------- */
.contact-sheet {
  display: grid; gap: 28px 18px; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
}
.contact-sheet.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.contact-sheet a { display: block; text-decoration: none; }
.contact-sheet .ph {
  aspect-ratio: 1; background: var(--wash); border: 1px solid var(--rule);
  overflow: hidden; transition: border-color .25s;
}
.contact-sheet.wide .ph { aspect-ratio: 4 / 3; }
.contact-sheet .ph img { width: 100%; height: 100%; object-fit: cover; }
.contact-sheet .ph.fit img { object-fit: contain; background: #fff; }
.contact-sheet a:hover .ph { border-color: var(--frame); }
.contact-sheet .cap {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12px; letter-spacing: 1px; color: var(--dim); margin-top: 8px;
}
.contact-sheet .cap b { color: var(--cyan); font-weight: bold; }

/* ---------- páginas de proyecto ---------- */
.page-head { padding: clamp(130px, 20vh, 200px) var(--gutter) 0; max-width: 1240px; margin: 0 auto; }
.page-head h1 {
  font-size: clamp(2.2rem, 8vw, 5.4rem); font-weight: 400; line-height: 1;
  letter-spacing: clamp(6px, 2vw, 22px); color: var(--cyan); text-shadow: var(--misreg);
}
.page-head .since { margin-top: 18px; color: var(--dim); font-size: 14px; letter-spacing: 3px; }
.page-head .prose { margin-top: 40px; font-size: clamp(16px, 1.5vw, 18px); }

.how { display: grid; gap: 22px 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); max-width: 1000px; }
.how div { border-left: 2px solid var(--sky); padding-left: 18px; }
.how dt { color: var(--cyan); font-weight: bold; letter-spacing: 2px; font-size: 14px; text-transform: uppercase; }
.how dd { color: var(--grey); font-size: 15px; margin-top: 4px; }

.kit-title { color: var(--dim); font-size: 13px; font-weight: normal; letter-spacing: 3px; text-transform: uppercase; }
.kit { list-style: none; margin-top: 14px; max-width: 64ch; }
.kit li { padding: 8px 0 8px 28px; border-bottom: 1px solid var(--rule); position: relative; font-size: 15px; }
.kit li::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: var(--reg) center / 14px no-repeat;
}

.next-project {
  max-width: 1240px; margin: clamp(80px, 12vh, 140px) auto 0; padding: 0 var(--gutter);
}
.next-project a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  padding: 28px 0; text-decoration: none;
}
.next-project small { color: var(--dim); font-size: 13px; letter-spacing: 2px; }
.next-project strong {
  font-weight: 400; font-size: clamp(24px, 4vw, 42px); letter-spacing: .3em; color: var(--cyan);
  transition: text-shadow .25s;
}
.next-project a:hover strong { text-shadow: 3px 2px 0 var(--sky); }

/* ---------- sobre mí ---------- */
.about { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 88px); }
@media (max-width: 880px) { .about { grid-template-columns: 1fr; } }
.timeline { list-style: none; border-top: 1px solid var(--ink); }
.timeline li { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.timeline time { color: var(--cyan); font-weight: bold; }

/* ---------- green code y bio ---------- */
.how.green { max-width: none; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); margin-top: 8px; }
.green-note { margin-top: 32px; font-size: 14px; color: var(--grey); max-width: 70ch; border-top: 1px solid var(--rule); padding-top: 16px; }
.bio { max-width: 70ch; }
.bio-name { font-size: 15px; letter-spacing: 3px; color: var(--cyan); margin-bottom: 18px; }
.bio-name span { color: var(--dim); font-weight: normal; letter-spacing: 1px; }

/* ---------- talleres ---------- */
.workshops { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
@media (max-width: 880px) { .workshops { grid-template-columns: 1fr; } }
.workshops figure { max-width: 380px; }
.workshops figure img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--rule); }
.workshops figcaption { font-size: 12px; color: var(--dim); margin-top: 8px; letter-spacing: 1px; }

/* ---------- contacto ---------- */
.contact .mail {
  display: inline-block; margin-top: 18px; text-decoration: none; color: var(--cyan);
  font-size: clamp(19px, 4.4vw, 46px); letter-spacing: .04em; word-break: break-all;
  border-bottom: 1px solid var(--rule); transition: text-shadow .2s, border-color .2s;
}
.contact .mail:hover { text-shadow: 3px 2px 0 var(--sky); border-color: var(--cyan); }

/* ---------- pie (HUD inferior) ---------- */
.foot {
  margin-top: clamp(96px, 14vh, 160px);
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 28px;
  padding: 26px var(--gutter) 28px;
  border-top: 1px solid var(--ink);
  font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--dim);
}
.foot .mark { color: var(--cyan); }
.foot a { text-decoration: none; text-transform: none; letter-spacing: 1px; }
.foot a:hover { color: var(--cyan); }

/* ---------- visor de imágenes ---------- */
.lightbox {
  border: 0; padding: 0; margin: 0; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100dvh; background: rgba(255,255,255,.98); color: var(--ink);
}
.lightbox::backdrop { background: rgba(255,255,255,.9); }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 64px 64px 12px; min-height: 0; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border: 1px solid var(--rule); background: var(--wash); }
.lb-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 24px 22px; font-size: 13px; letter-spacing: 2px;
}
.lb-bar .lb-n { color: var(--cyan); white-space: nowrap; }
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: #fff; border: 1px solid var(--rule); color: var(--cyan);
  width: 44px; height: 44px; font: 20px var(--mono); cursor: pointer;
}
.lb-btn:hover { border-color: var(--cyan); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-close {
  position: absolute; top: 14px; right: 14px; background: #fff; border: 1px solid var(--rule);
  color: var(--ink); font: 12px var(--mono); letter-spacing: 3px; padding: 10px 14px; cursor: pointer;
}
.lb-close:hover { border-color: var(--cyan); color: var(--cyan); }
@media (max-width: 640px) {
  .lb-stage { padding: 60px 8px 8px; }
  .lb-btn { top: auto; bottom: -52px; transform: none; }
  .lb-bar { padding-left: 64px; padding-right: 64px; }
}

/* ---------- 404 ---------- */
.lost { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 0 var(--gutter); }
.lost h1 { font-size: clamp(3rem, 14vw, 8rem); font-weight: 400; letter-spacing: .3em; margin-right: -.3em; color: var(--cyan); text-shadow: var(--misreg); }
