/* ==========================================================================
   AL MOIN GROUP — LAYOUT
   Containers, sections, header, footer, page heroes, editorial grids.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CONTAINER — layout.md §4
   -------------------------------------------------------------------------- */
.container {
  width: min(100% - (2 * var(--page-gutter)), var(--container-width));
  margin-inline: auto;
}

.container--wide {
  width: min(100% - (2 * var(--page-gutter)), var(--container-wide));
}

.container--reading {
  width: min(100% - (2 * var(--page-gutter)), var(--container-reading));
}

/* --------------------------------------------------------------------------
   SECTIONS — layout.md §6
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--section-space);
}

.section--tight {
  padding-block: var(--section-space-sm);
}

.section--ivory {
  background-color: var(--surface-ivory);
}

.section--white {
  background-color: var(--surface-white);
}

.section--mist {
  background-color: var(--surface-mist);
}

.section--sage {
  background-color: var(--surface-sage);
}

.section--dark {
  background-color: var(--dark-background);
  color: var(--dark-text-primary);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--dark-text-primary);
}

/* Dark sections keep the ivory page background visible at the edges. */
.section--dark .container {
  position: relative;
}

.section--dark::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 12% 0%, var(--scrim-forest-28) 0%, transparent 58%),
    radial-gradient(90% 80% at 92% 100%, var(--scrim-champagne-12) 0%, transparent 60%);
  pointer-events: none;
}

.section--dark > * {
  position: relative;
  z-index: 1;
}

.section-head {
  max-width: 44rem;
  margin-bottom: var(--space-12);
}

.section-head--split {
  display: grid;
  gap: var(--space-8);
  max-width: none;
  align-items: end;
}

@media (min-width: 900px) {
  .section-head--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
    gap: var(--space-12);
  }
}

.section-head__title {
  margin-top: var(--space-3);
}

.section-head__lead {
  margin-top: var(--space-4);
  color: var(--color-text-secondary);
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
}

.section--dark .section-head__lead,
.section-head__lead--on-dark {
  color: var(--dark-text-secondary);
}

.eyebrow {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.eyebrow--accent {
  color: var(--color-accent);
}

.eyebrow--on-dark {
  color: var(--dark-text-tertiary);
}

.lead {
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

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

/* --------------------------------------------------------------------------
   GRIDS
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.split {
  display: grid;
  gap: var(--space-12);
  align-items: start;
}

.split--sticky > :first-child {
  position: sticky;
  top: calc(var(--header-height) + var(--space-8));
}

/* --------------------------------------------------------------------------
   HEADER — layout.md §10

   The masthead is driven by four custom properties so the same markup can be
   rendered over the dark opening screen of the homepage and on the standard
   ivory masthead used everywhere else:

     --header-bg          background of the bar
     --header-line        colour of the hairline under the bar
     --header-fg          primary text colour
     --header-fg-muted    secondary text colour
     --header-underline   colour of the navigation indicator
   -------------------------------------------------------------------------- */
.site-header {
  --header-bg: var(--glass-ivory-90);
  --header-line: transparent;
  --header-fg: var(--color-text);
  --header-fg-muted: var(--color-text-secondary);
  --header-underline: var(--brand-jade);

  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--header-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--header-line);
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.site-header.is-scrolled {
  --header-bg: var(--glass-ivory-97);
  --header-line: var(--color-border);
}

/* Homepage opening screen — the masthead floats over the dark hero.
   Selector carries `.site-header` so it outranks the `.is-scrolled` rule
   above, and the state is driven by `.is-solid` instead. */
.site-header.site-header--overlay {
  --header-bg: transparent;
  --header-line: transparent;
  --header-fg: var(--dark-text-primary);
  --header-fg-muted: var(--dark-text-tertiary);
  --header-underline: var(--brand-champagne);

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  /* Pulls the hero up underneath the bar so the first screen is one field. */
  margin-bottom: calc(-1 * var(--header-height));
}

.site-header.site-header--overlay.is-solid {
  --header-bg: var(--glass-ivory-97);
  --header-line: var(--color-border);
  --header-fg: var(--color-text);
  --header-fg-muted: var(--color-text-secondary);
  --header-underline: var(--brand-jade);

  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: var(--header-height);
}

/* Scroll progress — a restrained indicator along the foot of the bar. */
.site-header__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.site-header__progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--brand-champagne);
  transform-origin: left;
}

/* Brand lockup ---------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--header-fg);
  flex-shrink: 0;
}

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

.brand__mark {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand__mark__light,
.brand__mark__dark {
  display: block;
}

.brand__mark__light {
  display: none;
}

.site-header--overlay:not(.is-solid) .brand__mark__light {
  display: block;
}

.site-header--overlay:not(.is-solid) .brand__mark__dark {
  display: none;
}

.brand__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand__name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  color: var(--header-fg);
  white-space: nowrap;
  transition: color var(--duration-base) var(--ease-out);
}

.brand__tag {
  color: var(--header-fg-muted);
  font-size: 0.6875rem;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--duration-base) var(--ease-out);
}

/* Primary navigation --------------------------------------------------- */
.primary-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.primary-nav__link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-block: var(--space-2);
  color: var(--header-fg);
  font-size: 0.9375rem;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  transition: color var(--duration-base) var(--ease-out);
}

.primary-nav__index {
  display: none;
}

.primary-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background-color: var(--header-underline);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}

.primary-nav__link:hover::after,
.primary-nav__link:focus-visible::after {
  transform: scaleX(1);
}

.primary-nav__link.is-active {
  color: var(--header-fg);
}

.primary-nav__link.is-active::after {
  transform: scaleX(1);
  background-color: var(--brand-champagne);
}

/* Mobile panel — only rendered inside the collapsed navigation. */
.primary-nav__panel {
  display: none;
}

.primary-nav__panel-note {
  max-width: 36ch;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
  line-height: var(--leading-relaxed);
}

.primary-nav__panel-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.primary-nav__email {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.primary-nav__email:hover {
  color: var(--brand-jade);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

/* Mobile toggle -------------------------------------------------------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-1);
  color: var(--header-fg);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.nav-toggle__icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 10px;
}

.nav-toggle__icon span {
  display: block;
  height: 1.5px;
  width: 100%;
  background-color: currentColor;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(1) {
  transform: translateY(4.25px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(2) {
  transform: translateY(-4.25px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   FOOTER — layout.md §10
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--dark-background);
  color: var(--dark-text-secondary);
  padding-block: var(--space-20) var(--space-8);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--space-12) var(--space-8);
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--dark-border);
}

.site-footer__logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: var(--space-5);
}

.site-footer__brand {
  min-width: 0;
}

.site-footer__col {
  min-width: 0;
}

.site-footer__about {
  max-width: 32ch;
  font-size: var(--text-small);
  line-height: var(--leading-relaxed);
  color: var(--dark-text-tertiary);
}

.site-footer__email {
  display: inline-block;
  margin-top: var(--space-4);
  color: var(--dark-text-primary);
  font-size: var(--text-small);
  border-bottom: 1px solid var(--dark-border);
  padding-bottom: 2px;
}

.site-footer__email:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.site-footer__title {
  margin: 0 0 var(--space-5);
  color: var(--dark-text-tertiary);
  font-family: var(--font-sans);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.site-footer__links a {
  color: var(--dark-text-secondary);
  font-size: var(--text-small);
}

.site-footer__links a:hover {
  color: var(--dark-text-primary);
}

.site-footer__address {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-small);
  line-height: var(--leading-relaxed);
  color: var(--dark-text-tertiary);
}

.site-footer__cta {
  display: inline-block;
  margin-top: var(--space-5);
  color: var(--color-accent);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
}

.site-footer__cta:hover {
  color: var(--dark-text-primary);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-6);
}

.site-footer__copy {
  font-size: var(--text-caption);
  color: var(--dark-text-tertiary);
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.site-footer__legal a {
  font-size: var(--text-caption);
  color: var(--dark-text-tertiary);
}

.site-footer__legal a:hover {
  color: var(--dark-text-primary);
}

/* --------------------------------------------------------------------------
   PAGE HERO — inner page masthead
   -------------------------------------------------------------------------- */
.page-hero {
  padding-block: clamp(48px, 7vw, 104px) clamp(40px, 5vw, 72px);
  border-bottom: 1px solid var(--color-divider);
}

.page-hero__inner {
  max-width: 52rem;
}

.page-hero__title {
  margin-top: var(--space-4);
}

.page-hero__lead {
  margin-top: var(--space-5);
  max-width: 44ch;
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
}

.breadcrumb a {
  color: var(--color-text-secondary);
}

.breadcrumb a:hover {
  color: var(--color-link);
}

.breadcrumb [aria-current="page"] {
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   PROSE — long-form reading width
   -------------------------------------------------------------------------- */
.prose {
  max-width: var(--container-reading);
}

.prose > * + * {
  margin-top: var(--space-5);
}

.prose h2 {
  margin-top: var(--space-12);
}

.prose h3 {
  margin-top: var(--space-8);
}

.prose ul,
.prose ol {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-left: var(--space-5);
}

.prose li {
  list-style: disc;
  line-height: var(--leading-relaxed);
}

.prose ol li {
  list-style: decimal;
}

/* Standalone links in a list get a 24px minimum pointer target (WCAG 2.5.8)
   without changing the reading rhythm. */
.prose li > a {
  display: inline-block;
  padding-block: 4px;
  margin-block: -4px;
}

/* --------------------------------------------------------------------------
   EDITORIAL LIST — numbered portfolio rows (businesses page)
   -------------------------------------------------------------------------- */
.editorial-list {
  display: flex;
  flex-direction: column;
}

.editorial-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: var(--space-10);
  align-items: center;
  padding-block: var(--space-12);
  border-top: 1px solid var(--color-divider);
}

.editorial-row:last-child {
  border-bottom: 1px solid var(--color-divider);
}

.editorial-row__num {
  font-size: var(--text-caption);
  letter-spacing: var(--tracking-wider);
  color: var(--color-text-tertiary);
}

.editorial-row__title {
  margin-top: var(--space-3);
}

.editorial-row__summary {
  margin-top: var(--space-4);
  max-width: 46ch;
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.editorial-row__body {
  min-width: 0;
}

.editorial-row__media {
  min-width: 0;
}

.editorial-row__media .media {
  aspect-ratio: 4 / 3;
}

.editorial-row__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-5);
  font-size: var(--text-caption);
  color: var(--color-text-tertiary);
}

/* --------------------------------------------------------------------------
   MEDIA FRAME — layout.md §7
   -------------------------------------------------------------------------- */
.media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--surface-sage);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--wide {
  aspect-ratio: 16 / 9;
}

.media--tall {
  aspect-ratio: 3 / 4;
}

.media--square {
  aspect-ratio: 1 / 1;
}
