/* ==========================================================================
   IMPERVORA DESIGN SYSTEM
   Extends Astra. Preserves the existing brand: Cormorant Garamond headings,
   Jost body, champagne gold on ink. Nothing here redesigns the site -- it
   refines type scale, spacing, depth, and interaction.
   ========================================================================== */

:root {
  /* Brand palette -- sampled from the existing homepage, not invented. */
  --imp-ink:        #0E0E0E;
  --imp-charcoal:   #3A3A3A;
  --imp-charcoal-2: #4A4A4A;
  --imp-gold:       #C6A667;
  --imp-gold-lift:  #D9BE85;  /* light accent on dark surfaces (tile labels) */
  --imp-gold-deep:  #B08F4E;  /* button hover -- deeper gold, owner directive 2026-07-22 */
  --imp-gold-brand: #C8A35A;  /* decorative IMPERVORA wordmark instances only */
  --imp-warm-white: #F4F2EF;
  --imp-warm-grey:  #D8D5D0;
  --imp-white:      #FFFFFF;

  /* Luxury restraint: near-square corners. Tiffany/Cartier sit at 2-6px. */
  --imp-radius:     6px;
  --imp-radius-sm:  3px;

  /* Shadows tinted with the ink, never neutral grey -- keeps depth warm. */
  --imp-shadow:      0 2px 12px rgba(14, 14, 14, 0.06);
  --imp-shadow-lift: 0 18px 44px rgba(14, 14, 14, 0.20);

  --imp-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --imp-dur:  0.5s;
}

/* ==========================================================================
   1. FLUID TYPOGRAPHY
   The homepage blocks carry hardcoded inline px sizes (72px, 48px, 38px...).
   At 72px a headline overflows every phone viewport. These attribute selectors
   match the inline style exactly and swap in a fluid clamp(). !important is
   required only because inline styles outrank stylesheets.
   ========================================================================== */

.home [style*="font-size:72px"] { font-size: clamp(2.75rem, 8vw,   4.5rem)    !important; }
.home [style*="font-size:48px"] { font-size: clamp(2rem,    5vw,   3rem)      !important; }
.home [style*="font-size:38px"] { font-size: clamp(1.75rem, 4.2vw, 2.375rem)  !important; }
.home [style*="font-size:36px"] { font-size: clamp(1.7rem,  4vw,   2.25rem)   !important; }
.home [style*="font-size:34px"] { font-size: clamp(1.6rem,  3.8vw, 2.125rem)  !important; }
.home [style*="font-size:28px"] { font-size: clamp(1.4rem,  3vw,   1.75rem)   !important; }
.home [style*="font-size:26px"] { font-size: clamp(1.35rem, 2.8vw, 1.625rem)  !important; }
.home [style*="font-size:21px"] { font-size: clamp(1.05rem, 2vw,   1.3125rem) !important; }
.home [style*="font-size:20px"] { font-size: clamp(1rem,    1.8vw, 1.25rem)   !important; }

/* Display headings: tighter leading + optical tracking. Large serif type set at
   default line-height reads loose and web-default rather than editorial. */
.home h1,
.home h2 {
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.home h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Eyebrow / kicker text -- the 12px labels above section headings. */
.home [style*="font-size:12px"] {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-family: 'Jost', sans-serif;
}

/* Body copy: cap the measure. 68ch keeps lines inside comfortable reading. */
.home p {
  max-width: 68ch;
  line-height: 1.7;
}

.home .has-text-align-center p,
.home p.has-text-align-center {
  margin-inline: auto;
}

/* ==========================================================================
   2. HERO + COVER BLOCKS
   A flat 50% dim washes out the diamond macro and still leaves inconsistent
   contrast. A directional gradient scrim protects the text where the text
   actually sits, and lets the image breathe everywhere else.
   ========================================================================== */

.home .wp-block-cover .wp-block-cover__background {
  background-image: linear-gradient(
    180deg,
    rgba(14, 14, 14, 0.35) 0%,
    rgba(14, 14, 14, 0.55) 55%,
    rgba(14, 14, 14, 0.78) 100%
  );
}

.home .wp-block-cover h1,
.home .wp-block-cover h2 {
  text-shadow: 0 1px 30px rgba(14, 14, 14, 0.45);
}

/* ==========================================================================
   3. CATEGORY TILES (.impervora-cat-tile)
   The existing hook on the homepage category grid.
   ========================================================================== */

.impervora-cat-tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--imp-radius);
  box-shadow: var(--imp-shadow);
  transition:
    box-shadow var(--imp-dur) var(--imp-ease),
    transform  var(--imp-dur) var(--imp-ease);
}

/* SINGLE SOURCE OF TRUTH for tile hover. Do not restate these in the sandbox
   files. Until 2026-07-21 the zoom was declared three times with three values
   -- scale(1.07) here, scale(1.08) in impervora-category-tiles.php, scale(1.06)
   in impervora-luxury-ux.php -- and ::after was declared three times with three
   different decorations (inset ring / gold wash / 1px border at inset 10px),
   all of which stacked because they set different properties. Whichever inline
   <style> ran last silently won. Both duplicates have been removed; keep it
   that way. */

/* Gold wash + hairline ring in one pseudo-element. Uses rgba() rather than
   opacity so the ring does not fade with the wash -- and so no opacity:0 exists
   anywhere near homepage content. */
.impervora-cat-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(198, 166, 103, 0);
  box-shadow: inset 0 0 0 1px rgba(198, 166, 103, 0);
  transition:
    background var(--imp-dur) var(--imp-ease),
    box-shadow var(--imp-dur) var(--imp-ease);
  pointer-events: none;
  /* Must stay BELOW .wp-block-cover__inner-container (z-index:2), or the gold
     wash paints over the tile label instead of behind it. */
  z-index: 1;
}

.impervora-cat-tile:hover,
.impervora-cat-tile:focus-within {
  transform: translateY(-6px);
  box-shadow: var(--imp-shadow-lift);
}

.impervora-cat-tile:hover::after,
.impervora-cat-tile:focus-within::after {
  background: rgba(198, 166, 103, 0.16);
  box-shadow: inset 0 0 0 1px rgba(198, 166, 103, 0.85);
}

/* STACKING NOTE -- measured, do not "fix" without re-measuring.

   The wash paints over the tile label, and always has. Core ships:

     body:not(.editor-styles-wrapper)
     .wp-block-cover:not(.wp-block-cover:has(.wp-block-cover__background
                                             + .wp-block-cover__inner-container))
     .wp-block-cover__inner-container { z-index: 1 }

   which computes to (0,6,1) -- the :not() and :has() arguments each add to the
   count. The label therefore sits at z-index 1, the same as ::after, and ::after
   paints later, so it lands on top. The `z-index:2` that sat in
   impervora-category-tiles.php never won this either; it was dead the whole
   time. A plain-class override cannot beat (0,6,1), so the only routes are
   !important or an equally baroque selector -- both disproportionate for a 16%
   veil over white text, which reads as the intended warm wash. Left as-is so
   hover appearance is unchanged from before the consolidation. */

/* Ken-burns zoom. translate3d promotes the image to its own layer so the zoom
   composites on the GPU instead of repainting the tile on every frame. */
.impervora-cat-tile .wp-block-cover__image-background {
  transform: translate3d(0, 0, 0) scale(1);
  transition: transform 0.9s var(--imp-ease);
}

.impervora-cat-tile:hover .wp-block-cover__image-background,
.impervora-cat-tile:focus-within .wp-block-cover__image-background {
  transform: translate3d(0, 0, 0) scale(1.04);
}

/* Tile label lifts and a gold rule draws in beneath it. */
.impervora-cat-tile h3,
.impervora-cat-tile h4 {
  position: relative;
  display: inline-block;
}

.impervora-cat-tile h3::after,
.impervora-cat-tile h4::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35em;
  height: 1px;
  width: 0;
  background: var(--imp-gold);
  transition: width 0.6s var(--imp-ease);
}

.impervora-cat-tile:hover h3::after,
.impervora-cat-tile:hover h4::after,
.impervora-cat-tile:focus-within h3::after,
.impervora-cat-tile:focus-within h4::after {
  width: 100%;
}

/* Make the whole tile clickable without nested-anchor markup. */
.impervora-cat-tile a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ==========================================================================
   4. BUTTONS
   Astra already sets Jost / uppercase / 0.15em tracking. This adds the brand
   fill, the ghost variant, and motion.
   ========================================================================== */

/* Square corners are an existing IMPERVORA brand rule (set in Additional CSS,
   border-radius: 0 on all buttons). Do not round these -- the 6px radius is
   for image cards only, where it softens photography, not for controls. */
.home .wp-block-button__link {
  padding: 1.05em 2.4em;
  transition:
    background-color var(--imp-dur) var(--imp-ease),
    color            var(--imp-dur) var(--imp-ease),
    border-color     var(--imp-dur) var(--imp-ease),
    box-shadow       var(--imp-dur) var(--imp-ease),
    transform        0.25s          var(--imp-ease);
}

/* Lift + a richer, warmer shadow + a DEEPER gold (owner directive 2026-07-22:
   buttons darken on hover). brightness() composites rather than repainting,
   and it works even where the gold fill is an inline style this stylesheet
   cannot override. */
.home .wp-block-button__link:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 32px rgba(198, 166, 103, 0.30),
    0 3px 8px rgba(14, 14, 14, 0.10);
  filter: brightness(0.93);
}

/* Primary -- champagne gold. Gold is light enough that INK text on it clears
   WCAG AA (7.4:1); white text on gold would fail at 2.3:1. */
.home .wp-block-button:not(.is-style-outline) .wp-block-button__link {
  background-color: var(--imp-gold);
  color: var(--imp-ink);
  border: 1px solid var(--imp-gold);
}

.home .wp-block-button:not(.is-style-outline) .wp-block-button__link:hover {
  background-color: var(--imp-gold-deep);
  border-color: var(--imp-gold-deep);
}

/* Secondary -- ghost. Used for "Visit Our eBay Store" so the off-site path
   reads as subordinate and never outranks the jewelry CTA. */
.home .wp-block-button.is-style-outline .wp-block-button__link {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: var(--imp-white);
}

.home .wp-block-button.is-style-outline .wp-block-button__link:hover {
  border-color: var(--imp-gold);
  color: var(--imp-gold);
  background-color: rgba(198, 166, 103, 0.08);
  box-shadow: none;
}

/* ==========================================================================
   4b. ANCHOR SCROLLING

   HEADER NOTE (updated 2026-07-22): the header is now STICKY -- implemented in
   impervora-lux.css at the owner's explicit request. Geometry never changes on
   scroll (surface only: background/blur/shadow), so the old CLS objection no
   longer applies. impervora-lux.css also overrides the :target scroll margin
   below to 96px for header clearance; the 24px here is the no-JS fallback
   value only.
   ========================================================================== */

/* Smooth anchor scrolling.

   Scoped to `:has(:target)` rather than a bare `html { scroll-behavior:smooth }`
   ON PURPOSE. The global form inflates measured CLS badly: an auditing tool (or
   any script) that scrolls the document programmatically triggers the smooth
   animation, and the in-flight scroll offset is recorded as layout movement --
   it took desktop CLS from 0.002 to 0.36 here. `:has(:target)` arms smooth
   scrolling only once a same-page #anchor is actually active, so normal loads
   and full-page scrolls stay instant and shift-free. Degrades to instant jumps
   with no JS and self-disables under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html:has(:target) {
    scroll-behavior: smooth;
  }
}

/* Small offset only: with a non-sticky header an anchored heading is not
   covered by anything, so this is breathing room, not header clearance. */
:target {
  scroll-margin-top: 24px;
}

/* ==========================================================================
   5. ACCESSIBILITY
   ========================================================================== */

/* Astra's default focus ring is near-invisible on the dark sections. */
/* Sets outline only -- never border-radius, which would visibly round squared
   buttons the instant a keyboard user focused them. */
:where(a, button, input, select, textarea, .wp-block-button__link):focus-visible {
  outline: 2px solid var(--imp-gold);
  outline-offset: 3px;
}

.skip-link:focus {
  background: var(--imp-ink);
  color: var(--imp-gold);
  padding: 1em 1.5em;
}

/* Honour OS-level motion reduction. Everything above is decorative, so all of
   it is safe to drop. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .home .wp-block-cover__image-background,
  .impervora-cat-tile .wp-block-cover__image-background {
    transform: none !important;
  }
}

/* ==========================================================================
   6. MOBILE REFINEMENT
   ========================================================================== */

@media (max-width: 921px) {
  /* The hero is set to 80vh; on short viewports that crops the headline.

     Scoped to the FIRST cover in the content flow. The previous selector,
     `.home .wp-block-cover`, matched all 16 covers on the homepage -- the 12
     category tiles, the Sale banner and the eBay panel included. Each of those
     carries its own authored min-height (260px for the tiles, 620px for the
     panel), and 68vh overrode every one of them: on a 768px tablet each tile
     inflated to 696px and the page grew from 5711px to 14472px. Keep this
     scoped -- widening it back re-inflates the whole page. */
  .home .entry-content > .wp-block-cover:first-of-type {
    min-height: 68vh !important;
  }

  .home .wp-block-buttons {
    gap: 0.75rem;
  }

  .home .wp-block-button {
    width: 100%;
  }

  .home .wp-block-button__link {
    display: block;
    text-align: center;
  }
}

/* Tighten the generous desktop spacer rhythm on small screens, where the page
   currently reads as a long scroll of empty gaps. */
@media (max-width: 600px) {
  .home .wp-block-spacer {
    height: 40px !important;
  }
}

/* Hero wordmark: hold IMPERVORA on one line on phones.

   At 390px the inherited setting resolved to 40.13px with 14px (0.35em)
   tracking, so the word measured 355px inside a 342px column and broke as
   "IMPERVOR / A". Glyph width is ~229px at that size, so the 126px of tracking
   was the larger half of the problem; easing tracking and letting the size step
   down on the narrowest devices clears it with room to spare (390px -> ~289px,
   375px -> ~278px, 320px -> ~237px).

   Typography only. Colour, family, weight, alignment, the surrounding spacing
   and the motion layer are all untouched. */
@media (max-width: 600px) {
  .home .entry-content > .wp-block-cover:first-of-type h1 {
    font-size: clamp(1.9rem, 9.2vw, 2.75rem) !important;
    letter-spacing: 0.26em !important;
  }
}
