/* =============================================================
   Sunday Polish — base
   Reset, type scale, layout primitives, .prose, focus, skip link.
   Owned by Agent 1 (core build).
   ============================================================= */

/* ---------- extra local tokens (derived, not overriding) ---- */
:root {
  --sp-skin:       #EAC2A8;
  --sp-skin-2:     #D9A98C;
  --sp-bed:        #F0CDBB;
  --sp-header-h:   88px;
  --sp-ring:       0 0 0 3px var(--sp-cream), 0 0 0 6px var(--sp-lilac);
  --sp-ring-tight: 0 0 0 3px var(--sp-lilac-soft), 0 0 0 5px var(--sp-lilac-deep);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--sp-header-h) + 24px);
}

body {
  min-height: 100%;
  background: var(--sp-bg);
  color: var(--sp-fg);
  font-family: var(--sp-font-body);
  font-size: var(--sp-t-md);
  font-weight: 400;
  line-height: var(--sp-lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

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

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

[hidden] { display: none !important; }

table { border-collapse: collapse; width: 100%; }

hr { border: 0; height: 1px; background: var(--sp-line); }

/* Icons inherit the text colour, but never override an explicit fill="none"
   on stroke-only icons — that turned outline glyphs into solid discs. */
svg { fill: currentColor; }
svg[fill="none"], svg[fill="none"] * { fill: none; }

::selection { background: var(--sp-lilac-soft); color: var(--sp-ink); }

/* ---------- focus ------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--sp-lilac-deep);
  outline-offset: 3px;
  border-radius: var(--sp-r-sm);
}
.sp-focus-inset:focus-visible { outline-offset: -3px; }
/* programmatic focus targets (headings we move focus to) shouldn't ring */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* ---------- skip link --------------------------------------- */
.sp-skip {
  position: fixed;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--sp-ink);
  color: var(--sp-cream);
  padding: 0.75rem 1.25rem;
  border-radius: var(--sp-r-pill);
  font-weight: 600;
  font-size: var(--sp-t-sm);
  transition: top var(--sp-dur) var(--sp-spring);
}
.sp-skip:focus { top: 12px; }

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

/* =============================================================
   Layout primitives
   ============================================================= */
.wrap {
  width: 100%;
  max-width: var(--sp-max);
  margin-inline: auto;
  padding-inline: var(--sp-gutter);
}
.wrap--narrow { max-width: var(--sp-max-narrow); }
.wrap--wide   { max-width: var(--sp-max-wide); }

.section { padding-block: clamp(3rem, 7vw, 6rem); position: relative; }
.section--tight { padding-block: clamp(2rem, 4vw, 3.25rem); }
.section--flush-top { padding-top: 0; }

.section--cream { background: var(--sp-cream-2); }
.section--paper { background: var(--sp-paper); }
.section--lilac { background: var(--sp-lilac-soft); }
.section--ink   { background: var(--sp-ink); color: var(--sp-cream); }
.section--ink .muted,
.section--ink .fine { color: rgba(253, 244, 234, 0.66); }
.section--ink a.link { color: var(--sp-coral-soft); }

.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack--sm { gap: var(--sp-2); }
.stack--lg { gap: var(--sp-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.cluster--sm { gap: var(--sp-2); }
.cluster--center { justify-content: center; }

.split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.center { text-align: center; }
.center-x { margin-inline: auto; }
.flow > * + * { margin-top: var(--sp-4); }

/* =============================================================
   Type
   ============================================================= */
.display, .h1, .h2, .h3 {
  font-family: var(--sp-font-display);
  font-weight: 800;
  line-height: var(--sp-lh-tight);
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.display { font-size: var(--sp-t-4xl); }
.h1 { font-size: var(--sp-t-3xl); }
.h2 { font-size: var(--sp-t-2xl); line-height: var(--sp-lh-snug); }
.h3 { font-size: var(--sp-t-xl); line-height: var(--sp-lh-snug); }

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: var(--sp-lh-snug); }

.display .u-coral, .h1 .u-coral, .u-coral { color: var(--sp-coral-deep); }
.u-lilac { color: var(--sp-lilac-deep); }
.u-ink   { color: var(--sp-ink); }

.eyebrow {
  display: inline-block;
  font-size: var(--sp-t-xs);
  font-weight: 600;
  letter-spacing: var(--sp-track-wide);
  text-transform: uppercase;
  color: var(--sp-lilac-deep);
}
.section--ink .eyebrow { color: var(--sp-coral); }

.lede {
  font-size: var(--sp-t-lg);
  line-height: 1.55;
  color: var(--sp-ink-2);
  text-wrap: pretty;
}
.section--ink .lede { color: rgba(253, 244, 234, 0.82); }

.muted { color: var(--sp-muted); }
.fine  { font-size: var(--sp-t-xs); line-height: 1.55; color: var(--sp-muted); }
.strike { text-decoration: line-through; color: var(--sp-muted); }
.nowrap { white-space: nowrap; }

.link {
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--sp-coral);
  transition: text-decoration-color var(--sp-dur-fast) var(--sp-ease),
              color var(--sp-dur-fast) var(--sp-ease);
}
.link:hover { color: var(--sp-coral-deep); text-decoration-color: var(--sp-coral-deep); }

.rule { height: 1px; background: var(--sp-line); border: 0; margin-block: var(--sp-5); }
.section--ink .rule { background: rgba(253, 244, 234, 0.16); }

/* =============================================================
   .prose — long-form article body
   ============================================================= */
.prose {
  font-size: var(--sp-t-md);
  line-height: var(--sp-lh-body);
  color: var(--sp-ink-2);
  max-width: 68ch;
}
.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  font-family: var(--sp-font-display);
  font-weight: 800;
  font-size: var(--sp-t-2xl);
  line-height: var(--sp-lh-snug);
  color: var(--sp-ink);
  margin-top: 2em;
  text-wrap: balance;
}
.prose h3 {
  font-family: var(--sp-font-display);
  font-weight: 700;
  font-size: var(--sp-t-xl);
  color: var(--sp-ink);
  margin-top: 1.7em;
}
.prose h4 {
  font-size: var(--sp-t-lg);
  font-weight: 600;
  color: var(--sp-ink);
  margin-top: 1.5em;
}
.prose h2 + p, .prose h3 + p, .prose h4 + p { margin-top: 0.6em; }

.prose p { text-wrap: pretty; }
.prose strong { color: var(--sp-ink); font-weight: 600; }
.prose em { font-style: italic; }

.prose a {
  color: var(--sp-lilac-deep);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--sp-lilac-soft);
  transition: text-decoration-color var(--sp-dur-fast) var(--sp-ease);
}
.prose a:hover { text-decoration-color: var(--sp-lilac-deep); }

.prose ul, .prose ol { padding-left: 1.35em; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; padding-left: 0.15em; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: -0.95em;
  top: 0.62em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sp-coral);
}
.prose ol { list-style: decimal; }
.prose ol > li::marker { color: var(--sp-lilac-deep); font-weight: 600; }
.prose li + li { margin-top: 0.45em; }

.prose blockquote {
  margin-inline: 0;
  padding: var(--sp-4) var(--sp-5);
  border-left: 4px solid var(--sp-coral);
  background: var(--sp-paper);
  border-radius: 0 var(--sp-r-md) var(--sp-r-md) 0;
  font-size: var(--sp-t-lg);
  line-height: 1.5;
  color: var(--sp-ink);
}
.prose blockquote p + p { margin-top: 0.7em; }
.prose blockquote cite {
  display: block;
  margin-top: 0.6em;
  font-size: var(--sp-t-sm);
  font-style: normal;
  color: var(--sp-muted);
}

.prose img, .prose svg { border-radius: var(--sp-r-md); }
.prose figure { margin: 2em 0; }
.prose figcaption {
  margin-top: 0.7em;
  font-size: var(--sp-t-sm);
  color: var(--sp-muted);
  text-align: center;
}

.prose hr {
  margin-block: 2.4em;
  height: 0;
  border-top: 2px dotted var(--sp-line);
}

.prose code {
  font-family: var(--sp-font-mono);
  font-size: 0.9em;
  background: var(--sp-cream-2);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

.prose table { margin-block: 1.6em; font-size: var(--sp-t-sm); }
.prose th, .prose td {
  text-align: left;
  padding: 0.7em 0.8em;
  border-bottom: 1px solid var(--sp-line);
}
.prose th { color: var(--sp-ink); font-weight: 600; }

.prose > :first-child { margin-top: 0; }

/* =============================================================
   Reveal-on-scroll
   ============================================================= */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity 700ms var(--sp-ease-out),
    transform 700ms var(--sp-ease-out);
  transition-delay: calc(var(--i, 0) * 65ms);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* If JS never boots, never hide content. */
html:not(.sp-js) [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---------- scroll-snap row --------------------------------- */
.snaprow {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--sp-3);
  margin-inline: calc(var(--sp-gutter) * -1);
  padding-inline: var(--sp-gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--sp-line) transparent;
}
.snaprow > * { scroll-snap-align: start; flex: 0 0 auto; }
.snaprow::-webkit-scrollbar { height: 8px; }
.snaprow::-webkit-scrollbar-thumb { background: var(--sp-line); border-radius: 99px; }
.snaprow::-webkit-scrollbar-track { background: transparent; }

@media (min-width: 900px) {
  .snaprow--grid-lg {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* ---------- misc utilities ---------------------------------- */
.u-hide { display: none !important; }
@media (max-width: 767px) { .u-md-up { display: none !important; } }
@media (min-width: 768px) { .u-sm-only { display: none !important; } }

.u-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.u-rel { position: relative; z-index: 1; }

body.sp-locked { overflow: hidden; }
