/* ==========================================================================
   Cartagena Companions — core stylesheet
   Brand tokens are taken 1:1 from the existing WordPress (Scent) theme.
   ========================================================================== */

html,
body {
  touch-action: pan-x pan-y;
}

/* ---------- Fonts (self-hosted, same files as the live theme) ---------- */
@font-face {
  font-family: "Oranienbaum";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/oranienbaum-400.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/pt-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "PT Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/pt-sans-700.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  /* Brand palette (theme.json presets of the live site) */
  --base: #181818;        /* page background        (base)      */
  --black: #000000;       /* deep sections          (accent-2)  */
  --surface: #252525;     /* raised surfaces        (accent-5)  */
  --line: #363636;        /* hairlines              (accent-3)  */
  --primary: #e8e8e8;     /* off-white accent — client brand is black & white */
  --on-primary: #181818;  /* text on primary fills */
  --heading: #ffffff;     /* headings / links       (accent-4)  */
  --text: #999999;        /* body copy              (contrast)  */
  --veil: #ffffff3b;      /* translucent white      (accent-6)  */

  --font-display: "Oranienbaum", "Times New Roman", serif;
  --font-body: "PT Sans", "Helvetica Neue", Arial, sans-serif;

  --fs-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --fs-small: 0.875rem;
  --fs-label: 0.75rem;
  --fs-h3: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
  --fs-h2: clamp(2.25rem, 1.5rem + 3vw, 4.5rem);
  --fs-display: clamp(3rem, 1.6rem + 6vw, 7.5rem);

  --gutter: clamp(1rem, 0.4rem + 3vw, 3rem);
  --wide: 1340px;           /* matches theme wide-size */
  --content: 645px;         /* matches theme content-size */
  --section: clamp(4.5rem, 3rem + 7vw, 10rem);

  --header-h: 88px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background-color: var(--base);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

img, video { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
button { font: inherit; color: inherit; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-wrap: balance;
}
p { text-wrap: pretty; }

a { color: var(--heading); text-decoration: none; transition: color 0.3s var(--ease); }
a:hover { color: var(--text); }

:focus-visible {
  outline: 1px solid var(--heading);
  outline-offset: 4px;
}

::selection { background: var(--primary); color: var(--on-primary); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--heading);
  color: var(--base);
  font-size: var(--fs-small);
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease);
}
.skip-link:focus { transform: none; color: var(--base); }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: calc(var(--wide) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section); }
.section--black { background: var(--black); }
.section--flush-top { padding-top: 0; }

/* ---------- Typographic components ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.24em;
  line-height: 1.4;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background: var(--primary);
  flex: none;
}
.eyebrow--plain::before { display: none; }
.eyebrow--light { color: var(--heading); }

.display {
  font-size: var(--fs-display);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.h2 { font-size: var(--fs-h2); line-height: 1; }
.h3 { font-size: var(--fs-h3); line-height: 1.1; }

.lead {
  color: var(--heading);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.05rem + 1.1vw, 2.1rem);
  line-height: 1.3;
}
.muted { color: var(--text); }
.prose p + p { margin-top: 1.1em; }
.prose { max-width: 38rem; }

.index-num {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  font-variant-numeric: lining-nums tabular-nums;
}

.rule {
  display: block;
  width: 100%;
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--line);
}

/* ---------- Buttons (mirror the live homepage buttons) ---------- */
.btn {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-primary);
  --btn-border: var(--primary);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0.85rem 2rem;
  border: 1px solid var(--btn-border);
  border-radius: 0;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.btn:hover { --btn-bg: transparent; --btn-fg: var(--heading); color: var(--heading); }
.btn--outline { --btn-bg: transparent; --btn-fg: var(--heading); --btn-border: var(--veil); }
.btn--outline:hover { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-border: var(--primary); color: var(--on-primary); }
.btn--ghost { --btn-bg: transparent; --btn-border: var(--veil); }
.btn--ghost:hover { --btn-bg: transparent; --btn-fg: var(--heading); --btn-border: var(--heading); color: var(--heading); }
.btn--sm { min-height: 2.6rem; padding: 0.6rem 1.25rem; font-size: 0.75rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--heading);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.link-arrow svg { width: 2.25rem; height: 0.7rem; flex: none; transition: transform 0.5s var(--ease-out); }
.link-arrow:hover svg { transform: translateX(0.5rem); }
.link-arrow:hover { color: var(--heading); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background-color 0.5s var(--ease), border-color 0.5s var(--ease), transform 0.5s var(--ease);
  background: transparent;
  border-bottom: 1px solid transparent;
}
/* Premium black band that fades into the imagery below instead of a hard edge.
   Solid behind the logo/nav, then dissolves ~64px beyond the header. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  z-index: -1;
  height: calc(100% + 96px);
  /* eased scrim: dense where the nav sits, then a long, smooth falloff */
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.86) 28%,
    rgba(0, 0, 0, 0.74) 42%,
    rgba(0, 0, 0, 0.57) 54%,
    rgba(0, 0, 0, 0.39) 65%,
    rgba(0, 0, 0, 0.23) 76%,
    rgba(0, 0, 0, 0.10) 87%,
    rgba(0, 0, 0, 0.03) 95%,
    rgba(0, 0, 0, 0) 100%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.site-header.is-solid,
.site-header.is-scrolled { background: transparent; }
.site-header.is-solid::before,
.site-header.is-scrolled::before { opacity: 1; }
.site-header.is-hidden { transform: translateY(calc(-100% - 100px)); } /* clears the fade tail too */

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  height: var(--header-h);
  transition: height 0.5s var(--ease);
}
.site-header.is-scrolled .site-header__inner { height: 72px; }

.brand { display: block; flex: none; line-height: 0; }
/* Transparent logo (images/brand/logo.png) — sized by height, width follows. */
.brand img {
  width: auto;
  height: 64px;
  transition: height 0.5s var(--ease);
}
.site-header.is-scrolled .brand img { height: 52px; }

.primary-nav { display: flex; align-items: center; gap: clamp(1.5rem, 3vw, 3rem); }
.primary-nav__list { display: flex; align-items: center; gap: clamp(1.5rem, 3vw, 2.75rem); }
.primary-nav__link {
  position: relative;
  display: inline-block;
  padding-block: 0.5rem;
  color: var(--heading);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.primary-nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0.2rem;
  height: 1px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}
.primary-nav__link:hover { color: var(--heading); }
.primary-nav__link:hover::after,
.primary-nav__link[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

/* Menu toggle (mobile) */
.menu-toggle {
  display: none;
  position: relative;
  z-index: 120;
  align-items: center;
  gap: 0.85rem;
  min-height: 44px;
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--heading);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
}
.menu-toggle__bars { position: relative; width: 28px; height: 10px; }
.menu-toggle__bars::before,
.menu-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: currentColor;
  transition: transform 0.45s var(--ease-out), top 0.45s var(--ease-out);
}
.menu-toggle__bars::before { top: 0; }
.menu-toggle__bars::after { top: 9px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { top: 5px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { top: 5px; transform: rotate(-45deg); }
.menu-toggle__label-close { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__label-open { display: none; }
.menu-toggle[aria-expanded="true"] .menu-toggle__label-close { display: inline; }

/* Full-screen mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 2rem;
  background: var(--base);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s var(--ease), visibility 0s linear 0.5s;
  overflow-y: auto;
}
.mobile-menu.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.5s var(--ease), visibility 0s;
}
.mobile-menu > nav { margin-block: auto; }
.mobile-menu__list { display: grid; gap: 0.25rem; }
.mobile-menu__item {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.mobile-menu.is-open .mobile-menu__item { opacity: 1; transform: none; }
.mobile-menu.is-open .mobile-menu__item:nth-child(2) { transition-delay: 0.07s; }
.mobile-menu.is-open .mobile-menu__item:nth-child(3) { transition-delay: 0.14s; }
.mobile-menu.is-open .mobile-menu__item:nth-child(4) { transition-delay: 0.21s; }
.mobile-menu__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--heading);
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.2rem + 5vw, 3.25rem);
  line-height: 1.05;
}
.mobile-menu__link .index-num { font-size: 0.875rem; }
.mobile-menu__link[aria-current="page"] { color: var(--primary); }
.mobile-menu__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  font-size: var(--fs-label);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.mobile-menu__foot a { color: var(--text); }
.mobile-menu__foot a:hover { color: var(--heading); }

/* ==========================================================================
   Page hero (inner pages)
   ========================================================================== */
.page-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  max-height: 1100px;
  overflow: hidden;
  background: var(--black);
  isolation: isolate;
}
.page-hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.page-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 2.4s var(--ease-out);
}
.is-loaded .page-hero__media img { transform: scale(1); }
.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.76) 7%,
      rgba(0, 0, 0, 0.56) 14%,
      rgba(0, 0, 0, 0.36) 21%,
      rgba(0, 0, 0, 0.22) 28%,
      rgba(0, 0, 0, 0.11) 35%,
      rgba(0, 0, 0, 0.04) 42%,
      rgba(0, 0, 0, 0) 48%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 65%),
    linear-gradient(0deg, rgba(24, 24, 24, 1) 0%, rgba(24, 24, 24, 0.7) 32%, rgba(0, 0, 0, 0.15) 70%);
}
.page-hero__content {
  width: 100%;
  padding-bottom: clamp(3rem, 2rem + 5vw, 7rem);
}
.page-hero__title { margin-top: 1.5rem; }
.page-hero__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-top: clamp(1.75rem, 1rem + 2vw, 3rem);
}
.page-hero__sub {
  max-width: 30rem;
  color: var(--heading);
  opacity: 0.85;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
  line-height: 1.55;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: var(--heading);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 3.5rem;
  overflow: hidden;
  background: var(--veil);
}
.scroll-cue__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--heading);
  transform: translateY(-100%);
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue {
  0% { transform: translateY(-100%); }
  55% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ==========================================================================
   Image treatment shared by editorial imagery
   ========================================================================== */
.frame {
  position: relative;
  overflow: hidden;
  background: var(--surface);
}
.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
  filter: saturate(0.88) contrast(1.03);
  transition: transform 1.2s var(--ease-out), filter 1.2s var(--ease-out);
}
.frame--portrait { aspect-ratio: 4 / 5; }
.frame--tall { aspect-ratio: 3 / 4; }
.frame--square { aspect-ratio: 1 / 1; }
.frame--landscape { aspect-ratio: 3 / 2; }
.frame--wide { aspect-ratio: 16 / 9; }

.caption {
  margin-top: 0.9rem;
  color: var(--text);
  font-size: var(--fs-small);
  line-height: 1.5;
}

/* ==========================================================================
   Closing CTA band + footer
   ========================================================================== */
.cta-band {
  position: relative;
  padding-block: var(--section);
  border-top: 1px solid var(--line);
  text-align: center;
}
.cta-band__title { max-width: 22ch; margin: 1.5rem auto 0; }
.cta-band .btn-row { justify-content: center; margin-top: 2.5rem; }

.site-footer {
  padding-block: clamp(3rem, 2rem + 3vw, 5rem) 2rem;
  border-top: 1px solid var(--line);
  background: var(--black);
}
.site-footer__top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem 3rem;
}
.site-footer__brand img { width: auto; height: 72px; }
.site-footer__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem 2.5rem; }
.site-footer__nav a,
.site-footer__social a {
  color: var(--heading);
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.site-footer__nav a:hover,
.site-footer__social a:hover { color: var(--text); }
.site-footer__social { display: flex; gap: 1.75rem; }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2.5rem, 2rem + 2vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ==========================================================================
   Scroll reveal — only active once js/main.js confirms the observer is running
   (html.reveal-armed). Without it, everything simply shows.
   ========================================================================== */
.reveal-armed [data-reveal]:not([data-reveal="image"]) {
  transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.reveal-armed [data-reveal]:not(.is-visible):not([data-reveal="image"]) {
  opacity: 0;
  transform: translateY(32px);
}

/* Image reveal: clip the <img>, never the observed element itself. */
.reveal-armed [data-reveal="image"] img {
  transition: clip-path 1.4s var(--ease-out), transform 1.6s var(--ease-out), filter 1.2s var(--ease-out);
  transition-delay: var(--delay, 0s);
}
.reveal-armed [data-reveal="image"]:not(.is-visible) img {
  clip-path: inset(0 0 100% 0);
  transform: scale(1.12);
}

@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;
    transition-delay: 0s !important;
  }
}
