/* ============================================================================
   ragazzi-base.css — the static site's base.css, CARRIED and SCOPED.

   The static owns the whole document, so its base.css resets bare elements
   (`*`, `a`, `ul`, `img`, `button`) globally. Dawn owns this document, and a
   global reset on top of Dawn silently retunes the cart drawer, the header and
   every stock section. So the carried rules are re-hosted under
   `.ragazzi-section` — the class every ported section root carries — and only
   the two rules that genuinely must be document-wide stay global (they are in
   the ADAPTATION block at the end, with the reason).

   Specificity note: `.ragazzi-section *` is (0,1,0) and beats Dawn's bare
   element selectors (0,0,1); it does NOT beat Dawn's own class rules, so Dawn
   markup rendered inside a ported section (a `<product-form>`, a price block)
   keeps its own styling.

   Load order in layout/theme.liquid: Dawn's base.css FIRST, this file after —
   equal-specificity ties then resolve our way (source order decides).
============================================================================ */

/* ---------------------------------------------------------------------------
   Element reset — carried from base.css, scoped to ported sections.

   THE SCOPE IS IN `:where()`, AND THAT IS LOAD-BEARING, NOT STYLE. In the static
   these are bare element selectors: `h1,h2,… { font-size: inherit }` is (0,0,1),
   so any section rule outranks it. Scoping them the obvious way —
   `.ragazzi-section :is(h1,…)` — makes them (0,2,0), which SILENTLY OUTRANKS
   every carried section rule written as a bare class.

   That shipped: shop-banner's own `.shop-banner__title` is (0,1,0), so this
   reset won and the banner heading rendered at the section's body size instead
   of 52px/500. It only bit that section because the others happen to prefix
   their selectors with a root class and land on (0,2,0).

   `:where()` contributes ZERO specificity, so `:where(.ragazzi-section) :is(h1…)`
   is (0,0,1) — the static's own weight — while still being scoped to our
   sections. Every rule in this block is written that way for that reason. The
   ADAPTATION rules further down deliberately are NOT: those exist to beat Dawn
   and need their weight.
--------------------------------------------------------------------------- */
:where(.ragazzi-section),
:where(.ragazzi-section) *,
:where(.ragazzi-section) *::before,
:where(.ragazzi-section) *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Reset the UA heading sizes — each section applies its own token. */
:where(.ragazzi-section) :is(h1, h2, h3, h4, h5, h6) {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
}

:where(.ragazzi-section) :is(ul, ol) {
  list-style: none;
}

:where(.ragazzi-section) a {
  color: inherit;
  text-decoration: none;
}

/* `height: auto` matters for the <picture> collapse pitfall. */
:where(.ragazzi-section) :is(img, video, svg, picture) {
  max-width: 100%;
  height: auto;
  display: block;
}

:where(.ragazzi-section) button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  text-align: inherit;
}

:where(.ragazzi-section) :is(input, textarea, select) {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  text-transform: inherit;
  letter-spacing: inherit;
}

:where(.ragazzi-section) table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Document defaults the static puts on <body>; here they are the section's,
   because Dawn's <body> is shared with stock sections that are tuned to it. */
.ragazzi-section {
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-doc);
  color: var(--color-text);
  background: var(--color-bg);
}

/* A TWO-TONE ring, not a single colour — measured, not stylistic. A focus
   outline is painted 2px OUTSIDE the control, so what matters is the background
   AROUND it. On this site 27 of home's 52 focusable controls sit inside a black
   hero: a plain black ring is invisible on all of them, a plain white one
   scored 1.00:1 against white product cards. Black outline + white halo always
   presents one of the two against whatever is behind it. */
:where(.ragazzi-section) *:focus {
  outline: none;
}

:where(.ragazzi-section) *:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-focus-halo);
}

/* ============================================================================
   CONTAINER — one definition for the whole site. `.container` sits on every
   ported <section>; `max-width` is ALWAYS 1920px and is NOT `--vw-base` (they
   merely happen to be equal on this project).

   NEVER a `padding` shorthand on a `.container` — it wipes the gutter. Vertical
   padding is each section's own.
============================================================================ */
.container {
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Bleed override — drops the horizontal gutter, keeps the 1920px cap. */
.container--bleed {
  padding-inline: 0;
}

/* ============================================================================
   Site-wide utilities — carried. `.visually-hidden` is deliberately NOT carried:
   Dawn already ships one (with `!important`), and two definitions of one name
   would be decided by load order rather than by intent.

   Per-layer visibility helpers: Figma ships some content only on one layer.
   `!important` because they must beat a section's own display value, which is
   the whole point of the helper.
============================================================================ */
@media (max-width: 767px) {
  .u-desktop-only { display: none !important; }
  .u-br-desktop { display: none; }
}

@media (min-width: 768px) {
  .u-mobile-only { display: none !important; }
  .u-br-mobile { display: none; }
}

/* ---------------------------------------------------------------------------
   `.pill` — CARRIED from the static's shared component file, not from any one
   section. Three sections ship a pill-shaped label (shop-banner's SHOP NOW,
   blog's READ MORE, the review card's SHOP) and share ONLY the shape and the
   centring; every colour, size and padding is measured per section and lives in
   that section's own stylesheet.

   It has to live at this level or it gets duplicated three times — and it is
   easy to miss, because a section's own rules look complete on their own: the
   review card's SHOP sets its colours, padding and type but no `display` and no
   `border-radius`. Without this rule it renders as a square inline link.

   Scoped to `.ragazzi-section` rather than the static's page class: `pill` is a
   generic enough name that an app's stylesheet could carry its own.
--------------------------------------------------------------------------- */
:where(.ragazzi-section) .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  text-align: center;
  transition: background-color 150ms ease, color 150ms ease, filter 150ms ease;
}

/* Scroll-reveal. DO NOT EMIT `data-animate` IN A SECTION until the observer
   that adds `.is-visible` is ported — the static drives it from js/main.js,
   which this theme does not carry. Anything marked with the attribute today
   would be `opacity: 0` for ever. The static's reviews section carries the
   attribute, and it was deliberately dropped on the way in for this reason. */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms ease, transform 500ms ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================================================
   ADAPTATION — Dawn reconciliation. Everything above this line is the carried
   static; everything below exists only because Dawn is underneath.
   Keep this list SHORT and audited (playbook §8.2: past a dozen rules, rebuild
   from one specificity pass instead of adding a thirteenth).
============================================================================ */

/* 1. Dawn puts `letter-spacing: 0.06rem` on `body` in an inline `{% style %}`
      block in theme.liquid, and `letter-spacing: calc(scale * 0.06rem)` on
      every heading in base.css. The design tracks nothing at 0 — that 0.6px per
      character inherits everywhere and makes every line wider than the mockup
      (measured on nooa: 271px of ink in a 253px column). `html body` = two type
      selectors, so it beats the inline rule even though that one loads first. */
html body {
  letter-spacing: normal;
}

/* 2. The brand face is Onest everywhere, and Dawn's font picker has no Onest —
      so the family is set here rather than in the theme settings. Family only:
      Dawn's own font-size/line-height stay, because stock sections are tuned to
      them and ported sections set their own. */
html body {
  font-family: var(--font-body);
}

/* 3. Dawn's heading rule (`h1,h2,… { letter-spacing; word-break: break-word }`,
      specificity 0,0,1) still reaches headings inside ported sections, whose own
      rules never set those two properties. `word-break: break-word` would break
      a long word mid-word where the design wraps it whole. */
.ragazzi-section :is(h1, h2, h3, h4, h5, h6) {
  letter-spacing: normal;
  word-break: normal;
}

/* 4. `overflow-x: clip`, NEVER `hidden` — `hidden` turns html/body into scroll
      containers and silently kills `position: sticky` anywhere on the page
      (Dawn's sticky header, the PDP buybox). The static's base sets this on both
      elements; carried as-is because it is a document-level guarantee. */
html,
body {
  overflow-x: clip;
}

/* ============================================================================
   TEXT RASTERISATION — grayscale antialiasing, to match the mockups.

   NOT a Dawn reconciliation, which is why it sits below that block rather than
   inside it: nothing here is being fixed, a rendering default is being chosen.

   Figma rasterises text with grayscale antialiasing. A browser left on
   `font-smoothing: auto` uses the OS subpixel rasteriser instead, which lays
   more ink on vertical stems, and the whole site reads a touch heavier than the
   mockup at identical CSS. That was the reported symptom.

   Everything cheaper was ruled out by measurement first, so this is not a guess:
     · no `-webkit-text-stroke` and no `text-shadow` anywhere in any stylesheet
     · no synthetic bold — `@font-face` declares Onest as a variable `400 700`
       and only 400/500/600 are ever requested
     · Onest really is the face painting, not a fallback (a `Range` width differs
       from the same text in `system-ui`)
     · our `ragazzi-onest.woff2` is the same cut as Google's Onest — advance
       widths identical to the hundredth of a px at 400/500/600/700

   SCOPE, honestly: `-webkit-font-smoothing` is honoured on macOS ONLY. Chrome on
   Windows parses and ignores it, and DirectWrite's stem darkening keeps the
   extra weight there — no CSS lever exists for that. So this helps Mac and
   Safari visitors and changes nothing on Windows.

   `html`, not `body`: the property inherits, and putting it on the root also
   covers anything Shopify renders outside `<body>`'s own subtree.
============================================================================ */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
