/* ============================================================
   Cristián Ruiz · Construcción de Autor
   Sistema de diseño — Editorial cálido / minimalismo premium
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* Color */
  --paper:      #F7F4EF;
  --paper-2:    #EFEAE2;
  --paper-3:    #E7E0D5;
  --ink:        #1C1B19;
  --ink-soft:   #2E2C28;
  --accent:     #A9643C;
  --accent-deep:#8A4F2E;
  --stone:      #6F6A63;
  --stone-soft: #938D84;
  --line:       #D8D2C8;
  --white:      #FFFFFF;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Scale (fluid) */
  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.22vw, 1.15rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.3rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 5rem);
  --step-5:  clamp(3.2rem, 2rem + 6vw, 8rem);

  /* Spacing */
  --space-section: clamp(4.5rem, 4rem + 6vw, 9rem);
  --container: 1280px;
  --gutter: clamp(1.25rem, 0.5rem + 3.5vw, 4rem);

  /* Form */
  --radius: 2px;
  --radius-lg: 6px;
  --shadow-soft: 0 18px 50px -24px rgba(28, 27, 25, 0.35);
  --shadow-card: 0 30px 60px -30px rgba(28, 27, 25, 0.5);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.4s;

  --header-h: 84px;
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Visible keyboard focus (accessibility) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.bg-ink :focus-visible, .site-footer :focus-visible, .hero :focus-visible,
.detail-hero :focus-visible, .lightbox :focus-visible { outline-color: #E7C4A4; }
input, textarea, select { font: inherit; color: inherit; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--paper); }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
  font-optical-sizing: auto;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
p { text-wrap: pretty; }
.lead {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}
strong { font-weight: 600; }

/* ---------- 4. Layout utilities ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: 880px; }
.section { padding-block: var(--space-section); }
.section--tight { padding-block: clamp(3rem, 2.5rem + 4vw, 6rem); }
.bg-paper-2 { background: var(--paper-2); }
.bg-ink { background: var(--ink); color: var(--paper); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-deep); /* darker for AA contrast on light bg */
}
.eyebrow::before {
  content: "";
  width: 2.2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.bg-ink .eyebrow { color: #D9A77E; }

.section-head { max-width: 760px; margin-bottom: clamp(2.5rem, 2rem + 3vw, 4.5rem); }
.section-head .eyebrow { margin-bottom: 1.25rem; }
.section-head h2 { margin-bottom: 1.25rem; }
.section-head p { color: var(--stone); font-size: var(--step-1); line-height: 1.5; }

/* Heading on the left, several intro paragraphs on the right */
.section-head--split {
  max-width: none;
  display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  column-gap: clamp(2rem, 1rem + 5vw, 6rem); row-gap: 1.5rem; align-items: start;
}
.section-head--split h2 { margin-bottom: 0; }
.section-head--split .section-head__body > * + * { margin-top: 1rem; }
.section-head--split .section-head__body p { font-size: var(--step-0); line-height: 1.65; color: var(--ink-soft); }
.section-head--split .section-head__body p:first-child { font-size: var(--step-1); line-height: 1.5; color: var(--ink); }

/* ---------- 5. Buttons ---------- */
.btn {
  --btn-fg: var(--ink);
  --btn-bg: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.9rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  overflow: hidden;
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
  isolation: isolate;
}
.btn .btn__arrow { transition: transform var(--dur) var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(4px); }
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
  z-index: -1;
}
.btn:hover { color: var(--paper); border-color: var(--ink); }
.btn:hover::after { transform: scaleX(1); }

.btn--accent { --btn-fg: #fff; border-color: var(--accent); background: var(--accent); }
.btn--accent::after { background: var(--accent-deep); }
.btn--accent:hover { color: #fff; border-color: var(--accent-deep); }
.btn:active { transform: scale(0.98); }

.btn--light { --btn-fg: var(--paper); }
.btn--light::after { background: var(--paper); }
.btn--light:hover { color: var(--ink); border-color: var(--paper); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-deep);
  position: relative;
}
.text-link::after {
  content: ""; position: absolute; left: 0; bottom: -3px;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform var(--dur) var(--ease-out);
}
.text-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- 6. Header / Nav ---------- */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 100;
  transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  color: var(--paper);
  border-bottom: 1px solid transparent;
}
/* Background + blur live on a pseudo-element: a backdrop-filter on the header itself would make it
   the containing block of the fixed full-screen mobile menu (menu clipped to the header's height). */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: transparent;
  transition: background var(--dur) var(--ease-out);
}
.site-header.is-scrolled { color: var(--ink); border-bottom-color: var(--line); }
.site-header.is-scrolled::before {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
/* Pages with light background: permanent solid header with dark text */
.site-header.is-solid { color: var(--ink); border-bottom-color: var(--line); }
.site-header.is-solid::before {
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}
.brand__tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  opacity: 0.75;
  margin-top: 2px;
}
.nav__menu { display: flex; align-items: center; gap: clamp(0.85rem, 0.2rem + 1.05vw, 1.6rem); }
.nav__link {
  position: relative;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding-block: 0.3rem;
}
.nav__link::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { margin-left: 0.5rem; }
.nav__cta.btn { padding: 0.7rem 1.3rem; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  position: relative;
  z-index: 120;
}
.nav-toggle span {
  position: absolute; left: 9px; right: 9px; height: 1.5px;
  background: currentColor;
  transition: transform 0.35s var(--ease-out), opacity 0.2s ease;
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 22px; }
.nav-toggle span:nth-child(3) { top: 29px; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 7. Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  color: var(--paper);
  overflow: hidden;
}
/* Two portrait photos: side by side (diptych) on landscape screens, crossfade on portrait screens */
.hero__media {
  --hero-split: clamp(4px, 0.45vw, 8px);
  position: absolute; inset: 0; z-index: -2;
  display: grid; grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.hero__photo { position: relative; overflow: hidden; min-width: 0; }
/* The darkening that makes the headline readable lives on each photo, so the strip between
   them keeps the clean paper colour. */
.hero__photo::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(20,19,17,0.82) 0%, rgba(20,19,17,0.25) 45%, rgba(20,19,17,0.18) 78%, rgba(20,19,17,0.55) 100%);
}
.hero__photo:first-child::after {
  background:
    linear-gradient(to top, rgba(20,19,17,0.82) 0%, rgba(20,19,17,0.25) 45%, rgba(20,19,17,0.18) 78%, rgba(20,19,17,0.55) 100%),
    linear-gradient(to right, rgba(20,19,17,0.45), rgba(20,19,17,0) 60%);
}
/* thin charcoal strip separating both photos: a dark tone sits better with the warm wood of the
   photos than the off-white paper, and the white menu stays readable where it crosses the strip */
.hero__media::after {
  content: ""; position: absolute; z-index: 2;
  left: calc(50% - var(--hero-split) / 2); width: var(--hero-split);
  top: 0; bottom: 0;
  background: var(--ink);
}
.hero__media img {
  width: 100%; height: 100%; object-fit: cover;
  animation: kenburns 22s var(--ease-in-out) infinite alternate;
}
@media (orientation: portrait) and (max-width: 1100px) {
  .hero__media { grid-template-columns: 1fr; }
  .hero__photo { grid-area: 1 / 1; }
  .hero__photo + .hero__photo { opacity: 0; animation: hero-crossfade 16s var(--ease-in-out) infinite; }
  .hero__media::after { display: none; }
}
@keyframes hero-crossfade {
  0%, 42% { opacity: 0; }
  50%, 92% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes kenburns {
  from { transform: scale(1.03) translateY(0); }
  to   { transform: scale(1.14) translateY(-1.5%); }
}
.hero__inner { padding-block: clamp(6rem, 14vh, 11rem) clamp(4rem, 9vh, 7rem); width: 100%; }
.hero__eyebrow { color: #E7C4A4; margin-bottom: 1.5rem; }
.hero h1 {
  font-size: var(--step-5);
  font-weight: 300;
  letter-spacing: -0.025em;
  max-width: 16ch;
}
.hero h1 em { font-style: italic; color: #E7C4A4; }
.hero__sub {
  margin-top: 1.6rem;
  max-width: 46ch;
  font-size: var(--step-1);
  line-height: 1.5;
  color: rgba(247,244,239,0.86);
  font-weight: 300;
}
.hero__actions { margin-top: 2.6rem; display: flex; flex-wrap: wrap; gap: 1rem; }

.hero__scroll {
  position: absolute;
  left: 50%; bottom: 1.8rem;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.3em;
  opacity: 0.8;
}
.hero__scroll .line { width: 1px; height: 46px; background: rgba(247,244,239,0.5); position: relative; overflow: hidden; }
.hero__scroll .line::after {
  content: ""; position: absolute; inset: 0; background: var(--paper);
  animation: scrolldrop 2.2s var(--ease-in-out) infinite;
}
@keyframes scrolldrop {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

/* split-line reveal for hero text */
.line-mask { display: block; overflow: hidden; }
.line-mask > span { display: block; }

/* ---------- 8. Project grid ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.8rem, 0.4rem + 1vw, 1.4rem);
}
.project-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--paper-3);
}
.project-card img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.9s var(--ease-out);
}
.project-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20,19,17,0.78) 0%, rgba(20,19,17,0.12) 48%, rgba(20,19,17,0.04) 100%);
  opacity: 0.85;
  transition: opacity var(--dur) var(--ease-out);
}
@media (hover: hover) {
  .project-card:hover img { transform: scale(1.07); }
  .project-card:hover::after { opacity: 1; }
}
.project-card:focus-visible img { transform: scale(1.07); }
.project-card__body {
  position: absolute; inset-inline: 0; inset-block-end: 0;
  padding: clamp(1.1rem, 0.8rem + 1vw, 1.6rem);
  z-index: 2; color: var(--paper);
}
.project-card__name {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.1;
}
/* Materials line: revealed on hover (pointer devices), always visible on touch */
.project-card__meta {
  display: block; margin-top: 0.5rem; max-width: 32ch;
  font-size: 0.78rem; line-height: 1.45; letter-spacing: 0.02em;
  color: rgba(247,244,239,0.84);
  transform: translateY(8px); opacity: 0;
  transition: transform 0.45s var(--ease-out), opacity 0.45s var(--ease-out);
}
.project-card:hover .project-card__meta,
.project-card:focus-visible .project-card__meta { transform: translateY(0); opacity: 1; }
@media (hover: none) { .project-card__meta { transform: none; opacity: 1; } }
.projects-more { display: flex; justify-content: flex-end; margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem); }
.project-card__arrow {
  position: absolute; top: clamp(1rem, 0.8rem + 1vw, 1.5rem); right: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  width: 44px; height: 44px; border: 1px solid rgba(247,244,239,0.6); border-radius: 50%;
  display: grid; place-items: center; color: var(--paper); z-index: 2;
  opacity: 0; transform: translate(-6px, 6px) rotate(-15deg);
  transition: all 0.45s var(--ease-out);
}
.project-card:hover .project-card__arrow { opacity: 1; transform: translate(0,0) rotate(0); }
.badge {
  position: absolute; top: clamp(1rem, 0.8rem + 1vw, 1.5rem); left: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  z-index: 2;
  background: var(--accent); color: #fff;
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.4rem 0.7rem; border-radius: 100px;
}

/* ---------- 9. About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 1rem + 5vw, 5.5rem);
  align-items: center;
}
.about__portrait { position: relative; max-width: 360px; }
.about__portrait img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-lg);
}
.about__portrait .caption {
  position: absolute; bottom: 1rem; left: 1rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  padding: 0.65rem 1rem; border-radius: var(--radius);
  font-size: var(--step--1);
}
.about__portrait .caption strong { font-family: var(--font-display); font-weight: 500; }
.prose > * + * { margin-top: 1.15rem; }
.prose p { color: var(--ink-soft); }
.prose .lead { color: var(--ink); }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem; margin-top: 2.8rem;
  border-top: 1px solid var(--line); padding-top: 2rem;
}
.stat__num { font-family: var(--font-display); font-size: var(--step-3); line-height: 1; color: var(--accent); }
.stat__num .suffix { font-size: 0.55em; }
.stat__label { font-size: var(--step--1); color: var(--stone); margin-top: 0.5rem; line-height: 1.4; }

/* ---------- 10. Contact ---------- */
.contact__grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 1rem + 5vw, 5rem);
}
.contact__info { display: flex; flex-direction: column; gap: 1.6rem; }
.contact-item { display: flex; gap: 1rem; align-items: flex-start; }
.contact-item .ic {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent);
}
.contact-item .label { display: block; font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.12em; color: var(--stone); }
.contact-item .value { display: block; font-family: var(--font-display); font-size: var(--step-1); overflow-wrap: anywhere; }
/* long e-mail must wrap instead of widening the column on narrow phones */
.contact__grid > *, .contact-item > span:last-child { min-width: 0; }
.contact-item a.value:hover { color: var(--accent); }

.form { display: grid; gap: 1.4rem; }
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em; color: var(--stone); }
.field input, .field textarea {
  background: transparent;
  border: none; border-bottom: 1px solid var(--line);
  padding: 0.85rem 0.1rem;
  font-size: var(--step-0);
  transition: border-color var(--dur) var(--ease-out);
}
.field input::placeholder, .field textarea::placeholder { color: var(--stone); opacity: 1; }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent-deep); border-bottom-width: 2px; }
.field textarea { resize: vertical; min-height: 120px; }
.form__note { font-size: var(--step--1); color: var(--stone); }
.map-embed { margin-top: 2.5rem; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.map-embed iframe { width: 100%; height: 320px; border: 0; display: block; filter: grayscale(0.3) contrast(1.05); }

/* ---------- 11. Process page ---------- */
.page-hero {
  position: relative; padding-top: calc(var(--header-h) + clamp(3rem, 6vw, 6rem));
  padding-bottom: clamp(2.5rem, 5vw, 5rem);
}
.page-hero .eyebrow { margin-bottom: 1.25rem; }
.page-hero h1 { font-size: var(--step-4); max-width: 18ch; }
.page-hero p { margin-top: 1.5rem; max-width: 60ch; color: var(--stone); font-size: var(--step-1); }

.page-hero .keywords {
  font-family: var(--font-display); font-style: italic;
  color: var(--accent-deep); font-size: var(--step-1);
}

/* Timeline: sticky photo + ordered stages */
.process {
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 1rem + 5vw, 6rem); align-items: start;
}
.process__media { position: sticky; top: calc(var(--header-h) + 2rem); }
.process__media img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius-lg); }
.process__steps { list-style: none; padding: 0; }
.process-step {
  display: grid; grid-template-columns: 4.2rem 1fr; gap: clamp(1rem, 0.5rem + 2vw, 2.5rem);
  padding-block: clamp(1.6rem, 1.2rem + 1.5vw, 2.6rem);
  border-top: 1px solid var(--line);
}
.process-step:last-child { border-bottom: 1px solid var(--line); }
.process-step__num {
  font-family: var(--font-display); font-size: var(--step-3); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--accent); text-stroke: 1px var(--accent);
}
.process-step__title { font-size: var(--step-2); margin-bottom: 0.6rem; }
.process-step p { color: var(--stone); font-size: var(--step-1); line-height: 1.5; max-width: 42ch; }

/* ---------- 12. Differentiation ---------- */
.pillars { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(2.5rem, 2rem + 3vw, 4.5rem) clamp(2rem, 1rem + 5vw, 6rem); }
.pillar { padding-top: 1.6rem; border-top: 2px solid var(--accent); }
.pillar__num { display: block; font-family: var(--font-display); font-size: var(--step-1); color: var(--accent-deep); margin-bottom: 0.9rem; }
.pillar h2 { font-size: var(--step-3); margin-bottom: 0.9rem; }
.pillar p { color: var(--stone); font-size: var(--step-1); line-height: 1.5; max-width: 40ch; }

/* ---------- 13. Project detail ---------- */
.detail-hero {
  position: relative; min-height: 82svh; display: flex; align-items: flex-end;
  color: var(--paper); overflow: hidden;
}
.detail-hero__media { position: absolute; inset: 0; z-index: -2; }
.detail-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(20,19,17,0.82) 0%, rgba(20,19,17,0.18) 50%, rgba(20,19,17,0.5) 100%);
}
.detail-hero__inner { padding-block: clamp(5rem, 12vh, 9rem) clamp(2.5rem, 6vh, 4rem); }
.detail-hero h1 { font-size: var(--step-4); max-width: 16ch; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 1.5rem;
  font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em;
}
.detail-meta > div { max-width: 62ch; }
.detail-meta .k { color: rgba(247,244,239,0.72); display: block; margin-bottom: 0.25rem; }
.detail-meta .v { font-family: var(--font-display); font-size: var(--step-0); letter-spacing: 0; text-transform: none; }

.detail-body { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(2rem, 1rem + 4vw, 5rem); }
.detail-body .sticky { position: sticky; top: calc(var(--header-h) + 2rem); align-self: start; }
.detail-body .sticky h2 { font-size: var(--step-3); margin-top: 1.25rem; }
.prose .closing { font-family: var(--font-display); font-style: italic; font-size: var(--step-1); line-height: 1.45; color: var(--accent-deep); }

.gallery-section { padding-top: 0; }

/* Justified photo rows: every photo keeps its own proportion, rows share one height.
   --ar = width/height, --w = native width (caps upscaling of small originals). */
.gallery {
  --row-h: clamp(190px, 9vw + 120px, 320px);
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: clamp(0.6rem, 0.3rem + 0.8vw, 1rem);
}
.gallery::after { content: ""; flex: 100000 1 0; }
.gallery__item {
  position: relative; display: block; overflow: hidden;
  flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row-h));
  max-width: calc(var(--w) * 1.5px);
  aspect-ratio: var(--ar);
  border-radius: var(--radius-lg); background: var(--paper-3);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease-out); }
.gallery__item::after {
  content: "+"; position: absolute; right: 0.75rem; bottom: 0.75rem;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.4rem; line-height: 1; color: var(--paper);
  background: rgba(20,19,17,0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transform: scale(0.85);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
@media (hover: hover) {
  .gallery__item:hover img { transform: scale(1.04); }
  .gallery__item:hover::after { opacity: 1; transform: none; }
}
.gallery__item:focus-visible::after { opacity: 1; transform: none; }

/* Lightbox (dialog created by main.js) */
.lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(20,19,17,0.96); color: var(--paper);
  overscroll-behavior: contain;
}
.lightbox::backdrop { background: rgba(20,19,17,0.6); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lightbox__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem var(--gutter);
  font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(247,244,239,0.75);
}
.lightbox__stage {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.9rem;
  min-height: 0; margin: 0; padding: 0 clamp(1rem, 7vw, 6.5rem) clamp(1rem, 3vh, 2rem);
}
.lightbox__img {
  display: block; min-height: 0; max-width: 100%; max-height: calc(100% - 3rem); width: auto; height: auto;
  object-fit: contain; border-radius: var(--radius);
  transition: opacity 0.35s var(--ease-out);
}
.lightbox__img.is-loading { opacity: 0; }
.lightbox__caption { max-width: 70ch; text-align: center; font-size: var(--step--1); color: rgba(247,244,239,0.72); }
.lightbox__btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(247,244,239,0.35); color: var(--paper); font-size: 1.15rem;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.lightbox__btn:hover { background: var(--accent); border-color: var(--accent); }
.lightbox__prev, .lightbox__next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(20,19,17,0.4); }
.lightbox__prev { left: clamp(0.5rem, 2vw, 2rem); }
.lightbox__next { right: clamp(0.5rem, 2vw, 2rem); }

.project-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--line); margin-top: var(--space-section); padding-top: 2rem;
}
.project-nav a { display: flex; flex-direction: column; gap: 0.3rem; }
.project-nav .dir { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.12em; color: var(--stone); }
.project-nav .ttl { font-family: var(--font-display); font-size: var(--step-1); }
.project-nav a:hover .ttl { color: var(--accent); }
.project-nav .next { text-align: right; margin-left: auto; }

/* ---------- 14. CTA band ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.5rem; }
.page-hero--tall { min-height: 68svh; }

.cta-band { text-align: center; }
.cta-band h2 { font-size: var(--step-3); max-width: 20ch; margin-inline: auto; margin-bottom: 1.5rem; }
.cta-band p { max-width: 52ch; margin-inline: auto; margin-bottom: 2rem; color: var(--stone); font-size: var(--step-1); }
.bg-ink.cta-band p { color: rgba(247,244,239,0.8); }

/* ---------- 15. Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: clamp(3.5rem, 3rem + 3vw, 5.5rem) 2rem; }
.footer__top {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: clamp(2rem, 1rem + 3vw, 4rem);
  padding-bottom: 3rem; border-bottom: 1px solid rgba(247,244,239,0.14);
}
.footer__brand .brand__name { font-size: 1.7rem; }
.footer__brand p { color: rgba(247,244,239,0.6); max-width: 34ch; margin-top: 1rem; font-size: var(--step-0); }
.footer__col h4 { font-family: var(--font-body); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.16em; color: #D9A77E; margin-bottom: 1.2rem; font-weight: 600; }
.footer__col ul { display: grid; gap: 0.25rem; }
.footer__col a { color: rgba(247,244,239,0.78); transition: color 0.3s ease; font-size: var(--step-0); display: inline-flex; align-items: center; min-height: 40px; }
.footer__col a:hover { color: var(--paper); }
.footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  padding-top: 1.8rem; font-size: var(--step--1); color: rgba(247,244,239,0.5);
}
.footer__social { display: flex; gap: 1rem; }
.footer__social a { width: 44px; height: 44px; border: 1px solid rgba(247,244,239,0.2); border-radius: 50%; display: grid; place-items: center; color: rgba(247,244,239,0.8); transition: all 0.3s ease; }
.footer__social a:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }

/* ---------- 16. Reveal animations ----------
   Hidden states apply ONLY when JS is active (html.js, set by an inline
   script). Without JS — or if main.js fails to load — content stays visible. */
html.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
html.js .reveal.is-visible { opacity: 1; transform: none; }
html.js .reveal[data-reveal="left"] { transform: translateX(-36px); }
html.js .reveal[data-reveal="right"] { transform: translateX(36px); }
html.js .reveal[data-reveal="scale"] { transform: scale(1.04); }
html.js .reveal.is-visible[data-reveal] { transform: none; }
html.js [data-stagger] > * { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
html.js [data-stagger].is-visible > * { opacity: 1; transform: none; }

/* hero line reveal */
html.js .line-mask > span { transform: translateY(110%); transition: transform 1s var(--ease-out); }
.hero.is-ready .line-mask > span { transform: translateY(0); }
html.js .hero .fade-up { opacity: 0; transform: translateY(20px); transition: opacity 1s var(--ease-out) 0.5s, transform 1s var(--ease-out) 0.5s; }
html.js .hero.is-ready .fade-up { opacity: 1; transform: none; } /* same specificity as the hidden state + .is-ready */

/* ken-burns and crossfade pause when the hero leaves the viewport (saves battery/GPU) */
.hero__media.is-paused img, .hero__media.is-paused .hero__photo { animation-play-state: paused; }

/* page load fade (JS only) */
html.js body { opacity: 0; transition: opacity 0.6s ease; }
html.js body.is-loaded { opacity: 1; }
html.js body.is-leaving { opacity: 0; }

/* ---------- 17. Responsive ---------- */
/* 7 menu items: switch to the full-screen menu before they stop fitting on one line */
@media (max-width: 1240px) {
  .nav-toggle { display: block; }
  .nav__menu {
    position: fixed; inset: 0;
    flex-direction: column; justify-content: center;
    gap: clamp(1rem, 3.2vh, 1.6rem);
    background: var(--paper); color: var(--ink);
    transform: translateX(100%);
    visibility: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.5s var(--ease-out), visibility 0s linear 0.5s;
    padding: calc(var(--header-h) + 1.5rem) 1.5rem 2.5rem;
  }
  .nav__menu.is-open { transform: translateX(0); visibility: visible; transition: transform 0.5s var(--ease-out); }
  .nav__link { font-size: var(--step-2); font-family: var(--font-display); }
  .nav__link::after { display: none; }
  .nav__cta.btn { margin-top: 1rem; font-size: var(--step--1); }
  .site-header.has-open-menu { color: var(--ink); }
}
@media (max-width: 1100px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  :root { --header-h: 72px; }
  .about__grid { grid-template-columns: 1fr; }
  .about__portrait { max-width: 300px; }
  .contact__grid { grid-template-columns: 1fr; }
  .section-head--split { grid-template-columns: 1fr; }
  .process { grid-template-columns: 1fr; }
  .process__media { position: static; }
  .process__media img { aspect-ratio: 16 / 11; }
  .detail-body { grid-template-columns: 1fr; }
  .detail-body .sticky { position: static; }
  .footer__top { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
  .pillars { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .projects-grid { grid-template-columns: 1fr; }
  /* the smaller portrait leaves little room for an overlaid caption */
  .about__portrait .caption {
    position: static; background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    padding: 0.9rem 0 0;
  }
  .stats { grid-template-columns: 1fr; gap: 1.2rem; text-align: left; }
  .gallery { --row-h: 150px; }
  .gallery::after { display: none; }
  .footer__top { grid-template-columns: 1fr; }
  .detail-meta { gap: 1.5rem; }
  .hero__scroll { display: none; }
  .process-step { grid-template-columns: 2.8rem 1fr; }
  .lightbox__stage { padding-bottom: 5.5rem; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 1rem; transform: none; }
}

/* short viewport / landscape: keep the full-screen mobile menu reachable */
@media (max-width: 1240px) and (max-height: 600px) {
  .nav__menu { justify-content: flex-start; }
  .nav__link { font-size: var(--step-1); }
}

/* skip link (a11y — visible on keyboard focus) */
.skip-link {
  position: fixed; top: 0.5rem; left: 0.5rem; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 0.75rem 1.1rem; border-radius: var(--radius);
  font-size: var(--step--1); font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); outline: 2px solid #E7C4A4; outline-offset: 2px; }

/* ---------- 18. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal, [data-stagger] > *, .hero .fade-up, .line-mask > span { opacity: 1 !important; transform: none !important; }
  .hero__media img, .hero__photo { animation: none !important; }
}
