/* ==========================================================================
   POSA — Base: reset, typography, layout helpers, grain texture
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--chianti);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;            /* guard against any horizontal scroll */
}

img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }

::selection { background: var(--pink); color: var(--chianti); }

/* ---- Focus (always visible for keyboard users) ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---- Typography ---- */
.display, .h1, .h2, .h3, h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: var(--lh-head);
  text-wrap: balance;
}
.display { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -.03em; }
.h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); letter-spacing: -.01em; }

.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--chianti-80); max-width: 36em; text-wrap: pretty; }
p { text-wrap: pretty; }

/* Script accent — single words only (e.g. "Lemon *Cream*") */
.script {
  font-family: var(--font-script);
  font-weight: 400;
  font-style: normal;
  font-size: 1.16em;
  line-height: .8;
  letter-spacing: 0;
  padding-inline: .06em .02em;
  display: inline-block;   /* keeps swashes from being clipped */
}

/* Small mono label (ref. 04 mallé card) */
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: .75em;
}
.label--rule::before {
  content: "";
  width: 2.25rem;
  height: 1px;
  background: currentColor;
  opacity: .6;
}
.mono { font-family: var(--font-mono); }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: calc(var(--max-w) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { position: relative; padding-block: var(--section-y); }

.bg-pink  { background: var(--pink); }
.bg-soft  { background: var(--pink-soft); }
.bg-chianti { background: var(--chianti); color: var(--white); }
.bg-pink, .bg-soft, .bg-chianti { background-image: url("../assets/img/grain.png"); background-size: 160px 160px; }
.bg-chianti .lead { color: rgba(255, 255, 255, .82); }

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

/* ---- Paper grain ----------------------------------------------------------
   A small pre-rendered noise tile painted INTO the backgrounds (body + the
   coloured section grounds). No fixed full-screen overlay, no live SVG
   filter, no blend mode → nothing is repainted while scrolling. */
body { background-image: url("../assets/img/grain.png"); background-size: 160px 160px; }

/* ---- Motion gate --------------------------------------------------------
   .js-motion is added in <head> only when motion is allowed.
   Elements are pre-hidden ONLY until motion.js is ready (.motion-ready);
   a 3s safety timeout removes .js-motion if scripts fail, so content
   is never lost. */
.js-motion:not(.motion-ready) [data-split],
.js-motion:not(.motion-ready) [data-arch],
.js-motion:not(.motion-ready) [data-ink] { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Browser translation (Chrome/Edge/Safari/Firefox "Translate")
   html.is-translated is set by js/components.js when a translation is
   detected. Text becomes static and fully visible; marks drawn around exact
   words are hidden (they would land in the wrong place); script accents fall
   back to the serif italic (a translated word in Pinyon Script reads badly).
   ========================================================================== */
html.is-translated .script {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1em;
  line-height: inherit;
  letter-spacing: inherit;
  padding-inline: 0;
  margin-inline: 0;
  display: inline;
}
html.is-translated .pen,
html.is-translated .pen-note { display: none !important; }
html.is-translated .pen-wrap,
html.is-translated .nowrap { white-space: normal; display: inline; }
html.is-translated :is([data-split], [data-ink], [data-fill-words], .hero__title, .ihero__title, .hero__lead, .hero__actions) { opacity: 1 !important; visibility: visible !important; }
/* button labels: no rising copy, wrap if a translated label is long */
html.is-translated .btn__label { overflow: visible; }
html.is-translated .btn__label-copy { display: none; }
html.is-translated .btn__label-in { transform: none !important; }

/* Long words (German compounds) must never push the layout sideways */
.btn { max-width: 100%; }
.btn__label { min-width: 0; overflow-wrap: anywhere; }
h1, h2, h3, .lead, p, li, label, legend { overflow-wrap: break-word; }
