/* ==========================================================================
   CMSA Studio — hoja de estilos principal
   Arquitectura editorial: carbón, papel cálido, verde bosque.
   ========================================================================== */

:root {
  --ink: #171816;
  --paper: #efeee9;
  --forest: #303830;
  --white: #ffffff;
  --line-dark: rgba(23, 24, 22, 0.25);
  --line-light: rgba(239, 238, 233, 0.25);

  --serif: Georgia, "Times New Roman", "Droid Serif", serif;
  --sans: "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;

  --header-h: 84px;
  --gutter: 7.5vw;
  --gutter-wide: 3.5vw;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
h1, h2, h3 { font-weight: 400; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 14px 20px;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------- Encabezado */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  padding: 0 var(--gutter-wide);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line-dark);
  background: rgba(239, 238, 233, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.wordmark {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
}
.wordmark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-nav {
  display: flex;
  gap: 36px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.site-nav a { padding: 6px 0; transition: opacity 0.2s var(--ease); }
.site-nav a:hover { opacity: 0.48; }

.back-link {
  justify-self: center;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  transition: opacity 0.2s var(--ease);
}
.back-link:hover { opacity: 0.5; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.language {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
}
.language span { opacity: 0.4; }
.language button {
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0.62;
  transition: opacity 0.2s var(--ease);
}
.language button:hover { opacity: 1; }
.language button[aria-pressed="true"] {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 2px 0 10px;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
}
.nav-toggle .bars {
  position: relative;
  display: block;
  width: 22px;
  height: 9px;
}
.nav-toggle .bars::before,
.nav-toggle .bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: transform 0.22s var(--ease);
}
.nav-toggle .bars::before { top: 0; }
.nav-toggle .bars::after { bottom: 0; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-4px) rotate(-45deg); }

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

.hero {
  position: relative;
  height: calc(100svh - var(--header-h));
  min-height: 620px;
  overflow: hidden;
  color: var(--white);
}
.hero-media {
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(115deg, #181d19, #475044 50%, #b39976);
}
.hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 10, 8, 0.74) 0%, rgba(7, 10, 8, 0.34) 47%, rgba(7, 10, 8, 0.05) 78%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.32), transparent 45%);
}
.hero-content {
  position: absolute;
  left: var(--gutter);
  bottom: 13%;
  width: min(800px, 78vw);
}
.hero h1 {
  margin: 24px 0;
  max-width: 750px;
  font-family: var(--serif);
  font-size: clamp(64px, 9.2vw, 145px);
  line-height: 0.86;
  letter-spacing: -0.065em;
}
.hero-copy {
  max-width: 510px;
  margin: 0 0 38px;
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.5;
  font-weight: 300;
}
.hero-caption {
  position: absolute;
  right: var(--gutter-wide);
  bottom: 4%;
  margin: 0;
  writing-mode: vertical-rl;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 9px;
  opacity: 0.78;
}

.eyebrow,
.section-index {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  font-weight: 600;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid currentColor;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}
.text-link span,
.contact-link span,
.project-open span,
.case-next a span { transition: transform 0.2s var(--ease); }
.text-link:hover span[aria-hidden="true"],
.contact-link:hover span[aria-hidden="true"] { transform: translate(4px, 4px); }

/* ---------------------------------------------------------------- Estudio */

.statement {
  padding: 140px var(--gutter) 160px;
  display: grid;
  grid-template-columns: 22% 1fr;
  gap: 5vw;
  border-bottom: 1px solid var(--line-dark);
}
.statement h2,
.services-title h2,
.contact h2 {
  font-family: var(--serif);
  letter-spacing: -0.045em;
}
.statement h2 {
  max-width: 1050px;
  margin: 0 0 80px;
  font-size: clamp(42px, 6.5vw, 96px);
  line-height: 1.02;
}
.statement-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8vw;
}
.statement-grid p {
  margin: 0;
  max-width: 520px;
  font-size: 16px;
  line-height: 1.75;
}

/* --------------------------------------------------------------- Proyectos */

.projects {
  padding: 130px var(--gutter-wide) 110px;
  background: var(--ink);
  color: var(--paper);
}
.section-heading {
  display: grid;
  grid-template-columns: 26% 1fr;
  align-items: end;
  margin: 0 4vw 90px;
}
.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(65px, 10vw, 150px);
  line-height: 0.8;
  letter-spacing: -0.06em;
}
.project {
  display: grid;
  grid-template-columns: 8% 27% 1fr 13%;
  gap: 2.5vw;
  padding: 42px 4vw;
  border-top: 1px solid var(--line-light);
  align-items: start;
  transition: background 0.25s var(--ease), padding 0.25s var(--ease);
}
.project:last-child { border-bottom: 1px solid var(--line-light); }
.project:hover,
.project:focus-within { background: rgba(239, 238, 233, 0.04); padding-left: 5vw; padding-right: 3vw; }
.project-number,
.project-place,
.project-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.62;
}
.project-place { margin: 0 0 10px; }
.project h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3.1vw, 46px);
  letter-spacing: -0.03em;
}
.project-description p {
  margin: 0;
  max-width: 600px;
  font-size: 14px;
  line-height: 1.75;
  opacity: 0.76;
}
.project-open {
  display: inline-flex;
  gap: 12px;
  margin-top: 22px;
  padding-bottom: 5px;
  border-bottom: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 10px;
}
.project-open:hover span[aria-hidden="true"] { transform: translate(3px, -3px); }
.project-status { margin: 0; text-align: right; }
.phase-note {
  margin: 40px 4vw 0 auto;
  width: fit-content;
  font-size: 11px;
  letter-spacing: 0.05em;
  opacity: 0.62;
}

/* --------------------------------------------------------------- Servicios */

.services { padding: 140px var(--gutter) 150px; }
.services-title {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 1fr;
  gap: 8vw;
  align-items: end;
  margin: 35px 0 90px 22%;
}
.services-title h2 { margin: 0; font-size: clamp(46px, 6vw, 88px); line-height: 0.97; }
.services-title p { margin: 0 0 8px; max-width: 360px; font-size: 15px; line-height: 1.7; }
.service-grid {
  margin-left: 22%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--line-dark);
}
.service-grid article {
  min-height: 240px;
  padding: 32px 6vw 32px 0;
  border-bottom: 1px solid var(--line-dark);
}
.service-grid article:nth-child(odd) { border-right: 1px solid var(--line-dark); }
.service-grid article:nth-child(even) { padding-left: 4vw; }
.service-grid span { font-size: 10px; letter-spacing: 0.16em; opacity: 0.68; }
.service-grid h3 { margin: 52px 0 18px; font-size: 20px; font-weight: 500; }
.service-grid p { margin: 0; max-width: 360px; font-size: 14px; line-height: 1.7; opacity: 0.78; }

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

.contact {
  min-height: 72vh;
  padding: 110px var(--gutter);
  display: grid;
  grid-template-columns: 22% 1fr;
  align-items: start;
  background: var(--forest);
  color: var(--paper);
}
.contact h2 {
  max-width: 900px;
  margin: 20px 0 32px;
  font-size: clamp(58px, 8vw, 118px);
  line-height: 0.9;
}
.contact p { max-width: 530px; margin: 0 0 55px; font-size: 17px; line-height: 1.6; opacity: 0.82; }
.contact-link {
  display: inline-flex;
  gap: 40px;
  padding: 17px 0;
  border-bottom: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 12px;
}

/* ------------------------------------------------------------------- Footer */

.site-footer {
  min-height: 120px;
  padding: 0 var(--gutter-wide);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--forest);
  color: var(--paper);
  border-top: 1px solid rgba(239, 238, 233, 0.2);
}
.site-footer p {
  margin: 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.72;
}
.site-footer p:last-child { text-align: right; }
.footer-mark { width: 80px; height: 80px; }

/* --------------------------------------------------- Ficha: Vilches House */

.project-page { background: var(--paper); }

.case-heading { padding: 110px var(--gutter) 72px; }
.case-heading h1 {
  margin: 22px 0 34px;
  font-family: var(--serif);
  font-size: clamp(72px, 10vw, 138px);
  line-height: 0.84;
  letter-spacing: -0.065em;
}
.case-heading > p:last-child {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
}

.case-cover {
  width: min(86vw, 1040px);
  margin: 0 auto 25px;
  overflow: hidden;
}
.case-cover img,
.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #d8d6cf;
}

.case-intro {
  padding: 140px var(--gutter);
  display: grid;
  grid-template-columns: 22% 1fr;
  gap: 5vw;
}
.case-lead h2 {
  max-width: 1000px;
  margin: 0 0 72px;
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 100px);
  line-height: 0.97;
  letter-spacing: -0.05em;
}
.case-lead > p { max-width: 720px; margin: 0 0 0 auto; font-size: 18px; line-height: 1.75; }

.case-facts {
  padding: 0 var(--gutter) 130px 29.5%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.case-facts div {
  min-height: 140px;
  padding: 24px 2vw 24px 0;
  border-top: 1px solid var(--line-dark);
}
.case-facts dt,
.case-facts dd { display: block; margin: 0; }
.case-facts dt {
  margin-bottom: 42px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9px;
  opacity: 0.68;
}
.case-facts dd { max-width: 170px; font-size: 13px; font-weight: 500; line-height: 1.5; }

.case-narrative {
  padding: 150px var(--gutter) 170px;
  display: grid;
  grid-template-columns: 22% 1fr;
  gap: 5vw;
}
.case-quote {
  max-width: 1100px;
  margin: 0 0 90px;
  font-family: var(--serif);
  font-size: clamp(42px, 6vw, 88px);
  line-height: 1.03;
  letter-spacing: -0.045em;
}
.case-copy-grid {
  margin-left: 25%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6vw;
}
.case-copy-grid p { margin: 0; font-size: 16px; line-height: 1.75; }

.case-gallery {
  width: min(86vw, 1040px);
  margin: 0 auto;
  padding: 0 0 150px;
  display: flex;
  flex-direction: column;
  gap: 72px;
}
.gallery-item { width: 100%; margin: 0; }
.gallery-item img.focus-upper { object-position: 50% 34%; }
.gallery-item img.focus-mid { object-position: 50% 45%; }
.gallery-item img.focus-lower { object-position: 50% 58%; }
.gallery-item figcaption {
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 9px;
  opacity: 0.68;
}

.case-next {
  min-height: 45vh;
  padding: 100px var(--gutter);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  background: var(--ink);
  color: var(--paper);
}
.case-next p {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 9px;
  opacity: 0.62;
}
.case-next a {
  display: flex;
  align-items: baseline;
  gap: 45px;
  padding-bottom: 10px;
  border-bottom: 1px solid currentColor;
  font-family: var(--serif);
  font-size: clamp(38px, 5vw, 74px);
  letter-spacing: -0.04em;
}
.case-next a:hover span[aria-hidden="true"] { transform: translate(4px, -4px); }

/* ---------------------------------------------------------------------- 404 */

.error-page {
  min-height: calc(100svh - var(--header-h) - 120px);
  padding: 140px var(--gutter) 160px;
  display: grid;
  grid-template-columns: 22% 1fr;
  gap: 5vw;
}
.error-page h1 {
  margin: 22px 0 34px;
  font-family: var(--serif);
  font-size: clamp(64px, 9vw, 130px);
  line-height: 0.88;
  letter-spacing: -0.06em;
}
.error-page p { max-width: 520px; margin: 0 0 48px; font-size: 17px; line-height: 1.7; }

/* ------------------------------------------------------------- Revelaciones */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ------------------------------------------------------------- Adaptativo */

@media (max-width: 1440px) {
  .statement h2 { margin-bottom: 66px; }
}

@media (max-width: 1024px) {
  :root { --gutter: 6vw; }
  .statement,
  .case-intro,
  .case-narrative,
  .contact,
  .error-page { grid-template-columns: 18% 1fr; gap: 4vw; }
  .statement-grid { gap: 5vw; }
  .services-title,
  .service-grid { margin-left: 18%; }
  .services-title { grid-template-columns: 1fr; gap: 26px; align-items: start; }
  .case-facts { padding-left: 24%; grid-template-columns: repeat(3, 1fr); }
  .case-facts dt { margin-bottom: 26px; }
  .case-copy-grid { margin-left: 0; gap: 4vw; }
  .project { grid-template-columns: 8% 26% 1fr; gap: 2.5vw; }
  .project-status { grid-column: 3; text-align: left; margin-top: 18px; }
}

@media (max-width: 760px) {
  :root { --header-h: 68px; --gutter: 24px; --gutter-wide: 20px; }

  .site-header { grid-template-columns: 1fr auto; }
  .wordmark { width: 52px; height: 52px; }
  .nav-toggle { display: inline-flex; }
  /* sin JavaScript el botón no puede abrir nada: se oculta en vez de quedar muerto */
  html:not(.js) .nav-toggle { display: none; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: grid;
    gap: 0;
    padding: 8px 24px 28px;
    background: var(--paper);
    border-bottom: 1px solid var(--line-dark);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
  }
  .site-nav[data-open="true"] { opacity: 1; visibility: visible; transform: none; }
  .site-nav a { padding: 18px 0; border-bottom: 1px solid var(--line-dark); font-size: 13px; }
  .site-nav a:last-child { border-bottom: 0; }

  .back-link { justify-self: start; font-size: 9px; }

  .hero { height: calc(100svh - var(--header-h)); min-height: 560px; }
  .hero-content { left: 24px; bottom: 11%; width: calc(100% - 48px); }
  .hero h1 { max-width: 96%; font-size: clamp(60px, 21vw, 94px); }
  .hero-copy { max-width: 88%; font-size: 16px; }
  .hero-caption { display: none; }

  .statement,
  .contact,
  .error-page { grid-template-columns: 1fr; gap: 44px; padding: 90px 24px; }
  .statement h2 { margin-bottom: 55px; font-size: 47px; }
  .statement-grid { grid-template-columns: 1fr; gap: 28px; }

  .projects { padding: 90px 0 80px; }
  .section-heading { display: block; margin: 0 24px 60px; }
  .section-heading h2 { margin-top: 32px; font-size: 72px; }
  .project { grid-template-columns: 34px 1fr; gap: 18px; padding: 30px 24px; }
  .project-description,
  .project-status { grid-column: 2; }
  .project-status { text-align: left; margin-top: 20px; }
  .project:hover,
  .project:focus-within { padding-left: 24px; padding-right: 24px; }
  .phase-note { margin: 34px 24px 0; line-height: 1.5; }

  .services { padding: 90px 24px; }
  .services-title { margin: 36px 0 60px; grid-template-columns: 1fr; gap: 30px; }
  .services-title h2 { font-size: 48px; }
  .service-grid { margin: 0; grid-template-columns: 1fr; }
  .service-grid article,
  .service-grid article:nth-child(odd),
  .service-grid article:nth-child(even) { min-height: 0; padding: 28px 0 36px; border-right: 0; }
  .service-grid h3 { margin-top: 30px; }

  .contact { min-height: 0; padding-bottom: 110px; }
  .contact h2 { font-size: 61px; }

  .site-footer { padding: 36px 24px; grid-template-columns: 1fr; gap: 24px; }
  .site-footer p:last-child { text-align: left; }
  .footer-mark { width: 72px; height: 72px; }

  .case-heading { padding: 78px 24px 48px; }
  .case-heading h1 { font-size: 68px; line-height: 0.88; }
  .case-cover { width: calc(100% - 48px); }
  .case-intro,
  .case-narrative { padding: 90px 24px; grid-template-columns: 1fr; gap: 44px; }
  .case-lead h2 { margin-bottom: 48px; font-size: 51px; }
  .case-lead > p { font-size: 16px; }
  .case-facts { padding: 0 24px 85px; grid-template-columns: repeat(2, 1fr); }
  .case-facts div { min-height: 130px; }
  .case-facts dt { margin-bottom: 25px; }
  .case-quote { margin-bottom: 55px; font-size: 44px; }
  .case-copy-grid { margin: 0; grid-template-columns: 1fr; gap: 28px; }
  .case-gallery { width: calc(100% - 48px); padding-bottom: 90px; gap: 45px; }
  .case-next { min-height: 380px; padding: 70px 24px; display: block; }
  .case-next a { margin-top: 85px; font-size: 44px; }
  .error-page { min-height: 0; }
  .error-page h1 { font-size: 62px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: clamp(52px, 19vw, 78px); }
  .hero-copy { max-width: 100%; font-size: 15px; }
  .statement h2 { font-size: 40px; }
  .section-heading h2 { font-size: 58px; }
  .services-title h2 { font-size: 40px; }
  .contact h2 { font-size: 48px; }
  .case-heading h1 { font-size: 54px; }
  .case-lead h2 { font-size: 42px; }
  .case-quote { font-size: 36px; }
  .case-facts { grid-template-columns: 1fr; }
  .case-facts div { min-height: 0; }
  .case-facts dt { margin-bottom: 14px; }
  .case-next a { font-size: 36px; gap: 24px; }
  .error-page h1 { font-size: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
