/* =============================================================================
   JungleSherpa — shared front-end styles
   Included via <?php include '_styles.php' ?> inside a <style> tag.
   ============================================================================= */

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

:root {
    /* Palette */
    --ink:        #111110;
    --ink-mid:    #5a5750;
    --ink-faint:  #9e9b93;
    --ground:     #f7f6f2;
    --surface:    #ffffff;
    --rule:       #e5e2d9;

    /* Two distinct accent colours so badge and CTA never fight */
    --badge:      #d93a0a;   /* red-orange — % off badge, urgent #ff3366;*/
    --cta:        #3d348b; /*6987c9 1a5c8a; 1b9aaa  /* deep blue — action, calm authority */
    --cta-hover:  #7880b5; /*154e78;*/

    --sans:  'DM Sans', sans-serif;
    --serif: 'DM Serif Display', Georgia, serif;

    /* 18px base. Nothing rendered below 0.85rem (~15px) except legal small print. */
    font-size: 18px;
}

body {
    background: var(--ground);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Masthead ─────────────────────────────────────────────────────────────── */
.masthead {
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 50;
}
.masthead-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 28px;
}

/* Wordmark */
.brand {
    font-family: var(--sans);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1;
    flex-shrink: 0;
    color: var(--ink);
}
.brand span {
    color: var(--badge);
    font-style: italic;
}

.masthead-nav {
    display: flex;
    gap: 2px;
}
.masthead-nav a {
    padding: 5px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-mid);
    border-radius: 4px;
    white-space: nowrap;
    transition: color .1s, background .1s;
}
.masthead-nav a:hover,
.masthead-nav a.active { color: var(--ink); background: var(--ground); }

.masthead-right {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--badge);
    flex-shrink: 0;
    font-style: italic;
}

/* Hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    color: var(--ink);
}

/* Mobile nav drawer */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--surface);
    border-top: 1px solid var(--rule);
    padding: 8px 0 12px;
}
.mobile-nav a {
    padding: 11px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-mid);
}
.mobile-nav a:hover { color: var(--ink); }
.mobile-nav.open { display: flex; }

/* ── Page wrapper ─────────────────────────────────────────────────────────── */
.page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-head {
    padding: 36px 0 0;
    margin-bottom: 20px;
}
.page-head h1 {
    font-family: var(--serif);
    font-size: 2.1rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.page-head .sub {
    font-size: 0.9rem;
    color: var(--ink-faint);
    margin-top: 4px;
}

/* ── Toolbar (filter + sort) ──────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cat-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.cat-pill {
    padding: 6px 15px;
    border: 1.5px solid var(--rule);
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-mid);
    background: var(--surface);
    cursor: pointer;
    transition: all .12s;
    white-space: nowrap;
    font-family: var(--sans);
}
.cat-pill:hover { border-color: var(--ink-mid); color: var(--ink); }
.cat-pill.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sort-label {
    font-size: 0.88rem;
    color: var(--ink-faint);
}
.sort-btns { display: flex; gap: 4px; }
.sort-btn {
    padding: 6px 13px;
    border: 1.5px solid var(--rule);
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-mid);
    background: var(--surface);
    cursor: pointer;
    transition: all .12s;
    font-family: var(--sans);
}
.sort-btn:hover { border-color: var(--ink-mid); color: var(--ink); }
.sort-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

/* ── Deal list ────────────────────────────────────────────────────────────── */
.deal-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.deal-card {
    background: var(--surface);
    border: 1.5px solid var(--rule);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 2fr;   /* image = one third */
    overflow: hidden;
    position: relative;
    transition: border-color .15s, box-shadow .15s;
}
.deal-card:hover {
    border-color: #ccc9bf;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* Image column — fills one third, image centred within */
.deal-img-wrap {
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1.5px solid var(--rule);
    min-height: 200px;
}
.deal-img-wrap img {
    width: 100%;
    max-width: 220px;
    height: 200px;
    object-fit: contain;
    display: block;
}

/* Content column */
.deal-content {
    padding: 28px 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

/* % badge — large, absolute top-right */
.deal-pct {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--badge);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 5px 12px;
    border-radius: 5px;
    line-height: 1.2;
    white-space: nowrap;
}

/* Title — clear the badge with generous right padding */
.deal-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--ink);
    padding-right: 120px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pricing */
.deal-prices {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.deal-now {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.deal-was {
    font-size: 0.9rem;
    color: var(--ink-faint);
    text-decoration: line-through;
}
.deal-save {
    font-size: 0.9rem;
    color: var(--badge);
    font-weight: 600;
}

/* Editor note */
.deal-note {
    font-size: 0.9rem;
    color: var(--ink-mid);
    font-style: italic;
    line-height: 1.45;
    padding-left: 12px;
    border-left: 2px solid var(--rule);
}

/* CTA row */
.deal-footer {
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* CTA — deep blue, distinct from badge */
.deal-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 22px;
    background: var(--cta);
    color: #fff;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background .12s;
}
.deal-cta:hover { background: var(--cta-hover); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty {
    padding: 80px 0;
    text-align: center;
}
.empty h2 {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--ink-mid);
    margin-bottom: 8px;
}
.empty p { font-size: 0.9rem; color: var(--ink-faint); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--rule);
    padding: 40px 24px 28px;
    margin-top: 20px;
}
.footer-inner {
    max-width: 1040px;
    margin: 0 auto;
}
.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rule);
}
.footer-brand {
    font-family: var(--sans);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ink);
    display: block;
    margin-bottom: 8px;
}
.footer-brand span { color: var(--badge); font-style: italic; }
.footer-tagline {
    font-size: 0.88rem;
    color: var(--ink-faint);
    line-height: 1.5;
}
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-mid);
    margin-bottom: 4px;
}
.footer-col a {
    font-size: 0.88rem;
    color: var(--ink-faint);
    transition: color .1s;
}
.footer-col a:hover { color: var(--ink-mid); }

.footer-bottom {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--ink-faint);
}
.affiliate-note {
    font-size: 0.82rem;
    color: var(--ink-faint);
    line-height: 1.6;
    width: 100%;
    margin-top: 4px;
}

@media (max-width: 600px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
    .footer-brand-col { grid-column: 1 / -1; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
    :root { font-size: 17px; }

    .masthead-nav,
    .masthead-right { display: none; }
    .nav-toggle { display: block; }

    /* Stack: image above content */
    .deal-card { grid-template-columns: 1fr; }
    .deal-img-wrap {
        border-right: none;
        border-bottom: 1.5px solid var(--rule);
        padding: 22px;
        min-height: 0;
        height: 220px;
    }
    .deal-img-wrap img {
        max-width: 100%;
        height: 180px;
    }
    .deal-content { padding: 18px; }
    .deal-pct {
        top: 16px;
        right: 16px;
        font-size: 1rem;
    }
    .deal-title {
        font-size: 0.95rem;
        padding-right: 90px;
    }
    .deal-now { font-size: 1.2rem; }

    /* CTA full width on mobile */
    .deal-footer { justify-content: stretch; }
    .deal-cta { width: 100%; justify-content: center; }

    .sort-wrap { width: 100%; }
    .page-head h1 { font-size: 1.6rem; }
}
