/* ==========================================================================
   FOUNDRY — Trade & Home Services personality core
   See: foundry-theme-design-plan.md for the full design rationale.

   Includes a fix applied from a reviewed AI draft: that draft referenced
   fd-ba-after / fd-ba-before / fd-ba-handle / fd-ba-divider-* classes for
   the before/after slider but never defined them anywhere — without this
   stylesheet the slider's core mechanic (image stacking + clip-path
   reveal) would not work at all. Defined properly below.
   ========================================================================== */

.eaa-foundry {
    --wp--preset--color--primary:        #D63B2C; /* Dispatch Red (Crew default) */
    --wp--preset--color--secondary:      #16264A; /* Breaker Navy */
    --wp--preset--color--background:     #FAFAFA; /* Workshop White */
    --wp--preset--color--surface:        #F1F2F4; /* Steel Mist */
    --wp--preset--color--border:         #E2E4E7; /* Hairline Steel */
    --wp--preset--color--contrast:       #1A1D1F; /* Forge Black */
    --wp--preset--color--muted:          #63686D; /* Iron Grey */

    /* What text colour sits on top of --primary. Verified per line:
       Crew/Flow/Yard primaries pass AA with white text; Current's amber
       primary only passes with dark text (7.54:1 vs 2.25:1 for white) —
       so this gets overridden inside line-current.css, nowhere else. */
    --wp--preset--color--primary-contrast-text: #FFFFFF;

    --fd-radius-card: 10px;
    --fd-shadow-soft: 0 4px 16px rgba(26,29,31,0.10);
    --fd-transition:  220ms ease-out;

    background-color: var(--wp--preset--color--background);
    color: var(--wp--preset--color--contrast);
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

.eaa-foundry h1, .eaa-foundry h2, .eaa-foundry h3, .eaa-foundry h4 {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    line-height: 1.15;
    color: var(--wp--preset--color--contrast);
}

.eaa-foundry p {
    color: var(--wp--preset--color--muted);
    line-height: 1.65;
}

.fd-sr-only {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.fd-tile-link { position: absolute; inset: 0; z-index: 10; text-decoration: none; }

.fd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    border-radius: var(--fd-radius-card);
    text-decoration: none;
    transition: transform var(--fd-transition), box-shadow var(--fd-transition);
}

.fd-btn-primary {
    background: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--primary-contrast-text);
}

.fd-btn-primary:hover {
    transform: translateY(-4px);
    box-shadow: var(--fd-shadow-soft);
}

/* ── Before/After Slider ──────────────────────────────────────────────
   Native <input type="range"> driving a CSS clip-path via one custom
   property. Keyboard- and touch-operable for free; no drag-handler JS
   to write or maintain. */

.fd-ba-slider {
    position: relative;
    overflow: hidden;
    border-radius: var(--fd-radius-card);
    border: 1px solid var(--wp--preset--color--border);
    box-shadow: var(--fd-shadow-soft);
    aspect-ratio: 4 / 3;
    --pos: 50%;
}

.fd-ba-slider img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fd-ba-after {
    position: absolute;
    inset: 0;
}

.fd-ba-before {
    position: absolute;
    inset: 0;
    clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.fd-ba-label {
    position: absolute;
    top: 12px;
    z-index: 3;
    background: rgba(26,29,31,0.72);
    color: #FFFFFF;
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 4px;
    pointer-events: none;
}

/* Visible divider line + drag-handle affordance, tracking the slider
   position. This is the part a reviewed AI draft added as bare,
   unstyled markup with no CSS behind it — implemented for real here. */
.fd-ba-divider-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos);
    width: 3px;
    background: #FFFFFF;
    box-shadow: 0 0 0 1px rgba(26,29,31,0.15);
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
}

.fd-ba-divider-circle {
    position: absolute;
    top: 50%;
    left: var(--pos);
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: var(--fd-shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--wp--preset--color--contrast);
    z-index: 4;
    pointer-events: none;
}

.fd-ba-handle {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    appearance: none;
    background: transparent;
    cursor: ew-resize;
    z-index: 5;
}
.fd-ba-handle::-webkit-slider-thumb { appearance: none; width: 40px; height: 40px; opacity: 0; cursor: ew-resize; }
.fd-ba-handle::-moz-range-thumb     { width: 40px; height: 40px; opacity: 0; border: none; cursor: ew-resize; }

/* ── Sticky mobile call bar ─────────────────────────────────────────── */
.fd-sticky-call-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--wp--preset--color--contrast);
    border-top: 1px solid var(--wp--preset--color--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.10);
    z-index: 9999;
    padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

@media (min-width: 880px) {
    .fd-sticky-call-bar { display: none; }
}

/* ── EAA baseline section variable bridge ─────────────────────────────────
   Baseline sections reference --eaa-* variables for key colors. These map
   each theme's design vocabulary to those variables so hero_cover,
   stats_dark_band, feature_three_cards etc. change correctly per theme.
   Without this bridge all themes show baseline fallback colors (#0f1117,
   #f8f8f6, #1a56db) regardless of which theme is active. */
.eaa-foundry {
    --eaa-dark-bg:             #16264A;
    --eaa-dark-text-secondary: rgba(255,255,255,0.78);
    --eaa-dark-text-tertiary:  rgba(255,255,255,0.50);
    --eaa-accent:              #D63B2C;
    --eaa-icon-bg:             #fce8e6;
    --eaa-light-bg:            #FAFAFA;
    --eaa-card-bg:             #F1F2F4;
    --eaa-border:              #E2E4E7;
    --eaa-text:                #1A1D1F;
    --eaa-muted:               #63686D;
}
