/* ==========================================================================
   White Moon Jewels — base elements + layout primitives
   --------------------------------------------------------------------------
   Depends on wm-tokens.css. Everything here is a primitive that more than one
   section needs; anything used by exactly one section lives in that section's
   own {% stylesheet %} block so it ships only on pages that render it.

   Naming is `wm-<block>__<element>` / `--<modifier>`. It is deliberately our
   own — no class name is taken from the reference theme.
   ========================================================================== */

/* ---- element base ------------------------------------------------------ */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wm-bg);
  color: var(--wm-text);
  font-family: var(--wm-font-body);
  font-weight: var(--wm-weight-body);
  font-size: var(--wm-text-base);
  line-height: var(--wm-leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--wm-font-heading);
  font-weight: var(--wm-weight-heading);
  line-height: var(--wm-leading-heading);
  color: var(--wm-heading);
  text-transform: none;
}

h1 { font-size: var(--wm-h1); line-height: var(--wm-leading-tight); }
h2 { font-size: var(--wm-h2); }
h3 { font-size: var(--wm-h3); }
h4 { font-size: var(--wm-h4); }
h5 { font-size: var(--wm-h5); }
h6 { font-size: var(--wm-h6); }

/* The signature italic-serif emphasis inside a heading. Used as
   <h1>Diamonds <em>grown by light</em></h1> — a real <em>, so the emphasis is
   in the document, not only in the styling. */
h1 em, h2 em, h3 em,
.wm-em {
  font-style: var(--wm-heading-em-style);
  font-size: var(--wm-heading-em-size);
  font-weight: inherit;
  line-height: 1;
}

p { margin: 0 0 var(--wm-space-4); }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--wm-link); }

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

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* A visible focus ring that survives a dark background. Never removed —
   :focus-visible keeps it off mouse clicks, which is the only reason anyone
   wants it gone. */
:focus-visible {
  outline: 2px solid var(--wm-accent);
  outline-offset: 2px;
}

.wm-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-to-content {
  position: absolute; top: -100px; left: var(--wm-space-4);
  z-index: var(--wm-z-modal);
  padding: var(--wm-space-3) var(--wm-space-5);
  background: var(--wm-ink); color: #fff;
}
.skip-to-content:focus { top: var(--wm-space-4); }

/* ---- layout primitives ------------------------------------------------- */

.wm-container {
  width: 100%;
  max-width: var(--wm-maxw);
  margin-inline: auto;
  padding-inline: var(--wm-gutter);
}

/* Full-bleed media inside a container, without a wrapper element. */
.wm-container--flush { padding-inline: 0; }

.wm-section { padding-block: var(--wm-section-y); }
.wm-section--tight { padding-block: calc(var(--wm-section-y) / 2); }
.wm-section--flush { padding-block: 0; }
.wm-section--bone { background: var(--wm-bone); }
.wm-section--mist { background: var(--wm-mist); }
.wm-section--paper { background: var(--wm-paper); }
.wm-section--night { background: var(--wm-night); color: #fff; }
.wm-section--night h1,
.wm-section--night h2,
.wm-section--night h3 { color: #fff; }

/* The section header pattern. Two variants exist on the reference: centred
   (title only) and a row with a trailing link ("Most loved this season" →
   "View all"). Both are this one block. */
.wm-head {
  display: flex;
  flex-direction: column;
  gap: var(--wm-space-2);
  align-items: center;
  text-align: center;
  margin-bottom: var(--wm-space-7);
}
.wm-head--row {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  text-align: left;
}
.wm-head__eyebrow {
  font-size: var(--wm-text-xs);
  letter-spacing: var(--wm-tracking-wide);
  text-transform: uppercase;
  color: var(--wm-accent);
  font-weight: 400;
}
.wm-head__link {
  font-size: var(--wm-text-sm);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .wm-head { margin-bottom: var(--wm-space-5); }
  .wm-head--row { align-items: center; }
}

/* A responsive grid driven by a column count the section sets. Collapses on a
   ladder rather than by `auto-fill`, because the reference's column counts per
   breakpoint are deliberate (4 → 3 → 2) and auto-fill would not reproduce them. */
.wm-grid {
  display: grid;
  grid-template-columns: repeat(var(--wm-cols, 4), minmax(0, 1fr));
  gap: var(--wm-space-5);
}
@media (max-width: 1024px) { .wm-grid { grid-template-columns: repeat(var(--wm-cols-md, 3), minmax(0, 1fr)); } }
@media (max-width: 768px)  { .wm-grid { grid-template-columns: repeat(var(--wm-cols-sm, 2), minmax(0, 1fr)); gap: var(--wm-space-4); } }

/* ---- buttons ----------------------------------------------------------- */

.wm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wm-space-2);
  min-height: 48px;                       /* a comfortable touch target */
  /* Measured on the reference button: 11.52px, .2em tracking, 16.8/33.6 padding, square. */
  padding: 1.05rem 2.1rem;
  border: var(--wm-border) solid transparent;
  border-radius: var(--wm-radius);
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
  /* Reference easing: a slow ease-out-quint on colour, a quick one on the lift. */
  transition: background .35s cubic-bezier(.23, 1, .32, 1),
              color .35s cubic-bezier(.23, 1, .32, 1),
              border-color .35s cubic-bezier(.23, 1, .32, 1),
              transform .16s cubic-bezier(.23, 1, .32, 1);
}

.wm-btn--solid { background: var(--wm-ink); color: #f4f3f0; }
/* Gold fill + a 1px lift on hover — the reference animates background + colour together. */
.wm-btn--solid:hover { background: var(--wm-accent); color: var(--wm-ink); transform: translateY(-1px); }

.wm-btn--outline { border-color: currentColor; color: var(--wm-ink); }
.wm-btn--outline:hover { background: var(--wm-ink); color: #fff; transform: translateY(-1px); }

.wm-btn--gold { background: var(--wm-accent); color: var(--wm-ink); }
.wm-btn--gold:hover { background: var(--wm-ink); color: #f4f3f0; transform: translateY(-1px); }

.wm-btn--quiet {
  min-height: 0; padding: 0 0 6px;
  border: 0; border-bottom: 1px solid currentColor;
  letter-spacing: .2em;
}
.wm-btn--quiet:hover { opacity: .72; }

.wm-btn[aria-disabled="true"],
.wm-btn:disabled { opacity: .45; pointer-events: none; }

/* ---- scroll reveal ----------------------------------------------------- */

/* The reference animates entrances with a `.reveal` → `.in` class pair, which
   is the right shape: the transition is described in CSS and JS only toggles a
   class. Ours matches that contract so wm-reveal.js stays a dozen lines.
   `.wm-reveal` starts hidden ONLY when JS is running — see the html.no-js
   guard below, so a failed script never leaves the page blank. */
.wm-js .wm-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--wm-dur-image) var(--wm-ease),
              transform var(--wm-dur-image) var(--wm-ease);
  will-change: opacity, transform;
}
.wm-js .wm-reveal.wm-in {
  opacity: 1;
  transform: none;
}
/* Stagger children without a per-item style attribute. */
.wm-js .wm-reveal--stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--wm-dur-image) var(--wm-ease),
              transform var(--wm-dur-image) var(--wm-ease);
}
.wm-js .wm-reveal--stagger.wm-in > * { opacity: 1; transform: none; }
.wm-js .wm-reveal--stagger.wm-in > *:nth-child(2) { transition-delay: 70ms; }
.wm-js .wm-reveal--stagger.wm-in > *:nth-child(3) { transition-delay: 140ms; }
.wm-js .wm-reveal--stagger.wm-in > *:nth-child(4) { transition-delay: 210ms; }
.wm-js .wm-reveal--stagger.wm-in > *:nth-child(5) { transition-delay: 280ms; }
.wm-js .wm-reveal--stagger.wm-in > *:nth-child(6) { transition-delay: 350ms; }

/* ---- media ------------------------------------------------------------- */

.wm-media {
  position: relative;
  overflow: hidden;
  background: var(--wm-bone);
}
.wm-media::before {
  content: "";
  display: block;
  padding-top: var(--wm-ratio, var(--wm-card-ratio));
}
.wm-media > img,
.wm-media > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--wm-dur-image) var(--wm-ease);
}
.wm-media--zoom:hover > img { transform: scale(var(--wm-media-zoom)); }

/* An empty picker should read as intentional space, not a broken image. */
.wm-media--placeholder { background: var(--wm-mist); }
