/* =====================================================================
   base.css — typography defaults, layout primitives, utilities
   ===================================================================== */

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
}

@media (max-width: 768px) {
  body { font-size: 1.0625rem; }    /* 17px on mobile */
}

/* ---------- Headings (Fraunces — modern editorial serif, deep-sage) ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--deep-sage);
  font-variation-settings: 'opsz' 100, 'SOFT' 50, 'WONK' 0;
}

.display { font-size: var(--fs-display); line-height: 1.02; font-weight: 400; font-variation-settings: 'opsz' 144, 'SOFT' 60, 'WONK' 0; }
h1, .h1 { font-size: var(--fs-h1); font-variation-settings: 'opsz' 110, 'SOFT' 60, 'WONK' 0; }
h2, .h2 { font-size: var(--fs-h2); font-variation-settings: 'opsz' 80, 'SOFT' 60, 'WONK' 0; }
h3, .h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); font-variation-settings: 'opsz' 36, 'SOFT' 50, 'WONK' 0; }

.lede {
  font-family: var(--font-display);
  font-size: var(--fs-lede);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-soft);
  letter-spacing: -0.005em;
  font-variation-settings: 'opsz' 30, 'SOFT' 80, 'WONK' 1;
}

.eyebrow,
.label {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--eucalyptus);
}

p {
  max-width: 64ch;
  color: var(--text);
}

p + p { margin-top: var(--sp-4); }

a {
  color: var(--deep-sage);
  text-decoration: none;
  transition: color var(--t-base) var(--ease-out);
}

a:hover { color: var(--soft-gold); }

strong { font-weight: 600; color: var(--deep-sage); }
em { font-style: italic; }

hr {
  border: 0;
  border-top: var(--border-hair);
  margin: var(--sp-6) 0;
}

blockquote {
  font-family: var(--font-display);
  font-size: var(--fs-lede);
  font-style: italic;
  border-left: 2px solid var(--soft-gold);
  padding-left: var(--sp-5);
  color: var(--text-soft);
  font-variation-settings: 'opsz' 36, 'SOFT' 80;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

pre {
  background: var(--mono-mist);
  color: var(--charcoal-green);
  padding: var(--sp-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

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

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section-tight {
  position: relative;
  padding-block: var(--section-y-tight);
}

/* ---------- Surface classes ---------- */
.section-mist        { background: var(--mist); }
.section-ivory       { background: var(--ivory); }
.section-pearl       { background: var(--pearl); }
.section-cream       { background: var(--ivory); }              /* legacy alias */
.section-cream-deep  { background: var(--pearl); }              /* legacy alias */
.section-warm-cream  { background: var(--pearl); }
.section-sand        { background: var(--sand-light); color: var(--charcoal-green); }
.section-blush       { background: var(--blush); color: var(--charcoal-green); }

.section-sky-soft    { background: var(--sky-soft); color: var(--charcoal-green); position: relative; }
.section-blue-mist   { background: var(--blue-mist); color: var(--charcoal-green); }
.section-sky         { background: var(--sky-soft); color: var(--charcoal-green); } /* legacy alias */

.section-sage        { background: var(--sage); color: var(--charcoal-green); }
.section-eucalyptus  { background: var(--eucalyptus); color: var(--ivory); }

.section-deep-sage {
  position: relative;
  background:
    radial-gradient(circle at 80% 20%, rgba(229, 200, 120, 0.22), transparent 42%),
    radial-gradient(circle at 18% 78%, rgba(168, 191, 163, 0.14), transparent 50%),
    linear-gradient(135deg, var(--charcoal-green) 0%, var(--deep-sage) 100%);
  color: var(--ivory);
}
.section-deep-sage h2,
.section-deep-sage h3 { color: var(--ivory); }
.section-deep-sage .eyebrow { color: var(--champagne); }

/* legacy aliases for the v2 cacao/ink surfaces — now sage gradient */
.section-cacao,
.section-espresso,
.section-ink {
  position: relative;
  background:
    radial-gradient(circle at 80% 20%, rgba(229, 200, 120, 0.22), transparent 42%),
    radial-gradient(circle at 18% 78%, rgba(168, 191, 163, 0.14), transparent 50%),
    linear-gradient(135deg, var(--charcoal-green) 0%, var(--deep-sage) 100%);
  color: var(--ivory);
}
.section-cacao h2, .section-cacao h3,
.section-espresso h2, .section-espresso h3,
.section-ink h2, .section-ink h3 { color: var(--ivory); }

.section-noir       { background: var(--noir); color: var(--bone); }
.section-studio     { background: var(--studio-bg); color: var(--studio-ink); }
.section-gold       { background: linear-gradient(135deg, var(--soft-gold), var(--sunlit-gold)); color: var(--charcoal-green); }

/* Floating ambient gradient — drop into any section as a child element */
.ambient-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ambient-glow::before,
.ambient-glow::after {
  content: "";
  position: absolute;
  width: 60vw;
  height: 60vw;
  max-width: 720px;
  max-height: 720px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}
.ambient-glow::before {
  top: -10%; right: -10%;
  background: radial-gradient(circle, rgba(229, 200, 120, 0.42), transparent 70%);
  animation: floatGlowA 18s ease-in-out infinite alternate;
}
.ambient-glow::after {
  bottom: -15%; left: -10%;
  background: radial-gradient(circle, rgba(191, 221, 229, 0.38), transparent 70%);
  animation: floatGlowB 22s ease-in-out infinite alternate;
}

@keyframes floatGlowA {
  from { transform: translate3d(-2%, -2%, 0) scale(1);    opacity: 0.45; }
  to   { transform: translate3d(3%, 4%, 0)  scale(1.15);  opacity: 0.75; }
}
@keyframes floatGlowB {
  from { transform: translate3d(3%, 2%, 0) scale(1);     opacity: 0.35; }
  to   { transform: translate3d(-2%, -3%, 0) scale(1.1); opacity: 0.65; }
}

/* Wrap section content above the ambient glow */
.section > .container,
.section > .container-narrow,
.section > .container-wide,
.section-tight > .container,
.section-tight > .container-narrow,
.section-tight > .container-wide {
  position: relative;
  z-index: 1;
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 800ms var(--ease-out),
    transform 800ms var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }
.reveal-delay-4 { transition-delay: 320ms; }

/* ---------- Utility ---------- */
.flow > * + * { margin-top: var(--flow-space, var(--sp-4)); }

.stack-1 > * + * { margin-top: var(--sp-1); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-5 > * + * { margin-top: var(--sp-5); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.stack-7 > * + * { margin-top: var(--sp-7); }

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

.text-center { text-align: center; }
.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }
.lowercase { text-transform: lowercase; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-7 { margin-top: var(--sp-7); }
.mt-8 { margin-top: var(--sp-8); }

/* Grids */
.grid-2 { display: grid; gap: var(--sp-6); }
.grid-3 { display: grid; gap: var(--sp-6); }
.grid-4 { display: grid; gap: var(--sp-5); }
.grid-6 { display: grid; gap: var(--sp-3); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .grid-6 { grid-template-columns: repeat(6, 1fr); }
}
