/* ==========================================================================
   SPN LEGAL — BASE STYLES
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@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;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; color: inherit; }

/* Focus visibility — accessibility, never removed */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 500; }
h4 { font-size: var(--fs-h4); font-weight: 600; font-family: var(--font-body); }

p { color: var(--text-secondary); line-height: var(--lh-relaxed); }

.display-xl {
  font-family: var(--font-display);
  font-size: var(--fs-display-xl);
  font-weight: 480;
  line-height: 1.02;
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
}
.display-l {
  font-family: var(--font-display);
  font-size: var(--fs-display-l);
  font-weight: 480;
  line-height: 1.05;
  letter-spacing: var(--ls-tight);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-brass);
}
.eyebrow--light { color: var(--brass-light); }

/* The signature "Chambers Rule" motif — brass hairline + square marker */
.chambers-rule {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.chambers-rule::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--brass);
  flex-shrink: 0;
}
.chambers-rule::after {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--brass);
  opacity: 0.55;
}
.eyebrow--light.chambers-rule::before,
.eyebrow--light.chambers-rule::after { background: var(--brass-light); }

.body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-relaxed); color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-on-dark { color: var(--text-on-dark); }

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section { padding-block: var(--section-pad-y); }
.section--sm { padding-block: var(--section-pad-y-sm); }
.section--dark { background: var(--ink); color: var(--text-on-dark); }
.section--parchment { background: var(--parchment); }
.section--cream { background: var(--cream); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}
.section-head__text { max-width: 640px; }
.section-head h2 { margin-top: var(--sp-3); }

.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  background: var(--ink);
  color: var(--text-on-dark);
  padding: var(--sp-3) var(--sp-5);
  z-index: var(--z-modal);
  transition: top var(--dur-base) var(--ease-out);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--sp-4); }

/* ---------- SCROLL REVEAL ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- IMAGE CURTAIN REVEAL ----------
   A premium "uncovering" effect for photography: a panel wipes away while
   the image itself settles from a slight zoom, triggered by the same
   scroll-observer as [data-reveal]. Used on hero imagery and large media
   blocks throughout the site (never on small thumbnails/avatars, where
   it would just look like flicker). */
[data-reveal-media] { position: relative; overflow: hidden; }
[data-reveal-media] img {
  transform: scale(1.1);
  transition: transform 1200ms var(--ease-out);
}
[data-reveal-media]::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--parchment);
  transform-origin: right center;
  transform: scaleX(1);
  transition: transform 850ms var(--ease-out);
  z-index: 2;
  pointer-events: none;
}
[data-reveal-media].is-visible img { transform: scale(1); }
[data-reveal-media].is-visible::after { transform: scaleX(0); }
@media (prefers-reduced-motion: reduce) {
  [data-reveal-media] img { transform: none; transition: none; }
  [data-reveal-media]::after { display: none; }
}

/* ---------- PAGE-LOAD ENTRANCE (hero content) ----------
   Above-the-fold content can't rely on scroll-triggered reveal, so it
   gets its own staggered load-in via CSS animation instead. */
@keyframes loadInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero__content > *,
.page-hero .container > div:first-child > *,
.simple-hero .container > * {
  opacity: 0;
  animation: loadInUp 760ms var(--ease-out) forwards;
}
.hero__content > *:nth-child(1),
.page-hero .container > div:first-child > *:nth-child(1),
.simple-hero .container > *:nth-child(1) { animation-delay: 60ms; }
.hero__content > *:nth-child(2),
.page-hero .container > div:first-child > *:nth-child(2),
.simple-hero .container > *:nth-child(2) { animation-delay: 170ms; }
.hero__content > *:nth-child(3),
.page-hero .container > div:first-child > *:nth-child(3),
.simple-hero .container > *:nth-child(3) { animation-delay: 280ms; }
.hero__content > *:nth-child(4),
.page-hero .container > div:first-child > *:nth-child(4) { animation-delay: 390ms; }
.hero__content > *:nth-child(5) { animation-delay: 500ms; }
@media (prefers-reduced-motion: reduce) {
  .hero__content > *,
  .page-hero .container > div:first-child > *,
  .simple-hero .container > * { opacity: 1; animation: none; }
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
}
