/* ===========================================================
   SIW — Editorial / almanac aesthetic
   Cream paper, sienna ink, refined editorial type stack.
   =========================================================== */

:root {
  --color-bg: #f7f3ee; /* cream / off-white paper */
  --color-ink: #1a1a1a; /* near-black */
  --color-ink-muted: #6b6155; /* warm muted */
  --color-rule: #d9d2c5; /* hairline rule */
  --color-accent: #b5471f; /* sienna / terracotta */
  --color-accent-dark: #8c3617;

  --font-display: "Fraunces", "Fraunces Fallback", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Fallback face — metric-tuned Georgia so Fraunces swap doesn't shift the H1.
   Values are approximate; recalibrate with Fontaine/Capsize if CLS=0 is required. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia");
  ascent-override: 96%;
  descent-override: 27%;
  line-gap-override: 0%;
  size-adjust: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  /* Subtle warm atmosphere — barely-there sienna corners on cream paper */
  background-image:
    radial-gradient(at 0% 0%, rgba(181, 71, 31, 0.04), transparent 55%),
    radial-gradient(at 100% 100%, rgba(181, 71, 31, 0.04), transparent 55%);
  color: var(--color-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fixed-attachment background only when motion is OK (vestibular safety) */
@media (prefers-reduced-motion: no-preference) {
  body {
    background-attachment: fixed;
  }
}

/* Display headings — Fraunces with optical-size axis maxed for headline character */
.font-display {
  font-family: var(--font-display);
  font-variation-settings:
    "opsz" 144,
    "SOFT" 0,
    "WONK" 0;
  text-wrap: balance;
}

/* Pretty wrapping for body paragraphs (avoids orphan last words) */
p {
  text-wrap: pretty;
}

/* Hairline rule — single base style, sections add margin via Tailwind */
hr {
  border: 0;
  border-top: 1px solid var(--color-rule);
}

/* ===========================================================
   Section shell — single canonical pattern for every section.
   <section class="section [+ variants]">
     <div class="section-container [+ variants]"> ... </div>
   </section>
   =========================================================== */
.section {
  padding-top: 5rem; /* 80px */
  padding-bottom: 5rem;
}

.section-container {
  max-width: 72rem; /* max-w-6xl */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem; /* 24px */
  padding-right: 1.5rem;
}

@media (min-width: 640px) {
  .section {
    padding-top: 7rem; /* 112px */
    padding-bottom: 7rem;
  }
}

/* Compact band variant (Trust strip, Footer) */
.section--band {
  padding-top: 2.5rem; /* 40px */
  padding-bottom: 2.5rem;
}

@media (min-width: 640px) {
  .section--band {
    padding-top: 3.5rem; /* 56px */
    padding-bottom: 3.5rem;
  }
}

/* Narrow inner container (Quote/Manifesto pull-quotes) */
.section-container--narrow {
  max-width: 56rem; /* max-w-4xl */
}

/* ===========================================================
   Section eyebrow — single canonical pattern.
   Used at the top of every section. One place to tune.
   =========================================================== */
.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-ink-muted);
  margin-bottom: 2.5rem; /* 40px */
}

.section-eyebrow::before {
  content: "";
  width: 2.5rem;
  height: 1px;
  background-color: var(--color-rule);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .section-eyebrow {
    font-size: 12px;
    margin-bottom: 3.5rem; /* 56px */
  }
  .section-eyebrow::before {
    width: 3rem;
  }
}

/* Inverted variant for dark sections (e.g. Quote/Manifesto) */
.section-eyebrow--inverted {
  color: rgba(247, 243, 238, 0.5); /* cream / 50 */
}

.section-eyebrow--inverted::before {
  background-color: rgba(247, 243, 238, 0.3); /* cream / 30 */
}

/* Marquee / logo ticker — seamless infinite scroll */
.marquee {
  overflow: hidden;
  width: 100%;
}

.marquee-track {
  display: flex;
  align-items: center;
  gap: 3rem;
  width: max-content;
  animation: marquee 32s linear infinite;
}

.marquee:hover .marquee-track,
.marquee:focus-within .marquee-track {
  animation-play-state: paused;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-25%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
  }
}

/* ===========================================================
   Accessibility utilities
   =========================================================== */

/* Visually hide content while keeping it readable for assistive tech */
.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 — only visible on keyboard focus */
.skip-link {
  position: absolute;
  top: 0;
  left: 1rem;
  background: var(--color-ink);
  color: var(--color-bg);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
  z-index: 100;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Account for sticky nav so anchored / focused content isn't hidden */
:target,
:focus-visible {
  scroll-margin-top: 80px;
}

/* Visible keyboard focus on all interactive elements */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Form inputs use a thicker bottom border instead of the outline ring (editorial fit) */
input:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* Tabular figures — opt-in via .tabular-nums (don't apply to all mono text) */
.tabular-nums {
  font-feature-settings: "tnum";
}
