/* ==========================================================================
   EXCELSIOR BY DESIGN — Premium Layer
   Design tokens · Typography · Rhythm · Point of view · Motion (CSS side)
   Loaded after Elementor/Astra styles; owns the global design voice.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS — the entire visual vocabulary lives here
   -------------------------------------------------------------------------- */
:root {
  --ebd-bg:         #0a0a0a;
  --ebd-bg-deep:    #050505;
  --ebd-surface:    #141414;
  --ebd-border:     #2a2a2a;
  --ebd-hairline:   rgba(255, 255, 255, 0.06);
  --ebd-gold:       #c9a84c;
  --ebd-gold-light: #e8c97a;
  --ebd-gold-faint: rgba(201, 168, 76, 0.25);
  --ebd-ink:        #f5f2ea;   /* warm ivory — headings */
  --ebd-body:       #c9c5bc;   /* warm gray — body copy */
  --ebd-muted:      #98948b;   /* warm gray — captions, labels */

  --ebd-font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --ebd-font-body: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ebd-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ebd-header-h: 76px;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. INVISIBLE FOUNDATIONS
   -------------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a var(--ebd-bg);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  font-family: var(--ebd-font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--ebd-gold); color: #0a0a0a; }
::-moz-selection { background: var(--ebd-gold); color: #0a0a0a; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ebd-bg); }
::-webkit-scrollbar-thumb {
  background: #232323;
  border: 3px solid var(--ebd-bg);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: #5d4f28; }

/* Focus: never removed, always replaced — gold ring, offset, visible on keyboard only */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ebd-gold) !important;
  outline-offset: 3px;
}

/* Skip link — invisible until a keyboard user needs it */
.ebd-skip {
  position: fixed;
  top: -100px; left: 16px;
  z-index: 2147483200;
  background: var(--ebd-gold);
  color: #0a0a0a;
  font: 600 12px/1 var(--ebd-font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 22px;
  transition: top 0.2s var(--ebd-ease);
}
.ebd-skip:focus-visible { top: 16px; }

/* Buttons & links feel instant */
a, button, .elementor-button { touch-action: manipulation; }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY THAT DOES WORK — fluid scale, tuned spacing, balanced wraps
   -------------------------------------------------------------------------- */
.elementor-widget-heading .elementor-heading-title {
  font-feature-settings: "kern" 1, "liga" 1;
  text-wrap: balance;
  color: var(--ebd-ink);
}

h1.elementor-heading-title {
  font-size: clamp(2.75rem, 1.1rem + 5.4vw, 5rem) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.015em !important;
  font-weight: 600 !important;
}
h2.elementor-heading-title {
  font-size: clamp(2.1rem, 1rem + 3.2vw, 3.4rem) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.01em !important;
  font-weight: 600 !important;
}
h3.elementor-heading-title {
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
}

/* Italic accent spans inside headings breathe a little wider */
.elementor-heading-title em,
.elementor-heading-title span[style*="italic"] {
  letter-spacing: 0.005em;
}

/* Body copy — measure, rhythm, warmth */
.elementor-widget-text-editor {
  font-size: 1.0625rem;
  line-height: 1.75;
}
.elementor-widget-text-editor p { margin-bottom: 0; }

/* Eyebrow labels (small caps over headings) — quiet gold, wide tracking */
.elementor-widget-text-editor p[style*="letter-spacing:3px"],
.elementor-widget-text-editor p[style*="letter-spacing: 3px"] {
  font-size: 0.6875rem !important;
  letter-spacing: 0.34em !important;
  font-weight: 600 !important;
  opacity: 0.92;
}

/* Content links — animated hairline underline */
.elementor-widget-text-editor a {
  color: var(--ebd-gold);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.25s, background-size 0.3s var(--ebd-ease);
}
.elementor-widget-text-editor a:hover {
  color: var(--ebd-gold-light);
  background-size: 0% 1px;
}

/* Counters — serif numerals in gold, labeled in quiet caps */
.elementor-counter-number-wrapper {
  font-family: var(--ebd-font-display) !important;
  font-weight: 600 !important;
  font-size: clamp(2.4rem, 1.4rem + 2.6vw, 3.6rem) !important;
  color: var(--ebd-gold) !important;
  line-height: 1.1 !important;
}
.elementor-counter-title {
  font-family: var(--ebd-font-body) !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.3em !important;
  text-transform: uppercase !important;
  color: var(--ebd-muted) !important;
  margin-top: 0.85rem !important;
}

/* Icon-box cards — serif titles, considered spacing */
.elementor-icon-box-title {
  font-family: var(--ebd-font-display) !important;
  font-weight: 600 !important;
  font-size: 1.375rem !important;
  line-height: 1.3 !important;
}
.elementor-icon-box-description {
  font-size: 0.9375rem;
  line-height: 1.75;
}

/* Dividers whisper in gold */
.elementor-divider-separator { border-color: var(--ebd-gold-faint) !important; }

/* --------------------------------------------------------------------------
   4. HIERARCHY THAT BREATHES — section rhythm, seams, anchored scrolling
   -------------------------------------------------------------------------- */
[data-elementor-type="wp-page"] { counter-reset: ebdsec; }

[data-elementor-type="wp-page"] > .e-con {
  position: relative;
  counter-increment: ebdsec;
  padding-top: clamp(5.5rem, 4rem + 6vw, 9rem) !important;
  padding-bottom: clamp(5.5rem, 4rem + 6vw, 9rem) !important;
  scroll-margin-top: calc(var(--ebd-header-h) + 16px);
}

/* Hero: extra presence + warm aura from above */
[data-elementor-type="wp-page"] > .e-con:first-child {
  padding-top: clamp(6.5rem, 5rem + 8vw, 11rem) !important;
  background-image: radial-gradient(ellipse 90% 65% at 50% -12%, rgba(201, 168, 76, 0.10), transparent 62%) !important;
}

/* Closing CTA: answering aura from below — the page is bookended in light */
[data-elementor-type="wp-page"] > .e-con:last-child {
  background-image: radial-gradient(ellipse 85% 60% at 50% 112%, rgba(201, 168, 76, 0.09), transparent 62%) !important;
}

/* Hairline seams between sections — editorial rhythm */
[data-elementor-type="wp-page"] > .e-con + .e-con {
  border-top: 1px solid var(--ebd-hairline);
}

/* --------------------------------------------------------------------------
   5. POINT OF VIEW — outlined chapter numerals, filmic grain
   -------------------------------------------------------------------------- */
@media (min-width: 1100px) {
  [data-elementor-type="wp-page"] > .e-con:not(:first-child)::after {
    content: counter(ebdsec, decimal-leading-zero);
    position: absolute;
    top: clamp(1.5rem, 3.5vw, 3rem);
    right: clamp(2rem, 5vw, 5rem);
    font-family: var(--ebd-font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(5.5rem, 8vw, 9rem);
    line-height: 1;
    color: rgba(201, 168, 76, 0.055);
    pointer-events: none;
    user-select: none;
    z-index: 0;
  }
  @supports (-webkit-text-stroke: 1px black) {
    [data-elementor-type="wp-page"] > .e-con:not(:first-child)::after {
      color: transparent;
      -webkit-text-stroke: 1px rgba(201, 168, 76, 0.13);
    }
  }
}

/* Filmic grain — turns flat black into material (div injected in wp_footer) */
.ebd-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147482900;
  opacity: 0.042;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* Scroll progress — a single gold hairline that fills as you read */
.ebd-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 2147483100;
  pointer-events: none;
  background: linear-gradient(90deg, var(--ebd-gold), var(--ebd-gold-light));
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* --------------------------------------------------------------------------
   6. NAVIGATION — quiet, precise, alive on hover
   -------------------------------------------------------------------------- */
.xpro-elementor-nav-link {
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.22em !important;
  color: var(--ebd-muted) !important;
  position: relative;
  transition: color 0.25s !important;
}
.xpro-elementor-nav-link::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 2px;
  width: 0; height: 1px;
  background: var(--ebd-gold);
  transition: width 0.3s var(--ebd-ease), left 0.3s var(--ebd-ease);
}
.xpro-elementor-nav-link:hover::after,
.current-menu-item > .xpro-elementor-nav-link::after {
  width: calc(100% - 28px);
  left: 14px;
}
.xpro-elementor-nav-link:hover { color: var(--ebd-ink) !important; }
.current-menu-item > .xpro-elementor-nav-link { color: var(--ebd-gold) !important; }

/* Header gains a shadow seam once the page is in motion */
.xpro-theme-builder-header { transition: box-shadow 0.35s ease; }
html.ebd-scrolled .xpro-theme-builder-header {
  box-shadow: 0 1px 0 rgba(201, 168, 76, 0.12), 0 16px 48px -24px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   7. BUTTONS — sharp, tracked, soft-lift on hover
   -------------------------------------------------------------------------- */
.elementor-button {
  border-radius: 0 !important;
  font-size: 0.6875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.22em !important;
  text-transform: uppercase !important;
  padding: 1.15rem 2.8rem !important;
  transition: transform 0.25s var(--ebd-ease), box-shadow 0.25s var(--ebd-ease),
              background-color 0.25s, color 0.25s, border-color 0.25s !important;
}
.elementor-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -10px rgba(201, 168, 76, 0.35);
}
.elementor-button:active { transform: translateY(0); }

/* Form labels inherit the token voice */
.wpforms-form .wpforms-field-label { color: var(--ebd-muted) !important; }

/* --------------------------------------------------------------------------
   8. MOTION THAT WHISPERS — reveal choreography (JS adds classes)
   -------------------------------------------------------------------------- */
html.ebd-motion .ebd-reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s var(--ebd-ease), transform 0.85s var(--ebd-ease);
  transition-delay: var(--ebd-d, 0ms);
  will-change: opacity, transform;
}
html.ebd-motion .ebd-reveal.is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}
@media (prefers-reduced-motion: reduce) {
  .ebd-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .ebd-progress { display: none; }
}

/* --------------------------------------------------------------------------
   9. MOBILE — designed, not shrunk
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  :root { --ebd-header-h: 64px; }

  [data-elementor-type="wp-page"] > .e-con {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  /* Display type recalibrated for close reading distance */
  h1.elementor-heading-title {
    font-size: clamp(2.4rem, 11vw, 3.1rem) !important;
    line-height: 1.1 !important;
  }
  h2.elementor-heading-title { line-height: 1.16 !important; }

  .elementor-widget-text-editor { font-size: 1rem; line-height: 1.7; }

  /* CTAs become confident, thumb-sized bars */
  .elementor-button-wrapper .elementor-button {
    display: flex !important;
    width: 100% !important;
    justify-content: center !important;
    min-height: 52px;
    align-items: center !important;
  }

  /* Stat counters: a 2×2 grid instead of a long stack */
  .e-con:has(> .e-con > .elementor-widget-counter) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1rem;
  }

  /* Mobile menu: readable size, honest touch targets */
  .xpro-elementor-nav-link {
    font-size: 14px !important;
    letter-spacing: 0.18em !important;
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
  }
  .xpro-elementor-horizontal-menu-toggler {
    min-width: 44px;
    min-height: 44px;
  }

  /* Ornament restraint on small canvases */
  .ebd-grain { opacity: 0.03; }
}

/* Guard against sideways scroll everywhere */
html, body { overflow-x: clip; }
