/**
 * BLADE BOSS — BASE STYLES
 * Reset + Typography + Shared Components + Utilities
 * 
 * Loaded on every public page via head.php.
 * Depends on: design-tokens.css
 */


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   RESET — Modern, minimal
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

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

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--bb-charcoal);
    line-height: 1.6;
    background: var(--bb-white);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

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

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    text-wrap: balance;
}

p {
    overflow-wrap: break-word;
    text-wrap: pretty;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TYPOGRAPHY
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    color: var(--bb-charcoal);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p + p {
    margin-top: var(--space-4);
}

strong, b {
    font-weight: 700;
}

small {
    font-size: var(--text-sm);
}

.text-display {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   LAYOUT
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.bb-container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (max-width: 768px) {
    .bb-container {
        padding: 0 var(--space-4);
    }
}

.bb-section {
    padding: var(--space-12) 0;
    position: relative;
}

@media (max-width: 768px) {
    .bb-section {
        padding: var(--space-8) 0;
    }
}

.bb-main {
    /* Push content below fixed nav */
    padding-top: var(--nav-height);
}

@media (max-width: 768px) {
    .bb-main {
        padding-top: var(--nav-height-mobile);
    }
}

/* Content visibility for off-screen sections (huge perf win) */
.bb-section:not(:first-child) {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SECTION HEADERS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.section-header {
    text-align: center;
    max-width: var(--max-width-sm);
    margin: 0 auto var(--space-8);
}

.section-title {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--bb-mid-gray);
    line-height: 1.6;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BUTTONS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    outline: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    line-height: 1;
    transition:
        transform var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out),
        background-color var(--duration-normal) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    white-space: nowrap;
}

/* Touch target minimum (44px) for accessibility */
.btn {
    min-height: 48px;
    min-width: 48px;
}

.btn:active {
    transform: scale(0.97);
}

/* Primary — Orange CTA */
.btn-primary {
    background: var(--bb-orange);
    color: var(--bb-white);
    box-shadow: 0 4px 14px rgba(245, 120, 66, 0.3);
}

.btn-primary:hover {
    background: var(--bb-orange-hover);
    box-shadow: 0 6px 20px rgba(245, 120, 66, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--bb-orange-active);
    transform: translateY(0) scale(0.97);
}

/* Secondary — Green outline */
.btn-secondary {
    background: transparent;
    color: var(--bb-green);
    border: 2px solid var(--bb-green);
}

.btn-secondary:hover {
    background: var(--bb-green);
    color: var(--bb-white);
    transform: translateY(-1px);
}

/* Ghost — For dark backgrounds */
.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    color: var(--bb-white);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Large variant */
.btn-lg {
    padding: 1.25rem 2.5rem;
    font-size: var(--text-lg);
    border-radius: var(--radius-lg);
}

/* Small variant */
.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: var(--text-sm);
    min-height: 40px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   CARDS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.bb-card {
    background: var(--bb-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--bb-light-gray);
    padding: var(--space-6);
    transition: 
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.bb-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bb-card-glass {
    background: var(--bb-glass-bg-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bb-glass-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SCROLL ANIMATIONS — CSS-only reveal
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.bb-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.9s var(--ease-out),
        transform 0.9s var(--ease-out);
}

.bb-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children — wider gaps so each one is noticeable */
.bb-stagger > .bb-reveal:nth-child(1) { transition-delay: 0ms; }
.bb-stagger > .bb-reveal:nth-child(2) { transition-delay: 150ms; }
.bb-stagger > .bb-reveal:nth-child(3) { transition-delay: 300ms; }
.bb-stagger > .bb-reveal:nth-child(4) { transition-delay: 450ms; }
.bb-stagger > .bb-reveal:nth-child(5) { transition-delay: 600ms; }
.bb-stagger > .bb-reveal:nth-child(6) { transition-delay: 750ms; }

/* Load fade-in — for above-the-fold elements that can't wait for scroll */
.bb-fade-in-delayed {
    opacity: 0;
    transform: translateY(30px);
    animation: bb-fade-in 0.9s var(--ease-out) 0.5s forwards;
}

@keyframes bb-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   HIGHLIGHT / ACCENT TEXT
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.text-green   { color: var(--bb-green); }
.text-orange  { color: var(--bb-orange); }
.text-muted   { color: var(--bb-mid-gray); }
.text-white   { color: var(--bb-white); }
.text-center  { text-align: center; }

.text-gradient {
    background: linear-gradient(135deg, var(--bb-green) 0%, var(--bb-green-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   BACKGROUND VARIANTS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.bg-dark {
    background: var(--bb-navy);
    color: var(--bb-white);
}

.bg-dark .section-subtitle {
    color: rgba(255, 255, 255, 0.7);
}

.bg-green {
    background: var(--bb-green);
    color: var(--bb-white);
}

.bg-light {
    background: var(--bb-off-white);
}

.bg-smoke {
    background: var(--bb-smoke);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ACCESSIBILITY
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--bb-orange);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link */
.bb-skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background: var(--bb-green);
    color: var(--bb-white);
    padding: var(--space-3) var(--space-5);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    z-index: var(--z-toast);
    font-weight: 700;
    transition: top var(--duration-fast) var(--ease-out);
}

.bb-skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SELECTION
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

::selection {
    background: var(--bb-green);
    color: var(--bb-white);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   SCROLLBAR (subtle, premium)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

::-webkit-scrollbar {
    width: 8px;
}

/* ━━━ Scroll Progress Bar ━━━ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
    z-index: calc(var(--z-nav) + 1);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 767px) {
    .progress-bar {
        top: 60px;
    }
    .progress-bar.nav-hidden {
        transform: translateY(-60px);
    }
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bb-orange) 0%, var(--bb-green) 100%);
    width: 0%;
    will-change: width;
    transition: width 150ms linear;
    box-shadow: 0 0 8px var(--bb-orange-glow);
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bb-ash);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bb-mid-gray);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--bb-ash) transparent;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   GLOBAL LIGHTBOX
   Gallery viewer with prev/next, swipe,
   captions, counter, loading states.
   Usage: any <img> with [data-bb-lightbox]
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
[data-bb-lightbox] {
    cursor: pointer;
    cursor: zoom-in;
}

/* ── Shell ── */

.bb-lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s;
    --dismiss-progress: 0;
}

.bb-lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

/* ── Backdrop ── */

.bb-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    cursor: pointer;
    opacity: calc(1 - var(--dismiss-progress, 0) * 0.6);
    transition: opacity 0.3s ease;
}

/* ── Top bar (counter + close) ── */

.bb-lightbox-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s,
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
}

.bb-lightbox.is-active .bb-lightbox-topbar {
    opacity: 1;
    transform: translateY(0);
}

/* ── Counter pill ── */

.bb-lightbox-counter {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    letter-spacing: 0.03em;
    user-select: none;
}

/* ── Close button ── */

.bb-lightbox-close {
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

.bb-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--bb-white);
    transform: scale(1.08);
}

.bb-lightbox-close svg {
    width: 18px;
    height: 18px;
}

/* ── Nav arrows ── */

.bb-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.2s ease, transform 0.2s ease;
}

.bb-lightbox.is-active .bb-lightbox-nav {
    opacity: 1;
}

.bb-lightbox-nav.is-hidden {
    opacity: 0.2;
    pointer-events: none;
}

.bb-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.08);
}

.bb-lightbox-nav svg {
    width: 22px;
    height: 22px;
}

.bb-lightbox-prev {
    left: var(--space-4);
}

.bb-lightbox-next {
    right: var(--space-4);
}

/* ── Image stage ── */

.bb-lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
    z-index: 5;
}

/* ── Loading spinner ── */

.bb-lightbox-loader {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.bb-lightbox-loader.is-visible {
    opacity: 1;
}

.bb-lightbox-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: bb-lb-spin 0.7s linear infinite;
}

@keyframes bb-lb-spin {
    to { transform: rotate(360deg); }
}

/* ── Image ── */

.bb-lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5),
                0 8px 32px rgba(0, 0, 0, 0.3);
    object-fit: contain;
    transform: scale(0.88) translateY(16px);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
    user-select: none;
    -webkit-user-drag: none;
}

.bb-lightbox-img.is-loaded {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Navigation slide transitions */
.bb-lightbox-img.exit-left {
    transform: translateX(-40px) scale(0.95);
    opacity: 0;
    transition: transform 0.18s ease-in, opacity 0.18s ease-in;
}

.bb-lightbox-img.exit-right {
    transform: translateX(40px) scale(0.95);
    opacity: 0;
    transition: transform 0.18s ease-in, opacity 0.18s ease-in;
}

.bb-lightbox-img.enter-left {
    transform: translateX(30px);
}

.bb-lightbox-img.enter-right {
    transform: translateX(-30px);
}

/* ── Caption ── */

.bb-lightbox-caption {
    position: absolute;
    bottom: var(--space-5);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 10;
    max-width: 600px;
    text-align: center;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s,
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bb-lightbox.is-active .bb-lightbox-caption.has-caption {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Mobile ── */

@media (max-width: 767px) {
    .bb-lightbox-stage {
        max-width: 96vw;
        max-height: 70vh;
    }

    .bb-lightbox-img {
        max-width: 96vw;
        max-height: 70vh;
        border-radius: var(--radius-lg);
    }

    .bb-lightbox-topbar {
        padding: var(--space-3) var(--space-3);
    }

    .bb-lightbox-close {
        width: 38px;
        height: 38px;
    }

    .bb-lightbox-counter {
        font-size: 12px;
        padding: 5px 12px;
    }

    /* Hide arrow buttons on mobile (swipe instead) */
    .bb-lightbox-nav {
        display: none;
    }

    .bb-lightbox-caption {
        bottom: var(--space-4);
        max-width: 85vw;
        font-size: 12px;
        padding: 8px 16px;
    }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
    .bb-lightbox,
    .bb-lightbox-img,
    .bb-lightbox-topbar,
    .bb-lightbox-caption,
    .bb-lightbox-nav {
        transition-duration: 0.01ms;
    }
    .bb-lightbox-spinner {
        animation: none;
    }
}
