/**
 * Bazevu Design Tokens
 * Source of truth extracted from the marketplace prototype:
 * https://bazevu-marketplace-prototype.nbarasa.chatgpt.site/
 *
 * Include this file before page CSS. Prefer these custom properties over
 * hardcoded hex values when matching marketplace UI to the prototype.
 *
 * Full component / page reference: docs/bazevu-design-system.md
 */

:root {
    /* -------------------------------------------------------------------------
       Core brand (prototype :root)
       ------------------------------------------------------------------------- */
    --paper: #f8faf9;
    --white: #fff;
    --ink: #111b1b;
    --muted: #506360;
    --line: #dce6e2;
    --teal: #08756a;
    --deep: #044a42;
    --mint: #e9f5ef;
    --radius: 19px;
    --shadow: 0 14px 42px rgba(23, 53, 47, 0.07);

    /* Aliases used across existing app CSS */
    --page: var(--paper);
    --soft: #f2f6f4;
    --lavender: var(--mint);
    --green: var(--teal);
    --green-deep: var(--deep);
    --green-mid: #056458;
    --purple: var(--teal);
    --hero: #073e36;
    --hero-accent: #8ee5c6;
    --hero-copy: #dbf2e8;
    --hero-kicker: #a9ebd4;

    /* -------------------------------------------------------------------------
       Semantic colors
       ------------------------------------------------------------------------- */
    --color-bg: var(--paper);
    --color-surface: var(--white);
    --color-text: var(--ink);
    --color-text-muted: var(--muted);
    --color-border: var(--line);
    --color-primary: var(--teal);
    --color-primary-hover: #056458;
    --color-primary-deep: var(--deep);
    --color-accent-soft: var(--mint);
    --color-focus: #149b89;
    --color-danger: #9f332c;
    --color-warning-bg: #f9eee0;
    --color-warning-text: #804a16;
    --color-warning-border: #f1dfc6;
    --color-warning-banner-bg: #fff5e7;
    --color-info-bg: #edf5ff;
    --color-info-border: #d7e7ff;
    --color-info-text: #2b486d;
    --color-verify-blue: #065dde;
    --color-verify-blue-hover: #064eac;
    --color-verify-ink: #08182c;
    --color-nav-link: #52605f;
    --color-nav-sign: #243d39;
    --color-chip-text: #39514b;
    --color-chip-chosen-text: #075b50;
    --color-chip-chosen-bg: #e2f3ec;
    --color-chip-chosen-border: #addace;
    --color-claim: #086659;
    --color-card-title: #18221f;
    --color-card-place: #50645c;
    --color-media-tag: #34443e;
    --color-toast-bg: #133b33;
    --color-dialog-backdrop: #10272173;
    --color-search-border: #d5e4db;
    --color-search-focus-ring: #70b7a7;
    --color-input-border: #ccdcd4;
    --color-input-placeholder: #627570;
    --color-label: #344741;
    --color-footer-bg: #f0f6f2;
    --color-footer-border: #e0ebe5;
    --color-footer-text: #475e55;
    --color-header-border: #e7eeeb;
    --color-trust-strip: #3d5750;
    --color-trust-border: #e8efeb;
    --color-banner-bg: #eaf6ee;
    --color-banner-border: #daeee3;
    --color-banner-text: #21564a;
    --color-ask-bg: #eaf6f1;
    --color-ask-border: #cce5dc;
    --color-ask-text: #075a53;
    --color-saved-bg: #e4f5ed;
    --color-bubble-out: #ddf1e7;
    --color-bubble-out-border: #d4e8df;
    --color-mobile-nav: #48635a;
    --color-mobile-nav-active: #086958;

    /* -------------------------------------------------------------------------
       Typography
       ------------------------------------------------------------------------- */
    --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-heading: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-size-body: 15px;
    --font-size-small: 13px;
    --font-size-xs: 12px;
    --font-size-xxs: 11px;
    --font-size-tag: 10px;
    --line-height-body: 1.5;
    --letter-spacing-heading: -0.045em;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-nav: 620;
    --font-weight-semibold: 650;
    --font-weight-button: 670;
    --font-weight-strong: 680;
    --font-weight-heading: 700;
    --font-weight-heavy: 760;
    --font-weight-price: 770;

    --font-size-hero: clamp(61px, 7.1vw, 94px);
    --font-size-h1: clamp(37px, 5.5vw, 60px);
    --font-size-h2: clamp(26px, 3.6vw, 35px);
    --font-size-h3: 20px;
    --font-size-card-title: 16px;
    --font-size-card-price: 18px;
    --font-size-detail-title: clamp(29px, 4vw, 43px);
    --font-size-detail-price: 34px;
    --font-size-section-lead: 14px;
    --font-size-nav: 14px;
    --font-size-chip: 13px;
    --font-size-pill: 11px;
    --font-size-hero-lead: 16px;
    --font-size-hero-kicker: 11px;
    --font-size-market-cta: 27px;
    --font-size-dialog-title: 24px;
    --font-size-empty-title: 22px;
    --font-size-toast: 14px;

    /* -------------------------------------------------------------------------
       Spacing
       ------------------------------------------------------------------------- */
    --space-1: 4px;
    --space-2: 5px;
    --space-3: 8px;
    --space-4: 10px;
    --space-5: 12px;
    --space-6: 13px;
    --space-7: 14px;
    --space-8: 15px;
    --space-9: 16px;
    --space-10: 17px;
    --space-11: 18px;
    --space-12: 19px;
    --space-13: 22px;
    --space-14: 23px;
    --space-15: 24px;
    --space-16: 25px;
    --space-17: 27px;
    --space-18: 30px;
    --space-19: 34px;
    --space-20: 35px;
    --space-21: 36px;
    --space-22: 40px;
    --space-23: 42px;
    --space-24: 44px;
    --space-25: 54px;

    --gap-chip: 8px;
    --gap-button-row: 10px;
    --gap-listing-grid: 16px;
    --gap-deal-grid: 16px;
    --gap-wanted-grid: 15px;
    --gap-nav: 27px;
    --gap-nav-actions: 12px;
    --gap-market-controls: 10px;
    --gap-stack: 16px;
    --section-margin-top: 34px;
    --home-padding-top: 24px;

    /* -------------------------------------------------------------------------
       Radius ladder
       ------------------------------------------------------------------------- */
    --radius-pill: 999px;
    --radius-circle: 50%;
    --radius-tag: 6px;
    --radius-thumb: 8px;
    --radius-input: 9px;
    --radius-slot: 10px;
    --radius-button: 11px;
    --radius-search: 12px;
    --radius-filter: 12px;
    --radius-banner: 13px;
    --radius-kind: 13px;
    --radius-seller: 14px;
    --radius-wanted: 15px;
    --radius-card: 17px;
    --radius-hero-mobile: 18px;
    --radius-panel: var(--radius);
    --radius-cta: 20px;
    --radius-photo: 21px;
    --radius-dialog: 22px;
    --radius-hero: 26px;

    /* -------------------------------------------------------------------------
       Shadows & elevation
       ------------------------------------------------------------------------- */
    --shadow-card: var(--shadow);
    --shadow-primary-btn: 0 2px 3px #0c4d4217;
    --shadow-save-btn: 0 2px 10px #233b3030;
    --shadow-dialog: 0 26px 75px #0b251e42;
    --shadow-sticky-cta: 0 3px 14px #053b3845;
    --backdrop-dialog: blur(3px);
    --backdrop-mobile-nav: blur(12px);

    /* -------------------------------------------------------------------------
       Sizing / components
       ------------------------------------------------------------------------- */
    --touch-target: 44px;
    --btn-height: 44px;
    --btn-height-market: 50px;
    --iconbtn-size: 44px;
    --iconbtn-filter-size: 50px;
    --save-btn-size: 41px;
    --search-go-size: 36px;
    --avatar-size: 41px;
    --avatar-large: 61px;
    --tile-icon-size: 43px;
    --header-height: 73px;
    --header-height-md: 61px;
    --header-height-sm: 58px;
    --logo-width: 132px;
    --logo-width-md: 116px;
    --logo-footer-width: 107px;
    --wrap-max: 1280px;
    --wrap-gutter: 80px;
    --wrap-gutter-md: 48px;
    --wrap-gutter-sm: 28px;
    --narrow-max: 710px;
    --hero-min-height: 397px;
    --card-photo-ratio: 1.42;
    --card-photo-ratio-md: 1.2;
    --card-photo-ratio-sm: 1.12;
    --detail-photo-ratio: 1.3;
    --inbox-nav-width: 270px;
    --ops-nav-width: 183px;
    --work-aside-width: 265px;
    --mobile-nav-height: 55px;
    --dialog-max: 540px;
    --dialog-wide-max: 710px;
    --toast-radius: 10px;
    --focus-ring-width: 3px;
    --focus-ring-offset: 3px;

    /* -------------------------------------------------------------------------
       Z-index
       ------------------------------------------------------------------------- */
    --z-header: 2;
    --z-skip: 20;
    --z-toast: 25;
    --z-mobile-nav: 4;
    --z-dialog: 30;

    /* -------------------------------------------------------------------------
       Breakpoints (use raw px in @media — custom props are not valid in MQ)
       Tablet (iPad portrait ~768) hits --bp-lg. Phone (~390) hits --bp-md.
       ------------------------------------------------------------------------- */
    --bp-xl: 1060px; /* large tablet landscape / small laptop */
    --bp-lg: 800px; /* iPad portrait / compact tablet */
    --bp-md: 650px; /* phone / phablet — mobile shell */
    --bp-sm: 375px; /* small phone */

    /* Device reference widths (audit targets, not media queries) */
    --device-ipad-portrait: 768px;
    --device-ipad-landscape: 1024px;
    --device-phone: 390px;
    --device-phone-sm: 375px;

    /* -------------------------------------------------------------------------
       Responsive metric aliases (desktop defaults; override in @media below)
       ------------------------------------------------------------------------- */
    --hero-min-height-lg: 349px;
    --hero-min-height-sm: 365px;
    --hero-h1-lg: 65px;
    --hero-h1-sm: 61px;
    --hero-h1-xs: 56px;
    --hero-lead-lg: 14px;
    --hero-lead-sm: 13px;
    --hero-lead-max-lg: 235px;
    --hero-lead-max-sm: 162px;
    --hero-btn-font-sm: 12px;
    --hero-btn-font-xs: 11px;
    --hero-kicker-sm: 9px;
    --hero-media-opacity-sm: 0.88;
    --trust-font-sm: 10px;
    --trust-font-xs: 9px;
    --trust-icon-sm: 13px;
    --section-h2-sm: 25px;
    --section-lead-sm: 12px;
    --page-title-h1-sm: 34px;
    --detail-price-sm: 30px;
    --card-radius-sm: 12px;
    --listing-gap-lg: 10px;
    --market-gap-sm: 6px;
    --chip-font-sm: 12px;
    --location-max-sm: 94px;
    --sticky-cta-bottom: 63px;
    --toast-bottom-mobile: 69px;
    --footer-pad-bottom-mobile: 70px;
    --mobile-nav-label: 10px;
    --mobile-nav-label-color: #48635a;
    --mobile-nav-active: #086958;
    --mobile-sell-icon-bg: #e0f4e9;
    --mobile-sell-icon-color: #056353;

    /* -------------------------------------------------------------------------
       Motion
       ------------------------------------------------------------------------- */
    --transition-fast: 0.15s;
    --transition-card: 0.16s;
    --transition-toast: 0.18s;
    --ease-default: ease;

    color-scheme: light;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
}

/* Focus ring utility aligned with prototype */
.bazevu-focus-ring:focus-visible,
:where(button, a, input, textarea, select, summary):focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
}

/* =============================================================================
   Responsive token overrides (mirror prototype media queries)
   Reference devices: iPad landscape 1024, iPad portrait 768, phone 390 / 375
   ============================================================================= */

@media (max-width: 1060px) {
    :root {
        --wrap-gutter: 48px;
        --card-photo-ratio: 1.2;
        --ops-nav-width: 155px;
    }
}

@media (max-width: 800px) {
    :root {
        --header-height: 61px;
        --logo-width: 116px;
        --hero-min-height: 349px;
        --font-size-card-title: 14px;
        --font-size-card-price: 16px;
        --listing-gap-lg: 10px;
        --gap-listing-grid: 10px;
        --work-aside-width: 190px;
    }
}

@media (max-width: 650px) {
    :root {
        --wrap-gutter: 28px;
        --header-height: 58px;
        --logo-width: 116px;
        --hero-min-height: 365px;
        --radius-hero: 18px;
        --card-photo-ratio: 1.12;
        --radius-card: 12px;
        --font-size-card-title: 14px;
        --font-size-card-price: 16px;
        --font-size-detail-price: 30px;
        --btn-height-market: 44px;
        --iconbtn-filter-size: 44px;
        --tile-icon-size: 36px;
        --gap-listing-grid: 10px;
        --gap-wanted-grid: 8px;
        --section-margin-top: 22px;
        --home-padding-top: 13px;
        --mobile-nav-height: 55px;
    }
}

@media (max-width: 375px) {
    :root {
        --hero-h1-sm: 56px;
        --trust-font-sm: 9px;
    }
}
