/* ---- tokens.css ---- */
/* Layer 2 — design tokens.
   Colour is derived from the territory, not from a template: granite ink,
   limestone paper, vine-leaf green for the single functional accent.
   The palette is deliberately narrow — background, surface, border, text,
   accent — because the brief restricts it. Every pair marked "AA" is verified
   by scripts/audit.mjs (contrast, no guessing). */

@layer tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    color-scheme: light;

    /* --- Palette: surface & structure --- */
    --bg: #edf0e8;              /* limestone with a green undertone */
    --bg-deep: #17211b;         /* granite ink, used for inverted bands */
    --surface: #fcfcfa;         /* raised panels, dialog, cards */
    --surface-sunk: #e3e8dd;    /* quiet wells, filter row */
    --border: #cbd2c4;          /* hairlines between sections */
    --border-strong: #78836f;   /* input outlines — 3:1 on --bg (AA UI) */

    /* --- Palette: ink --- */
    --text: #14201a;            /* 15.2:1 on --bg (AA) */
    --text-muted: #4a554e;      /* 6.6:1 on --bg (AA) */
    --on-deep: #e9eee4;         /* 13.6:1 on --bg-deep (AA) */
    --on-deep-muted: #aebba9;   /* 8.1:1 on --bg-deep (AA) */

    /* --- Palette: the one accent --- */
    --accent: #2c5c42;          /* 6.5:1 on --bg, 7.4:1 with --surface text */
    --accent-strong: #1f4632;   /* hover / pressed */
    --accent-on-deep: #b9d4b4;  /* 9.0:1 on --bg-deep (AA) */
    --accent-tint: #dde7da;     /* 1.2:1 — decoration only, never meaning */

    /* --- Focus: one visible ring that survives both bands --- */
    --focus: #0b2a1c;
    --focus-on-deep: #d8e8d3;

    /* --- Typography: strict modular scale ---
       Ratio 1.25 at the top of each clamp, 1.2 at the bottom (mobile).
       Body 17px gives a comfortable 66ch measure at 68ch max. */
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --fs-2xs: 0.75rem;      /* 12 — table captions, legal */
    --fs-xs: 0.8125rem;     /* 13 — labels, metadata */
    --fs-sm: 0.875rem;      /* 14 — secondary copy */
    --fs-base: 1.0625rem;   /* 17 — body */
    --fs-md: 1.25rem;       /* 20 — lead-in */
    --fs-lg: clamp(1.375rem, 1.31rem + 0.28vw, 1.5625rem);
    --fs-xl: clamp(1.625rem, 1.42rem + 0.9vw, 2.0625rem);
    --fs-2xl: clamp(1.9375rem, 1.55rem + 1.7vw, 2.5rem);
    --fs-3xl: clamp(2.25rem, 1.6rem + 2.8vw, 3.25rem);
    --fs-display: clamp(2.5rem, 1.42rem + 4.5vw, 4.25rem);

    --lh-tight: 1.06;
    --lh-heading: 1.14;
    --lh-snug: 1.4;
    --lh-body: 1.62;

    --measure: 68ch;
    --measure-tight: 54ch;

    /* --- Space: 4px grid --- */
    --space-1: 0.25rem;   /* 4 */
    --space-2: 0.5rem;    /* 8 */
    --space-3: 0.75rem;   /* 12 */
    --space-4: 1rem;      /* 16 */
    --space-5: 1.25rem;   /* 20 */
    --space-6: 1.5rem;    /* 24 */
    --space-8: 2rem;      /* 32 */
    --space-10: 2.5rem;   /* 40 */
    --space-12: 3rem;     /* 48 */
    --space-16: 4rem;     /* 64 */
    --space-20: 5rem;     /* 80 */
    --space-24: 6rem;     /* 96 */
    --space-32: 8rem;     /* 128 */

    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --shell: 72.5rem;      /* 1160 */
    --shell-narrow: 46rem;
    --section-y: clamp(4rem, 2.2rem + 7vw, 7.5rem);

    /* --- Shape: granite wants corners, not pills --- */
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 14px;

    /* --- Motion: one curve family, 150–250ms --- */
    --ease-out-snappy: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out-smooth: cubic-bezier(0.77, 0, 0.175, 1);
    --dur-fast: 150ms;
    --dur-base: 200ms;
    --dur-slow: 250ms;

    /* --- Elevation: only for things that float on the Z axis --- */
    --shadow-float: 0 24px 60px -24px rgb(20 32 26 / 45%), 0 2px 8px -2px rgb(20 32 26 / 18%);

    --hairline: 1px solid var(--border);
  }
}


/* ---- base.css ---- */
/* Layer 3 — base: reset, document defaults, typography primitives.
   Zero divitis: everything here targets native elements. */

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

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchored sections must not hide under the sticky header. */
    scroll-padding-top: 6rem;
  }

  body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-body);
    font-synthesis-weight: none;
    text-rendering: optimizelegibility;
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: var(--lh-heading);
    letter-spacing: -0.015em;
    text-wrap: balance;
    margin: 0;
  }

  h1 {
    font-size: var(--fs-display);
    line-height: var(--lh-tight);
    letter-spacing: -0.028em;
  }

  h2 {
    font-size: var(--fs-2xl);
  }

  h3 {
    font-size: var(--fs-lg);
  }

  h4 {
    font-size: var(--fs-base);
    font-family: var(--font-body);
    font-weight: 650;
    letter-spacing: 0;
  }

  p {
    margin: 0 0 var(--space-4);
    max-width: var(--measure);
    text-wrap: pretty;
  }

  p:last-child {
    margin-bottom: 0;
  }

  a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color var(--dur-fast) var(--ease-out-snappy);
  }

  a:hover {
    color: var(--accent-strong);
  }

  strong {
    font-weight: 650;
  }

  ul,
  ol {
    margin: 0 0 var(--space-4);
    padding-left: 1.15em;
  }

  li + li {
    margin-top: var(--space-2);
  }

  img,
  svg,
  video {
    display: block;
    max-width: 100%;
    height: auto;
  }

  figure {
    margin: 0;
  }

  figcaption {
    margin-top: var(--space-3);
    font-size: var(--fs-sm);
    color: var(--text-muted);
    max-width: var(--measure-tight);
  }

  hr {
    border: 0;
    border-top: var(--hairline);
    margin: var(--space-10) 0;
  }

  /* --- Focus: explicit, never removed, legible on both bands --- */
  :focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
  }

  .band--deep :focus-visible,
  .site-header :focus-visible {
    outline-color: var(--focus-on-deep);
  }

  .site-header :focus-visible {
    outline-color: var(--focus);
  }

  ::selection {
    background-color: var(--accent-tint);
    color: var(--text);
  }

  /* --- Buttons: 44px minimum, tactile press, no layout animation --- */
  .button {
    --button-bg: var(--accent);
    --button-ink: var(--surface);
    --button-border: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    min-width: 44px;
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--button-border);
    border-radius: var(--radius-sm);
    background-color: var(--button-bg);
    color: var(--button-ink);
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    transition:
      background-color var(--dur-fast) var(--ease-out-snappy),
      color var(--dur-fast) var(--ease-out-snappy),
      border-color var(--dur-fast) var(--ease-out-snappy),
      transform var(--dur-base) var(--ease-out-snappy);
  }

  .button:hover {
    background-color: var(--accent-strong);
    color: var(--surface);
  }

  .button:active {
    transform: scale(0.97);
  }

  .button--ghost {
    --button-bg: transparent;
    --button-ink: var(--text);
    --button-border: var(--border-strong);
  }

  .button--ghost:hover {
    --button-bg: var(--surface);
    --button-ink: var(--text);
    --button-border: var(--text);
  }

  .button--quiet {
    --button-bg: transparent;
    --button-ink: var(--accent);
    --button-border: transparent;
    padding-inline: var(--space-2);
    text-decoration: underline;
    text-underline-offset: 0.22em;
  }

  .button--quiet:hover {
    --button-bg: transparent;
    --button-ink: var(--accent-strong);
  }

  .button[disabled],
  .button[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
  }

  .button[disabled]:hover {
    background-color: var(--button-bg);
  }

  /* --- Text primitives --- */
  .lead {
    font-size: var(--fs-md);
    line-height: var(--lh-snug);
    color: var(--text);
    max-width: var(--measure-tight);
    text-wrap: pretty;
  }

  .muted {
    color: var(--text-muted);
  }

  .label {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .band--deep .muted,
  .band--deep .label {
    color: var(--on-deep-muted);
  }

    /* Band link colours must never win over a .button's own pair of tokens. */
  .band--deep a:not(.button) {
    color: var(--accent-on-deep);
  }

  .band--deep a:not(.button):hover {
    color: var(--on-deep);
  }

  .band--deep .lead,
  .band--deep .story__body .lead {
    color: var(--on-deep);
  }

  .skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 100;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    background-color: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    transform: translateY(-200%);
    transition: transform var(--dur-fast) var(--ease-out-snappy);
  }

  .skip-link:focus-visible {
    transform: translateY(0);
  }

  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  [hidden] {
    display: none !important;
  }

  /* --- Reduced motion: the contract, not an afterthought --- */
  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}


/* ---- layout.css ---- */
/* Layer 3 — layout: the shell, the tone bands, the section skeleton.

   Bands are the structural device: full-bleed flat tone shifts (limestone,
   granite ink, sunk green) instead of floating cards. That is what keeps the
   page from becoming a SaaS card kit. */

@layer layout {
  .shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .shell--narrow {
    max-width: var(--shell-narrow);
  }

  .band {
    padding-block: var(--section-y);
    border-top: var(--hairline);
  }

  .band--flush {
    padding-block: 0;
    border-top: 0;
  }

  .band--deep {
    background-color: var(--bg-deep);
    color: var(--on-deep);
    border-top-color: transparent;
  }

  .band--sunk {
    background-color: var(--surface-sunk);
  }

  .band--tight {
    padding-block: clamp(3rem, 2rem + 4vw, 4.5rem);
  }

  /* --- Section head: label + headline + optional lede, one rhythm --- */
  .section-head {
    display: grid;
    gap: var(--space-3);
    margin-bottom: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  }

  .section-head h2 {
    max-width: 22ch;
  }

  .section-head .lead {
    margin-top: var(--space-1);
  }

  .section-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: var(--space-6);
  }

  .section-head__row > div {
    display: grid;
    gap: var(--space-3);
  }

  /* --- Stack: vertical rhythm utility for prose blocks --- */
  .stack {
    display: grid;
    gap: var(--space-4);
    align-content: start;
  }

  .stack--loose {
    gap: var(--space-6);
  }

  /* --- Two-column editorial split: text left, evidence right --- */
  .split {
    display: grid;
    gap: clamp(2rem, 1rem + 4vw, 4.5rem);
    align-items: start;
  }

  @media (min-width: 62rem) {
    .split {
      grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    }

    .split--flip > :first-child {
      order: 2;
    }
  }

  /* --- Value list: no cards, just a ruled ledger --- */
  .ledger {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: var(--measure);
    border-top: var(--hairline);
  }

  .ledger li {
    margin: 0;
    padding-block: var(--space-4);
    border-bottom: var(--hairline);
    display: grid;
    gap: var(--space-2);
  }

  .ledger strong {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .ledger span {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    max-width: var(--measure-tight);
  }

  .band--deep .ledger {
    border-top-color: rgb(233 238 228 / 22%);
  }

  .band--deep .ledger li {
    border-bottom-color: rgb(233 238 228 / 22%);
  }

  .band--deep .ledger span {
    color: var(--on-deep-muted);
  }

  /* --- Footer grid skeleton lives in footer.css --- */
}


/* ---- header.css ---- */
/* Layer 3 — header: sticky, hairline, wraps instead of hiding behind a
   hamburger. Three destinations do not justify a menu button; a scroll-safe
   row keeps every target visible, 44px tall, with no JS. */

@layer components {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--bg);
    border-bottom: var(--hairline);
  }

  .site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    min-height: 4.5rem;
    padding-block: var(--space-2);
    flex-wrap: wrap;
  }

  .brand {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    color: var(--text);
    text-decoration: none;
    min-height: 44px;
    align-content: center;
    flex-wrap: wrap;
  }

  .brand:hover {
    color: var(--text);
  }

  .brand__word {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .brand__rule {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    letter-spacing: 0.02em;
  }

  .site-nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
    max-width: none;
  }

  .site-nav li + li {
    margin: 0;
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 550;
    text-decoration: none;
    white-space: nowrap;
    transition:
      background-color var(--dur-fast) var(--ease-out-snappy),
      color var(--dur-fast) var(--ease-out-snappy),
      transform var(--dur-base) var(--ease-out-snappy);
  }

  .site-nav a:hover {
    background-color: var(--surface-sunk);
    color: var(--text);
  }

  .site-nav a:active {
    transform: scale(0.97);
  }

  .site-nav a[aria-current="page"] {
    background-color: var(--text);
    color: var(--bg);
  }

  .site-nav a[aria-current="page"]:hover {
    background-color: var(--accent-strong);
    color: var(--surface);
  }

  /* Narrow viewports wrap the row instead of hiding a destination behind a
     horizontal scroll: every link stays visible and thumb-sized. */
  @media (max-width: 40rem) {
    .site-header__inner {
      gap: var(--space-1) var(--space-3);
      padding-bottom: var(--space-2);
    }

    .site-nav {
      width: 100%;
      margin-inline: calc(var(--space-2) * -1);
    }

    .site-nav ul {
      flex-wrap: wrap;
      gap: 0 var(--space-1);
    }

    .site-nav a {
      padding-inline: var(--space-2);
    }
  }
}


/* ---- hero.css ---- */
/* --- Rediseño Editorial Orgánico (Arterra-inspired) --- */

/* Hero */
.hero {
  padding-block: clamp(3rem, 5vw, 5.5rem);
  background: var(--bg);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
}

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.hero__kicker::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  color: var(--text);
  margin-bottom: var(--space-5);
  font-weight: 600;
  letter-spacing: -1px;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.hero__lead {
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  color: var(--text-muted);
  margin-bottom: var(--space-8);
  max-width: 54ch;
}

.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Hero Visual & Photo Card */
.hero__visual {
  position: relative;
}

.hero__photo-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-float);
  background: var(--bg-deep);
}

.hero__photo-card img {
  width: 100%;
  height: clamp(340px, 40vw, 480px);
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out-snappy);
}

.hero__photo-card:hover img {
  transform: scale(1.02);
}

.hero__photo-caption {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  padding: var(--space-8) var(--space-6) var(--space-5);
  background: linear-gradient(to top, rgba(20, 32, 26, 0.95) 0%, rgba(20, 32, 26, 0) 100%);
  color: var(--on-deep);
}

.hero__photo-caption h3 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-1);
}

.hero__photo-caption p {
  font-size: var(--fs-xs);
  color: var(--on-deep-muted);
}

/* Floating Badge */
.floating-badge {
  position: absolute;
  top: -1.25rem;
  left: -1.5rem;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 12px 30px -8px rgba(20, 32, 26, 0.15);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.floating-badge__icon {
  font-size: 1.75rem;
  display: grid;
  place-items: center;
}

.floating-badge__text strong {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.2;
}

.floating-badge__text small {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }
  .floating-badge {
    position: static;
    margin-bottom: var(--space-4);
  }
}


/* ---- sections.css ---- */
/* --- Pillars band (3 pilares comunitarios) --- */
.pillars-band {
  background: var(--surface);
  border-block: 1px solid var(--border);
  padding-block: var(--space-12);
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
}

.pillar-item {
  padding: var(--space-6);
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.pillar-item h3 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.pillar-item p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

/* --- Projects grid (Tarjetas ricas con foto) --- */
.section-tag {
  display: inline-block;
  font-size: var(--fs-2xs);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-base) var(--ease-out-snappy),
              box-shadow var(--dur-base) var(--ease-out-snappy);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-float);
  border-color: var(--border-strong);
}

.project-card__thumb {
  position: relative;
  height: 220px;
  background: var(--bg-deep);
  overflow: hidden;
}

.project-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out-snappy);
}

.project-card:hover .project-card__thumb img {
  transform: scale(1.05);
}

.project-card__badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: rgba(255, 255, 255, 0.95);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 99px;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.project-card__body {
  padding: var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card__location {
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.project-card__body h3 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-2);
  line-height: var(--lh-tight);
}

.project-card__body h3 a {
  color: var(--text);
}

.project-card__body p {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
  margin-bottom: var(--space-6);
  flex: 1;
}

.project-card__footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
}

/* --- Bloque oscuro: Residencias --- */
.residency-dark {
  background: var(--bg-deep);
  color: var(--on-deep);
  padding-block: var(--space-20);
  margin-block: var(--space-16);
}

.residency-dark__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.residency-dark__tag {
  display: inline-block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #d49339;
  margin-bottom: var(--space-3);
}

.residency-dark h2 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
  color: var(--on-deep);
  margin-bottom: var(--space-4);
}

.residency-dark__lead {
  font-size: var(--fs-base);
  color: var(--on-deep-muted);
  line-height: var(--lh-snug);
  margin-bottom: var(--space-8);
}

.phases-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.phase-card {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  background: #233027;
  padding: var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid #2f3f34;
}

.phase-card__num {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #d49339;
  line-height: 1;
}

.phase-card__content h4 {
  font-size: var(--fs-base);
  color: #ffffff;
  margin-bottom: var(--space-1);
}

.phase-card__content p {
  font-size: var(--fs-sm);
  color: var(--on-deep-muted);
  line-height: var(--lh-snug);
}

.button--sun {
  background: #d49339;
  color: #17211b;
  font-weight: 600;
}

.button--sun:hover {
  background: #e2a44b;
  color: #17211b;
}

.residency-dark__gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.gallery-photo {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.gallery-photo img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out-snappy);
}

.gallery-photo:hover img {
  transform: scale(1.04);
}

.gallery-photo--stagger {
  transform: translateY(-1.5rem);
}

@media (max-width: 900px) {
  .residency-dark__grid {
    grid-template-columns: 1fr;
  }
  .gallery-photo--stagger {
    transform: none;
  }
}


/* ---- projects.css ---- */
/* Layer 4 — projects: records on a ruled ledger, not six identical cards.

   The listing is the most important part of the site, so it gets the density:
   a metadata rail, a body, and one action per record. State is always written
   in words; the marker is decoration, never the only signal. */

@layer components {
  .filter {
    display: none;
    gap: var(--space-3);
    padding: var(--space-4);
    background-color: var(--surface-sunk);
    border: var(--hairline);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
  }

  .js .filter {
    display: grid;
  }

  .filter__label {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .filter__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .filter__chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: 550;
    cursor: pointer;
    transition:
      background-color var(--dur-fast) var(--ease-out-snappy),
      color var(--dur-fast) var(--ease-out-snappy),
      border-color var(--dur-fast) var(--ease-out-snappy),
      transform var(--dur-base) var(--ease-out-snappy);
  }

  .filter__chip:hover {
    border-color: var(--text);
  }

  .filter__chip:active {
    transform: scale(0.97);
  }

  .filter__chip[aria-pressed="true"] {
    background-color: var(--text);
    border-color: var(--text);
    color: var(--bg);
  }

  .filter__count {
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    max-width: none;
  }

  /* --- The ledger of projects --- */
  .projects {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: var(--hairline);
  }

  .projects > li {
    margin: 0;
  }

  .project {
    display: grid;
    gap: var(--space-4);
    padding-block: clamp(1.75rem, 1.2rem + 2vw, 2.75rem);
    border-bottom: var(--hairline);
    align-items: start;
  }

  @media (min-width: 52rem) {
    .project {
      grid-template-columns: 11.5rem minmax(0, 1fr) auto;
      gap: var(--space-8);
    }
  }

  .project__meta {
    display: grid;
    gap: var(--space-2);
    font-size: var(--fs-xs);
    color: var(--text-muted);
  }

  .project__state {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-weight: 600;
    color: var(--text);
    max-width: none;
  }

  .project__state::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border: 1.5px solid var(--accent);
    background-color: var(--accent);
  }

  .project__state--soon::before {
    background-color: transparent;
  }

  .project__place {
    margin: 0;
    max-width: none;
  }

  .project__body {
    display: grid;
    gap: var(--space-3);
  }

  .project h3 {
    font-size: var(--fs-xl);
    letter-spacing: -0.02em;
  }

  .project__body p {
    margin: 0;
    color: var(--text-muted);
    max-width: 54ch;
    font-size: var(--fs-base);
  }

  .project__fits {
    display: grid;
    gap: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }

  .project__fits dt {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  .project__fits dd {
    margin: 0 0 var(--space-2);
    color: var(--text);
  }

  .tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: none;
  }

  .tags li {
    margin: 0;
    padding: 0.2rem var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    background-color: var(--surface);
  }

  .project__action {
    display: grid;
    gap: var(--space-2);
    justify-items: start;
  }

  .project__action .button {
    white-space: nowrap;
  }

  .project__hint {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    margin: 0;
    max-width: 14rem;
  }

  /* --- Empty state: an invitation, and it only exists when JS filters --- */
  .projects__empty {
    display: grid;
    gap: var(--space-4);
    justify-items: start;
    padding: var(--space-10) var(--space-6);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background-color: var(--surface);
  }

  .projects__empty h3 {
    font-size: var(--fs-lg);
  }

  .projects__empty p {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }

  /* --- Featured trio on the home page --- */
  .featured {
    display: grid;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: var(--hairline);
  }

  .featured > li {
    margin: 0;
    border-bottom: var(--hairline);
  }

  .feature {
    display: grid;
    gap: var(--space-3);
    padding-block: var(--space-6);
    color: var(--text);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out-snappy);
  }

  @media (min-width: 44rem) {
    .feature {
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: baseline;
      gap: var(--space-6);
    }
  }

  .feature:hover {
    color: var(--accent-strong);
  }

  .feature h3 {
    font-size: var(--fs-lg);
  }

  .feature p {
    margin: var(--space-2) 0 0;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    max-width: 52ch;
  }

  .feature__state {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
  }

  .feature__mark {
    display: inline-block;
    transition: transform var(--dur-base) var(--ease-out-snappy);
  }

  .feature:hover .feature__mark {
    transform: translateX(0.25rem);
  }
}


/* ---- forms.css ---- */
/* Layer 4 — forms & dialogs.

   One form per project, inside that project's own <dialog>. Labels are always
   visible, errors sit directly under their field, every control is ≥44px, and
   nothing depends on JavaScript to be *readable*: without JS the dialog is
   replaced by a mailto line and the form stays a native <form>. */

@layer tokens {
  :root {
    /* Single status exception to the 5-role palette: error ink.
       6.9:1 on --surface, 6.5:1 on --bg (AA verified). */
    --danger: #8a2f18;
    --danger-tint: #f6e6e1;
  }
}

@layer components {
  .contact-form {
    display: grid;
    gap: var(--space-4);
  }

  .field {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
  }

  .field-row {
    display: grid;
    gap: var(--space-4);
  }

  @media (min-width: 30rem) {
    .field-row {
      grid-template-columns: 1fr 1fr;
    }
  }

  .field label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text);
  }

  .field label .optional {
    font-weight: 400;
    color: var(--text-muted);
  }

  .field input,
  .field select,
  .field textarea {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-base);
    transition:
      border-color var(--dur-fast) var(--ease-out-snappy),
      background-color var(--dur-fast) var(--ease-out-snappy),
      transform var(--dur-base) var(--ease-out-snappy);
  }

  .field textarea {
    min-height: 7.5rem;
    resize: vertical;
    line-height: 1.5;
  }

  .field select {
    padding-right: var(--space-8);
  }

  .field input:hover,
  .field select:hover,
  .field textarea:hover {
    border-color: var(--text);
  }

  .field input:focus-visible,
  .field select:focus-visible,
  .field textarea:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-color: var(--text);
  }

  .field input[aria-invalid="true"],
  .field textarea[aria-invalid="true"],
  .field select[aria-invalid="true"] {
    border-color: var(--danger);
    background-color: var(--danger-tint);
  }

  .field input[disabled],
  .field textarea[disabled],
  .field select[disabled] {
    background-color: var(--surface-sunk);
    color: var(--text-muted);
    cursor: not-allowed;
  }

  .field__hint {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    margin: 0;
    max-width: none;
  }

  .field__error {
    display: flex;
    gap: var(--space-2);
    align-items: baseline;
    margin: 0;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--danger);
    max-width: none;
  }

  .field__error::before {
    content: "!";
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid currentcolor;
    border-radius: 50%;
    font-size: 0.6875rem;
    line-height: 1;
  }

  .field--check {
    gap: var(--space-2);
  }

  .field--check label {
    display: flex;
    align-items: start;
    gap: var(--space-3);
    min-height: 44px;
    padding-block: var(--space-2);
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
  }

  .field--check input {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    min-height: 0;
    margin-top: 0.15rem;
    accent-color: var(--accent);
  }

  .form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
  }

  .form__feedback {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin: 0;
    flex: 1 1 12rem;
    max-width: 32ch;
  }

  .form__feedback[data-state="error"] {
    color: var(--danger);
    font-weight: 600;
  }

  .form__success {
    display: grid;
    gap: var(--space-3);
    justify-items: start;
    padding: var(--space-5);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    background-color: var(--accent-tint);
  }

  .form__success h3 {
    font-size: var(--fs-md);
  }

  .form__success p {
    margin: 0;
    font-size: var(--fs-sm);
    max-width: 44ch;
  }

  /* --- Dialogs: native <dialog>, no focus-trap library --- */
  .dialog {
    width: min(34rem, calc(100vw - 2rem));
    max-height: min(88dvh, 46rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-float);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .dialog[open] {
    animation: dialog-in var(--dur-base) var(--ease-out-snappy);
  }

  .dialog::backdrop {
    background-color: rgb(23 33 27 / 65%);
  }

  @keyframes dialog-in {
    from {
      opacity: 0;
      transform: scale(0.96) translateY(0.375rem);
    }

    to {
      opacity: 1;
      transform: none;
    }
  }

  .dialog__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-5) var(--space-4);
    background-color: var(--surface);
    border-bottom: var(--hairline);
  }

  .dialog__head h2 {
    font-size: var(--fs-lg);
    letter-spacing: -0.02em;
    max-width: 22ch;
  }

  .dialog__head p {
    margin: var(--space-2) 0 0;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    max-width: 34ch;
  }

  .dialog__close {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -0.5rem -0.5rem 0 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition:
      background-color var(--dur-fast) var(--ease-out-snappy),
      transform var(--dur-base) var(--ease-out-snappy);
  }

  .dialog__close:hover {
    background-color: var(--surface-sunk);
  }

  .dialog__close:active {
    transform: scale(0.94);
  }

  .dialog__body {
    padding: var(--space-5);
    display: grid;
    gap: var(--space-4);
  }

  .dialog__body .contact-form {
    gap: var(--space-4);
  }

  /* Without JS: no dialog buttons, no fake form. A real mailto line instead. */
  .js .nojs-only {
    display: none;
  }

  .nojs-only {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding: var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    color: var(--text-muted);
  }

  .js-only {
    display: none;
  }

  .js .js-only {
    display: inline-flex;
  }
}


/* ---- footer.css ---- */
/* Layer 4 — footer: granite ground. Semantic nav columns, real contact,
   no badge soup, no decorative license text we cannot verify. */

@layer components {
  .site-footer {
    background-color: var(--bg-deep);
    color: var(--on-deep);
    padding-block: clamp(3rem, 2rem + 4vw, 4.5rem) var(--space-8);
  }

  .site-footer a:not(.button) {
    color: var(--on-deep);
    text-decoration-color: rgb(233 238 228 / 40%);
    text-underline-offset: 0.2em;
  }

  .site-footer a:not(.button):hover {
    color: var(--accent-on-deep);
    text-decoration-color: currentcolor;
  }

  .site-footer :focus-visible {
    outline-color: var(--focus-on-deep);
  }

  .site-footer__grid {
    display: grid;
    gap: var(--space-10);
  }

  @media (min-width: 48rem) {
    .site-footer__grid {
      grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--space-8);
    }
  }

  .site-footer__brand {
    display: grid;
    gap: var(--space-3);
    align-content: start;
    max-width: 34ch;
  }

  .site-footer__word {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
  }

  .site-footer__brand p {
    font-size: var(--fs-sm);
    color: var(--on-deep-muted);
    margin: 0;
  }

  .site-footer__col h2 {
    font-family: var(--font-body);
    font-size: var(--fs-2xs);
    font-weight: 650;
    letter-spacing: 0.06em;
    color: var(--on-deep-muted);
    margin: 0 0 var(--space-3);
  }

  .site-footer__col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
    max-width: none;
  }

  .site-footer__col li {
    margin: 0;
  }

  .site-footer__col a,
  .site-footer__col address a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    font-size: var(--fs-sm);
    font-style: normal;
  }

  .site-footer__col address {
    font-style: normal;
    font-size: var(--fs-sm);
    color: var(--on-deep-muted);
    line-height: var(--lh-snug);
  }

  .site-footer__legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3) var(--space-6);
    margin-top: var(--space-10);
    padding-top: var(--space-5);
    border-top: 1px solid rgb(233 238 228 / 22%);
    font-size: var(--fs-2xs);
    color: var(--on-deep-muted);
  }

  .site-footer__legal p {
    margin: 0;
    max-width: none;
  }

  .site-footer__legal ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: none;
  }

  .site-footer__legal li {
    margin: 0;
  }

  .site-footer__legal a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
  }
}
