/* ============================================================
   Story of US - element defaults, typography, shared components
   Read DESIGN.md before changing anything here.
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-body);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain: one static texture layer above everything, never animated. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.42 0 0 0 0 0.38 0 0 0 0 0.32 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23p)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--red);
  color: var(--on-red);
}

/* --- Typography --- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.7rem, 6vw, 5.2rem);
}

h2 {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
}

h3 {
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
}

h4 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1.1em;
  max-width: 68ch;
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

small {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

figure {
  margin: 0;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 2.5rem 0;
}

/* --- Links --- */

a {
  color: var(--ink);
  text-decoration: none;
}

.prose a,
.text-link {
  color: var(--ink);
  background-image: linear-gradient(var(--red), var(--red));
  background-repeat: no-repeat;
  background-size: 100% 1.5px;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: color var(--dur-micro) var(--ease-out);
}

.prose a:hover,
.text-link:hover {
  color: var(--red);
}

/* Drawn-underline link (nav, footer, inline CTAs) */
.draw-link {
  position: relative;
  padding-bottom: 3px;
}

.draw-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-micro) var(--ease-out);
}

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

/* --- Focus --- */

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: var(--z-skip);
  background: var(--ink);
  color: var(--on-ink);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.skip-link:focus-visible {
  top: 1rem;
}

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

/* --- Layout primitives --- */

.container {
  width: min(100% - 2 * var(--gutter), var(--content));
  margin-inline: auto;
}

.container-narrow {
  width: min(100% - 2 * var(--gutter), var(--content-narrow));
  margin-inline: auto;
}

.band {
  padding-block: var(--band-y);
}

.band-deep {
  background: var(--paper-deep);
}

.band-ink {
  background: var(--ink);
  color: var(--on-ink);
}

.band-ink h1,
.band-ink h2,
.band-ink h3 {
  color: var(--on-ink);
}

/* --- Kicker (use sparingly: max one per few sections) --- */

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 1.2rem;
}

.kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

/* --- Buttons (pill = the one interactive shape) --- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.9rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur-micro) var(--ease-out),
    color var(--dur-micro) var(--ease-out),
    border-color var(--dur-micro) var(--ease-out),
    transform var(--dur-micro) var(--ease-out),
    box-shadow var(--dur-micro) var(--ease-out);
}

.button:active {
  transform: scale(0.98);
}

.button-primary {
  background: var(--red);
  color: var(--on-red);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--red-deep);
  box-shadow: var(--shadow-soft);
}

.button-outline {
  border-color: var(--hairline-strong);
  color: var(--ink);
  background: transparent;
}

.button-outline:hover,
.button-outline:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.button-ghost {
  color: var(--ink);
  background: var(--ink-wash);
}

.button-ghost:hover,
.button-ghost:focus-visible {
  background: var(--ink);
  color: var(--on-ink);
}

/* --- Cards --- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    transform var(--dur-micro) var(--ease-out),
    box-shadow var(--dur-micro) var(--ease-out);
}

a.card:hover,
a.card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lift);
}

.card-media {
  overflow: hidden;
}

.card-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 300ms var(--ease-out);
}

a.card:hover .card-media img {
  transform: scale(1.03);
}

/* --- Dot divider (replaces horizontal rules between story sections) --- */

.dot-divider {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  padding: 2.2rem 0;
}

.dot-divider span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot-divider span:nth-child(1) { background: var(--dot-1); }
.dot-divider span:nth-child(2) { background: var(--dot-2); }
.dot-divider span:nth-child(3) { background: var(--dot-3); }
.dot-divider span:nth-child(4) { background: var(--dot-5); }
.dot-divider span:nth-child(5) { background: var(--dot-6); }

/* --- Forms --- */

label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.45rem;
  font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1.5px solid var(--hairline-strong);
  border-radius: var(--radius-input);
  transition:
    border-color var(--dur-micro) var(--ease-out),
    box-shadow var(--dur-micro) var(--ease-out);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.12);
}

textarea {
  min-height: 8.5rem;
  resize: vertical;
}

::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

.field {
  margin-bottom: 1.5rem;
}

.field-help {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
}

.field-error {
  font-size: 0.88rem;
  color: var(--error);
  font-weight: 600;
  margin-top: 0.4rem;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--error);
}

.required-mark {
  color: var(--red);
}

/* --- Stats / numerals --- */

.stat-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}

/* --- Empty state --- */

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  color: var(--ink-muted);
}

/* --- Footer --- */

.site-footer {
  background: var(--ink);
  color: var(--on-ink);
  margin-top: var(--band-y);
}

.site-footer .container {
  padding-block: 4rem 2.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.footer-brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--on-ink);
}

.footer-tagline {
  margin-top: 0.8rem;
  color: rgba(247, 243, 236, 0.75);
  max-width: 34ch;
}

.footer-heading {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.1rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.footer-links a {
  color: rgba(247, 243, 236, 0.82);
  transition: color var(--dur-micro) var(--ease-out);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--on-ink);
}

.footer-meta {
  margin-top: 3.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(247, 243, 236, 0.18);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: rgba(247, 243, 236, 0.6);
}

.footer-meta a {
  color: rgba(247, 243, 236, 0.8);
}

.footer-meta a:hover {
  color: var(--on-ink);
}

/* --- Toast / message --- */

.messages {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-menu);
  display: grid;
  gap: 0.6rem;
}

.message {
  background: var(--ink);
  color: var(--on-ink);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lift);
  font-size: 0.95rem;
}

/* --- Responsive --- */

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }
}
