/* Design tokens ported from the Terelion Figma export (Figma Make).
   Palette: brand greens (#1f5c2e dark / #2d6a35 medium / #f0faf2 tint),
   neutral grays for text, DM Sans for display headings, Inter for body. */

:root {
    --brand-dark: #1f5c2e;
    --brand: #2d6a35;
    --brand-tint: #f0faf2;
    --brand-chip-bg: #e8f5e9;
    --brand-chip-border: #c8e6c9;
    --ink: #111827;
    --ink-soft: #374151;
    --muted: #6b7280;
    --muted-2: #9ca3af;
    --border: #e5e7eb;
    --border-soft: #d1d5db;
    --bg: #fafafa;
    --bg-soft: #f3f4f6;
    --danger: #b42318;
}

body.terelion-app {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
}

.terelion-app .font-display {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* ---------- Buttons ---------- */
.btn-brand {
    background-color: var(--brand);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color .15s ease;
}
.btn-brand:hover { background-color: var(--brand-dark); color: #fff; }

.btn-brand-outline {
    background-color: #fff;
    color: var(--ink-soft);
    border: 1px solid var(--border-soft);
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color .15s ease;
}
.btn-brand-outline:hover { background-color: #f9fafb; }

.btn-pill-outline {
    background: #fff;
    color: var(--brand-dark);
    border: 1px solid var(--brand-chip-border);
    border-radius: 999px;
    font-weight: 700;
    transition: background-color .15s ease;
}
.btn-pill-outline:hover { background-color: var(--brand-tint); }

.btn-pill {
    background: var(--brand-dark);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    transition: background-color .15s ease;
}
.btn-pill:hover { background-color: #2e7d32; }

/* ---------- Filter chips ---------- */
.chip {
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    border: 1px solid var(--brand-chip-border);
    background-color: var(--brand-chip-bg);
    color: var(--brand-dark);
    transition: all .15s ease;
    cursor: pointer;
}
.chip.is-active {
    background-color: var(--brand-dark);
    color: #fff;
    border-color: var(--brand-dark);
}

/* ---------- Cards ---------- */
.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: .75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,.12);
}
.product-card:hover .product-card-icon { transform: scale(1.08); }
/* Product list: fixed, responsive media area */
.product-card-media {
    position: relative;            /* anchors the category badge */
    width: 100%;
    height: 200px;                 /* fixed frame */
    padding: 0;                    /* image uses the full frame */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6f7;
    overflow: hidden;
    box-sizing: border-box;
}
@media (min-width: 992px) { .product-card-media { height: 240px; } }
@media (max-width: 576px) { .product-card-media { height: 180px; } }

.product-card-media img,
.product-card-img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;           /* keeps ratio, no squeeze or stretch */
    object-position: center;
    display: block;
    mix-blend-mode: multiply;
}

.product-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform .2s ease;
}
.product-card-icon svg {
    max-width: 55%;
    max-height: 55%;
    width: auto;
    height: auto;
}

/* Clamp long titles to 2 lines so buttons line up across rows */
.product-card h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}
.product-card:hover .compare-toggle { opacity: 1 !important; }

.category-card {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: 1rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    transition: transform .3s ease, box-shadow .3s ease;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0,0,0,.14);
}
.category-card:hover .category-card-icon { transform: scale(1.1); }
.category-card-media {
    height: auto;                  /* was fixed 220px: the 4/3 image frame grew taller on mobile and covered the title */
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(145deg, #f0f7f1 0%, #e8f4ea 100%);
    background-image: radial-gradient(circle, rgba(45,106,53,.2) 1px, transparent 1px);
    background-size: 24px 24px;
}
.category-card-icon { transition: transform .3s ease; }
.category-card-bar {
    height: 4px;
    width: 0;
    background-color: var(--brand);
    transition: width .3s ease;
}
.category-card:hover .category-card-bar { width: 100%; }

/* ---------- Quote panel (slide-out cart) ---------- */
.quote-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: min(360px, 92vw);
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e0ede2;
    box-shadow: -8px 0 24px rgba(0,0,0,.14);
    z-index: 1050;
    transition: right .25s ease-in-out;
    display: flex;
    flex-direction: column;
}
.quote-panel.is-open { right: 0; }
.quote-line {
    border: 1px solid #e0ede2;
    background: #f9fff6;
    border-radius: 10px;
    padding: .6rem .65rem;
}
.quote-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 1040;
    display: none;
}
.quote-backdrop.is-open { display: block; }

/* ---------- Profile modal ---------- */
.profile-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
}
.profile-modal-backdrop.is-open { display: flex; }
.profile-modal-header {
    background: linear-gradient(135deg, #0f421d 0%, #1a5c2a 55%, #2e7d32 100%);
}

/* ---------- Filter sidebar ---------- */
.filter-sidebar {
    flex: 0 0 280px;
}
@media (max-width: 991.98px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-height: 100vh;
        overflow-y: auto;
        z-index: 1060;
        transition: right .3s ease;
    }
    .filter-sidebar.is-open { right: 0; }
}

/* ---------- Category landing page hero background ---------- */
.terelion-category-hero-bg {
    position: relative;
    isolation: isolate;
    background-color: var(--bg-soft);
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    overflow: hidden;
}
.terelion-category-hero-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,.10) 42%, rgba(255,255,255,.03) 100%);
}
.terelion-category-hero-bg > * {
    position: relative;
    z-index: 1;
}
@media (max-width: 768px) {
    .terelion-category-hero-bg { background-position: 70% center; }
}

/* Fixed, responsive image area */
.category-card-icon {
    width: 100%;
}

.category-card-icon-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;          /* same frame for every card */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;             /* one uniform background for all cards */
    overflow: hidden;             /* nothing spills outside the frame */
    padding: 12px;
    box-sizing: border-box;
}

.category-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;          /* keeps ratio, no squeeze or stretch */
    object-position: center;
    display: block;
    mix-blend-mode: multiply;     /* optional: hides white/grey image backgrounds */
}
.category-card-icon-wrap svg {
    max-width: 60%;
    max-height: 60%;
    width: auto;
    height: auto;
}

/* Keep the image frame in normal flow so it never overlaps the card title */
.category-card-icon,
.category-card-icon-wrap {
    position: relative;
    flex-shrink: 0;
}
@media (max-width: 576px) {
    .category-card-icon-wrap { aspect-ratio: 16 / 10; }   /* slightly shorter frame on phones */
}

.category-card:hover .category-card-img {
    transform: scale(1.05);
}


/* ---------- Product detail page: image frame ---------- */
.product-detail-media {
    width: 100%;
    height: 340px;                 /* fixed frame */
    background-color: #eaf3de;
    border: 1px solid #e0ede2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;              /* nothing spills outside the frame */
    padding: 16px;
    box-sizing: border-box;
}
.product-detail-img {
    width: 100%;
    height: 100%;
    object-fit: contain;           /* whole image visible, no crop, no squeeze */
    object-position: center;
    display: block;
    mix-blend-mode: multiply;
}
.product-detail-media svg {
    max-width: 50%;
    max-height: 50%;
}
.product-thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #e0ede2;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
}
.product-thumb:hover { border-color: #1a5c2a; }
@media (max-width: 576px) {
    .product-detail-media { height: 260px; }
}

 /* Hide Microsoft Edge's built-in show/hide password icon */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

/* ---------- Catalogue: independent vertical scroll (desktop) ---------- */
@media (min-width: 992px) {

    /* Product grid scrolls on its own */
    #catalogue-grid {
        max-height: calc(100vh - 220px);   /* adjust 220px to your header + title bar height */
        overflow-y: auto;
        overflow-x: hidden;
        padding: 6px 4px 16px;             /* room so the card hover lift and shadow aren't clipped */
        scrollbar-gutter: stable;
        scrollbar-width: thin;             /* Firefox */
        scrollbar-color: #c8e6c9 transparent;
    }
    #catalogue-grid::-webkit-scrollbar { width: 8px; }
    #catalogue-grid::-webkit-scrollbar-thumb { background: #c8e6c9; border-radius: 8px; }
    #catalogue-grid::-webkit-scrollbar-thumb:hover { background: var(--brand); }

    /* Filter sidebar scrolls on its own */
    #catalogue-filters {
        max-height: calc(100vh - 260px);   /* leaves room for the "Filters / Clear" heading above it */
        overflow-y: auto;
        padding-right: 6px;
        scrollbar-width: thin;
        scrollbar-color: #c8e6c9 transparent;
    }
    #catalogue-filters::-webkit-scrollbar { width: 6px; }
    #catalogue-filters::-webkit-scrollbar-thumb { background: #c8e6c9; border-radius: 6px; }
}

/* ---------- Floating "back to top" button ---------- */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background-color: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,.22);
    cursor: pointer;
    z-index: 1030;                 /* below the quote panel (1040/1050) and modals */
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease, background-color .15s ease;
}
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover { background-color: var(--brand-dark); }
.back-to-top:focus-visible { outline: 3px solid var(--brand-chip-border); outline-offset: 2px; }

@media (max-width: 576px) {
    .back-to-top { right: 14px; bottom: 16px; width: 40px; height: 40px; }
}

/* ---------- Alerts: highlighted error ---------- */
.alert-error,
.alert-danger {
    background-color: #fef3f2;
    color: var(--danger);
    border: 1px solid #fecdca;
    border-left: 4px solid var(--danger);
    border-radius: .5rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(180, 35, 24, .12);
}
.alert-error .btn-close,
.alert-danger .btn-close {
    padding: .85rem .75rem;
}

body.terelion-app {
    min-height: 100vh;
    min-height: 100dvh;          /* correct height on mobile browsers */
    display: flex;
    flex-direction: column;
}
body.terelion-app > main {
    flex: 1 0 auto;              /* content takes the free space, footer sits below it */
}
.site-footer {
    flex-shrink: 0;
    font-size: .8125rem;
}
@media (max-width: 767.98px) {
    .site-footer { font-size: .75rem; }
}