/* ==========================================================================
   COMPONENTS: reusable building blocks.
   Order: layout helpers, header, buttons, type helpers, weave, tiles,
          chips, forms, marquee, placeholders, media, overlays, footer, reveal.
   ========================================================================== */

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section); }

/* ---------- Header and navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-header);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}
.site-header.is-scrolled {
  background: var(--white);
  box-shadow: 0 1px 0 rgb(32 42 45 / 0.08);
}

/* Logo sits on a white pill so it reads on photographs and dark teal */
.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 0.55rem 1.3rem;
  background: var(--white);
  border-radius: var(--radius-pill);
}
.brand img { width: auto; height: 2.4rem; }

.nav__list { display: flex; align-items: center; gap: var(--space-1); }
.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding-inline: 1.1rem;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  border-radius: var(--radius-pill);
}
.nav__link:hover { background: rgb(255 255 255 / 0.14); }
.nav__link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 3px;
  text-underline-offset: 8px;
}
.nav__cta { margin-left: var(--space-2); }

.menu-toggle {
  position: relative;
  z-index: 2;
  display: none;
  min-height: var(--touch);
  padding-inline: 1.25rem;
  background: rgb(3 47 51 / 0.72);
  color: var(--white);
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: var(--radius-pill);
  font-weight: 700;
}

/* Desktop: glass pill navigation */
@media (min-width: 62em) {
  .nav {
    display: flex;
    align-items: center;
    padding: var(--space-2);
    color: var(--white);
    background: rgb(3 47 51 / 0.72);
    border: 1px solid rgb(255 255 255 / 0.25);
    border-radius: var(--radius-pill);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .site-header.is-scrolled .nav {
    color: var(--ink);
    background: transparent;
    border-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .site-header.is-scrolled .nav__link:hover { background: var(--pale); }
}

/* Mobile: full-screen scrollable menu. No backdrop-filter on the header
   (it would trap this fixed panel inside the header's box). */
@media (max-width: 61.99em) {
  .menu-toggle { display: inline-flex; align-items: center; }
  .site-header.is-scrolled .menu-toggle { background: var(--teal-800); }
  .nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: none;
    flex-direction: column;
    gap: var(--space-5);
    padding: calc(var(--header-h) + var(--space-5)) var(--gutter) var(--space-7);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--teal-900);
    color: var(--white);
  }
  .nav.is-open { display: flex; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__link {
    display: flex;
    min-height: 3.5rem;
    padding-inline: 0;
    font-size: 1.6rem;
    font-weight: 700;
    border-bottom: 1px solid var(--line-on-dark);
    border-radius: 0;
  }
  .nav__cta { margin: 0; align-self: flex-start; }
  body.menu-open .site-header { background: transparent; box-shadow: none; }
  body.menu-open .menu-toggle { background: rgb(255 255 255 / 0.12); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0.95rem 2rem;
  font-weight: 800;
  font-size: var(--fs-base);
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  transform: translate(var(--mx, 0), var(--my, 0));
  transition: transform 0.25s var(--ease), background-color 0.2s, color 0.2s;
}
.btn:hover { transform: translate(var(--mx, 0), calc(var(--my, 0px) - 2px)); }
.btn--gold    { background: var(--gold); color: var(--ink); }
.btn--teal    { background: var(--teal-700); color: var(--white); }
.btn--dark    { background: var(--ink); color: var(--white); }
.btn--outline { border-color: var(--teal-700); color: var(--teal-700); }
.btn--outline-light { border-color: var(--white); color: var(--white); }
.btn--sm { padding: 0.65rem 1.4rem; font-size: var(--fs-sm); }
.btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

/* ---------- Type helpers ---------- */
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--teal-700);
}
.on-dark .eyebrow, .eyebrow--gold { color: var(--gold); }

/* Light-weight headline with a bold emphasis word: the site's signature */
.display {
  font-weight: 200;
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
}
.display b { font-weight: 800; }
.display--xl { font-size: var(--fs-display); }
.display--h1 { font-size: var(--fs-h1); }
.display--h2 { font-size: var(--fs-h2); }

.lead { font-size: var(--fs-lead); line-height: 1.55; max-width: 38rem; }
.statement { font-size: var(--fs-statement); line-height: 1.12; letter-spacing: var(--tracking-heading); }

/* ---------- Woven pattern ---------- */
.weave-band { height: 5rem; background: var(--weave-band); }
.weave-strip { height: 6.5rem; }
.weave--1 { background-image: var(--weave-1); }
.weave--2 { background-image: var(--weave-2); }
.weave--3 { background-image: var(--weave-3); }
.weave--4 { background-image: var(--weave-4); }

/* ---------- Tiles (the bento building block) ---------- */
.tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: clamp(1.5rem, 3vw, 2.75rem);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.tile--flush { padding: 0; gap: 0; }
.tile--gold { background: var(--gold); color: var(--ink); }
.tile--dark { background: var(--ink); color: var(--white); }
.tile--teal { background: var(--teal-800); color: var(--white); }
.tile--between { justify-content: space-between; }
.tile__stack { display: flex; flex-direction: column; gap: var(--space-3); }
.tile--gold .eyebrow { color: var(--ink); }
.tile--dark .eyebrow, .tile--teal .eyebrow { color: var(--gold); }
.contents { display: contents; }
.tile__body { display: flex; flex-direction: column; gap: var(--space-3); padding: clamp(1.25rem, 2.5vw, 2rem); flex: 1; }
.tile__title { font-size: var(--fs-h3); line-height: 1.1; color: var(--heading); }
.tile--dark .tile__title, .tile--teal .tile__title { color: var(--white); }
.tile__num { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.12em; color: var(--heading); }

/* Pill-shaped link used for "documented work" references */
.tag-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.5rem 1.1rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  background: var(--pale);
  border-radius: var(--radius-pill);
}
.tag-link:hover { background: var(--teal-700); color: var(--white); }

/* ---------- Filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  min-height: var(--touch);
  padding: 0.5rem 1.4rem;
  font-weight: 600;
  background: transparent;
  color: var(--teal-700);
  border: 2px solid var(--teal-700);
  border-radius: var(--radius-pill);
}
.chip[aria-pressed="true"] { background: var(--teal-700); color: var(--white); font-weight: 700; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field label { font-size: var(--fs-sm); font-weight: 700; color: var(--teal-700); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.9rem 1.1rem;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--teal-700);
  border-radius: var(--radius-sm);
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #b00020; }
.field__error { min-height: 1.4em; font-size: var(--fs-sm); line-height: 1.4; color: #b00020; }
.tile--dark .field label { color: var(--white); }
.tile--dark .field__error { color: #ffb4b4; }
.form-status { padding: var(--space-3) var(--space-4); font-weight: 600; border-radius: var(--radius-sm); background: var(--pale); color: var(--teal-800); }
.form-status[hidden] { display: none; }
.form-status.is-error { background: #fde8ea; color: #7a0014; }
.hp { position: absolute; left: -9999px; }   /* honeypot field for bots */

/* ---------- Marquee (pure CSS; second copy is aria-hidden) ---------- */
.marquee { overflow: hidden; background: var(--gold); color: var(--ink); white-space: nowrap; }
.marquee__track { display: inline-flex; animation: marquee 38s linear infinite; }
.marquee__group { display: inline-flex; flex-shrink: 0; }
.marquee__item { padding: 1.1rem 1.6rem; font-size: clamp(1.4rem, 1rem + 1.6vw, 2.2rem); font-weight: 800; letter-spacing: -0.01em; }
.marquee__item::after { content: "\2726"; margin-left: 3.2rem; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Placeholders: honest "to be supplied" markers ---------- */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  text-align: center;
  font-weight: 600;
  color: var(--teal-700);
  background: var(--pale);
  border: 2px dashed var(--teal-700);
  border-radius: var(--radius-md);
}
.tile--dark .placeholder, .tile--teal .placeholder { color: var(--white); background: transparent; border-color: var(--white); }
.pending {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  font-size: var(--fs-sm);
  color: var(--teal-700);
  border: 1px dashed currentColor;
}
.tile--dark .pending, .tile--teal .pending { color: var(--gold); }
.tile--gold .pending { color: var(--ink); }

/* ---------- Media ---------- */
.media { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-lg); }
.tile--flush > .media { flex: 1; min-height: 18rem; border-radius: 0; }
.arch { border-radius: 999px 999px var(--radius-md) var(--radius-md); }

/* ---------- Page transition curtain and first-visit loader ---------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: var(--z-curtain);
  background: var(--weave-band) var(--teal-700);
  pointer-events: none;
  visibility: hidden;
  transform: translateY(100%);
  transition: transform 0.5s var(--ease);
}
.curtain.is-covering { visibility: visible; transform: translateY(0); pointer-events: all; }
html.is-arriving .curtain { visibility: visible; transform: translateY(0); transition: none; }
html.is-arriving.is-arrived .curtain { transform: translateY(-100%); transition: transform 0.6s var(--ease); }

.loader {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-curtain) + 2);
  display: none;
  place-items: center;
  background: var(--teal-900);
  transition: opacity 0.5s, visibility 0.5s;
}
html.is-first .loader { display: grid; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark { padding: 1rem 2rem; background: var(--white); border-radius: var(--radius-pill); animation: loader-in 0.7s var(--ease) both; }
.loader__mark img { width: auto; height: 3rem; }
@keyframes loader-in { from { opacity: 0; transform: scale(0.92); } }

/* ---------- Lightbox ---------- */
.lightbox {
  width: min(96vw, 1200px);
  max-height: 94vh;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--white);
}
.lightbox::backdrop { background: rgb(3 47 51 / 0.92); }
.lightbox__img { width: auto; max-width: 100%; max-height: 80vh; margin-inline: auto; border-radius: var(--radius-md); }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding-top: var(--space-3); }
.lightbox__btn { min-height: var(--touch); min-width: var(--touch); padding-inline: 1.1rem; font-weight: 700; color: var(--white); background: rgb(255 255 255 / 0.14); border: 1px solid rgb(255 255 255 / 0.4); border-radius: var(--radius-pill); }

/* ---------- Footer ---------- */
.site-footer { background: var(--teal-900); color: var(--white); font-size: var(--fs-sm); }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-5) var(--space-7); padding-block: var(--space-7); }
.site-footer__col { display: flex; flex-direction: column; gap: var(--space-2); min-width: 12rem; }
.site-footer__title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--gold); }
.site-footer a { display: inline-flex; align-items: center; min-height: var(--touch); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-5); border-top: 1px solid var(--line-on-dark); }

/* ---------- Reveal on scroll (only when JS is running) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(1.75rem); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); transition-delay: var(--delay, 0s); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
}

.lightbox__caption { margin: 0; font-weight: 600; }
