:root {
  --folio-rail: 100rem;
  --folio-gutter: clamp(1rem, 4vw, 4.5rem);
  --folio-edge: max(var(--folio-gutter), calc((100% - var(--folio-rail)) / 2));
}
html { scrollbar-gutter: stable; }
header .brand, .mast .wordmark {
  font: 900 24px/1 Arial, Helvetica, sans-serif;
  letter-spacing: -1.4px;
  white-space: nowrap;
  text-decoration: none;
}
header .brand span, .mast .wordmark span { font-weight: 400; }
@media (max-width: 700px) {
  header .brand, .mast .wordmark { font-size: 26px; letter-spacing: -1.2px; }
}

.detail-view > header, .detail-view main > :is(.section, .project-page),
.detail-view > :is(#contacto, footer) { padding-inline: var(--folio-edge); }
.detail-view > header nav { flex-wrap: wrap; }
@media (max-width: 700px) {
  .detail-view > header nav { display: flex; padding-right: 0; gap: .1rem .85rem; }
  .detail-view > header .language-switch { right: var(--folio-gutter); }
}

.portfolio-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portfolio-footer > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer-signature {
  justify-content: center;
  min-width: 44px;
}
.footer-signature img { display: block; }

.nav-budget-short { display: none; }
@media (max-width: 700px) {
  body > header nav:has([data-nav="presupuesto"]) {
    display: grid;
    grid-template-columns: auto auto auto auto;
    align-items: stretch;
    width: 100%;
    justify-content: stretch;
    gap: clamp(.4rem, 2vw, .85rem);
    margin-top: 1.1rem;
    padding-inline: 0;
  }
  body > header nav > a[data-nav] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .4rem .15rem;
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--ink);
    font-size: .875rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    background: transparent;
  }
  body > header nav > a[data-nav="presupuesto"] { background: transparent; border-color: #24204470; font-weight: 700; }
  body > header nav > a[aria-current="page"] { text-decoration: underline; text-underline-offset: .25em; }
  .nav-budget-full { display: none; }
  .nav-budget-short { display: inline; }
}

header .brand, .mast .wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
header .brand img, .mast .wordmark img {
  display: block;
  width: clamp(145px, 13vw, 192px);
  height: auto;
}
@media (min-width: 701px) {
  body > header nav > a[data-nav] {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    padding-inline: .4rem;
  }
}
@media (max-width: 700px) {
  body > header:has(> .brand) {
    display: grid;
    grid-template-columns: auto auto auto auto;
    grid-template-rows: 44px auto;
    gap: .25rem .1rem;
    align-items: center;
  }
  body > header > .brand { grid-column: 1 / 3; grid-row: 1; justify-self: start; }
  body > header nav:has([data-nav="presupuesto"]) { display: contents; }
  body > header nav > a[data-nav] { grid-row: 2; font-weight: 600; }
  body > header nav .language-switch {
    position: static;
    grid-row: 1;
    grid-column: 3 / 5;
    justify-self: end;
    align-self: center;
    margin: 0;
  }
}
.cinematic-hero .hero-motion:not(:focus-visible) {
  opacity: 0;
  pointer-events: none;
}

/* Keep portfolio indexes on the same content rail as their header. */
:is(#view-video, #view-fotografia) > :is(.view-heading, .section) {
  padding-inline: var(--folio-edge);
}
/* The planner mast uses dark ink as its background. Preserve the signature alpha. */
.mast .wordmark img {
  filter: brightness(0) invert(1);
  max-width: 100%;
}

/* The same outer band, content edges and navigation on both sides of the quote link. */
body > header#site-mast.site-mast {
  position: relative; inset: auto;
  box-sizing: border-box; width: 100%; max-width: none; margin: 0;
  padding: 0 var(--folio-edge); height: 76px; min-height: 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: nowrap; gap: 14px;
  border: 0; background: #242044; color: #f5f1eb;
  font: 600 16px/1.15 Arial, Helvetica, sans-serif;
}
#site-mast.site-mast .brand { display: flex; align-items: center; flex: none; height: 44px; margin: 0; padding: 0; }
#site-mast.site-mast .brand img { width: clamp(145px, 13vw, 192px); height: auto; display: block; filter: brightness(0) invert(1); }
#site-mast.site-mast nav {
  display: flex; position: static; flex-wrap: nowrap; align-items: center;
  justify-content: flex-end; width: auto; margin: 0; padding: 0; gap: clamp(8px,1.5vw,24px);
}
#site-mast.site-mast nav > a[data-nav] {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  color: #f5f1eb; background: transparent; border: 0; padding: 0 2px;
  margin: 0; min-height: 44px; font: 600 16px/1.15 Arial, Helvetica, sans-serif;
  text-shadow: none; text-decoration: none; white-space: nowrap;
}
#site-mast.site-mast nav > a[data-nav]:is(:hover,[aria-current="page"]) {
  text-decoration: underline; text-decoration-color: #ffc095; text-underline-offset: .4em;
}
#site-mast.site-mast .language-switch { display: flex; align-items:center; position: static; margin:0; gap:4px; padding:0; }
#site-mast.site-mast .portfolio-nav .language-switch a {
  box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center; width:38px; height:36px; padding:0; margin:0;
  border:1px solid #a9a4b9 !important; border-radius:4px; font:600 13px/1 Arial,Helvetica,sans-serif;
  color:#f5f1eb; background:transparent; text-decoration:none;
}
#site-mast.site-mast .portfolio-nav .language-switch a[aria-current] { background:#f5f1eb; color:#242044; }
#site-mast.site-mast a:focus-visible { outline:2px solid #ffc095; outline-offset:2px; }
@media(max-width:900px) {
  #site-mast .nav-budget-full {display:none}
  #site-mast .nav-budget-short {display:inline}
}
@media(max-width:700px) {
  body > header#site-mast.site-mast {
    height:104px; padding-block:6px; display:grid; grid-template-columns:auto auto auto auto;
    grid-template-rows:44px 44px; align-items:center; justify-content:stretch; gap:4px 2px;
  }
  #site-mast.site-mast nav {display:contents}
  #site-mast .brand {grid-area:1 / 1 / 2 / 3;justify-self:start}
  #site-mast.site-mast .language-switch {grid-area:1 / 3 / 2 / 5;justify-self:end}
  #site-mast.site-mast nav > a[data-nav] {grid-row:2;font-size:clamp(12px,3.5vw,15px);padding:0}
}
