:root {
  --bg: #ffffff;
  --soft: #f2f2f2;
  --ink: #282828;
  --muted: #8a8a8a;
  --line: #e2e2e2;
  --gutter: clamp(12px, 1.4vw, 20px);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: var(--font);
  --body: var(--font);
  --round: var(--font);
  --small: 13px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--small)/1.4 var(--font);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: .55; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; font-size: inherit; line-height: inherit; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
em { font-style: normal; }
.label { font-size: var(--small); }

/* ---------- Pantalla de entrada ---------- */
.intro-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: #000; color: #fff; font-size: 22px; letter-spacing: .02em;
  transition: opacity .8s ease;
}
.intro-screen.out { opacity: 0; pointer-events: none; }

/* ---------- Barra superior ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: center;
  padding: 12px var(--gutter);
  background: var(--bg);
}
.nav-end { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.lang { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.lang button { font: inherit; letter-spacing: inherit; border: 0; padding: 0; background: none; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { color: var(--ink); }

/* ---------- Proyectos ---------- */
.work {
  display: grid; grid-template-columns: repeat(12, 1fr); align-items: start;
  gap: clamp(40px, 5vw, 72px) var(--gutter);
  padding: clamp(24px, 3vw, 40px) var(--gutter) clamp(80px, 10vw, 140px);
}
.work-item { display: grid; gap: 8px; }
.work-img { position: relative; overflow: hidden; background: var(--soft); }
.work-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.work-hover { position: absolute; inset: 0; object-fit: contain !important; padding: 12%; background: #5A1426; opacity: 0; transition: opacity .5s ease; }
a.work-item:hover { opacity: 1; }
a.work-item:hover .work-hover { opacity: 1; }
.work-empty { display: grid; place-items: center; color: var(--muted); }
.work-cap { display: flex; justify-content: space-between; gap: 12px; }
.work-sub { margin-top: -6px; justify-content: flex-end; color: var(--muted); }

.w1 { grid-column: 1 / 8; }
.w1 .work-img { aspect-ratio: 1328 / 800; }
.w2 { grid-column: 9 / 12; margin-top: 14%; }
.w2 .work-img { aspect-ratio: 1493 / 2000; }
.w3 { grid-column: 10 / 13; }
.w3 .work-img { aspect-ratio: 4 / 5; }
.w4 { grid-column: 4 / 10; }
.w4 .work-img { aspect-ratio: 16 / 10; }

/* ---------- Info ---------- */
.info { padding: 0 var(--gutter); }
.row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gutter);
  padding: 16px 0 clamp(64px, 8vw, 120px); border-top: 1px solid var(--ink);
}
.row-label { grid-column: 1; }
.row-body { grid-column: 2 / 4; }
.lead { font-size: clamp(20px, 2.1vw, 30px); line-height: 1.2; letter-spacing: -.01em; max-width: 30em; }
.lead a { text-decoration: underline; text-underline-offset: .12em; text-decoration-thickness: 1px; }
.small { margin-top: 16px; color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); max-width: 66%; gap: var(--gutter); margin: clamp(40px, 5vw, 64px) 0 0; }
.facts dt { font-size: clamp(20px, 2.1vw, 30px); line-height: 1.2; }
.facts dd { margin: 4px 0 0; color: var(--muted); }

.cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(32px, 4vw, 48px) var(--gutter); }
.cols .num { display: block; color: var(--muted); margin-bottom: 8px; }
.cols h3 { font-size: clamp(16px, 1.4vw, 20px); line-height: 1.2; margin-bottom: 8px; }
.cols p { max-width: 36em; color: #555; }

.cols-after { margin-top: clamp(40px, 5vw, 64px); }

/* ---------- Página de contacto ---------- */
.contact-page { padding: clamp(24px, 3vw, 40px) var(--gutter) 0; min-height: calc(100svh - 90px); }
.contact-form { display: grid; gap: 18px; max-width: 640px; }
.contact-intro { font-size: clamp(20px, 2.1vw, 30px); line-height: 1.2; letter-spacing: -.01em; margin-bottom: 12px; }
.contact-form label { display: grid; gap: 6px; color: var(--muted); }
.contact-form label em { font-style: normal; opacity: .7; }
.contact-form input, .contact-form select, .contact-form textarea {
  font: 400 16px/1.4 var(--font); color: var(--ink);
  width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; outline: none;
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { border-bottom-color: var(--ink); }
.contact-trap { position: absolute; left: -9999px; }
.contact-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px; }
.contact-status { color: var(--muted); }
.contact-foot button {
  font: inherit; letter-spacing: inherit; color: var(--bg); background: var(--ink);
  border: 0; padding: 10px 22px; cursor: pointer;
}
.contact-foot button:disabled { opacity: .4; cursor: default; }

/* ---------- Pie ---------- */
.footer {
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: end;
  padding: 12px var(--gutter);
}
.footer > :last-child { justify-self: end; }

/* Compatibilidad con la página de proyecto */
.section { padding: clamp(64px, 8vw, 120px) var(--gutter); }
.contact-title { font-size: clamp(24px, 2.6vw, 36px); line-height: 1.15; }
.contact-title a { text-decoration: underline; text-underline-offset: .12em; text-decoration-thickness: 1px; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .w1 { grid-column: 1 / 13; }
  .w2 { grid-column: 1 / 7; margin-top: 0; }
  .w3 { grid-column: 7 / 13; }
  .w4 { grid-column: 1 / 13; }
  .row { grid-template-columns: 1fr; }
  .row-label, .row-body { grid-column: 1; }
}
@media (max-width: 600px) {
  .nav { grid-template-columns: 1fr auto; row-gap: 6px; }
  .nav > a[href="#proyectos"], .nav > a[href$="#proyectos"] { display: none; }
  .nav-end { gap: 12px; }
  .nav-end a:last-of-type { margin-left: 0; }
  .w2, .w3 { grid-column: 1 / 13; }
  .cols, .facts { grid-template-columns: 1fr; }
  .footer { grid-template-columns: 1fr; gap: 4px; }
  .footer > :last-child { justify-self: start; }
}
