/* ============================================================
   SproutSmart — Base / Global Styles (base.css)
   Loaded on every page via base.html.
   ============================================================ */

:root {
    /* Brand palette — derived from SproutSmart logo */
    --c-lime:        #7DC52F;   /* bright logo lime highlight */
    --c-green:       #2A6B1A;   /* deep forest green */
    --c-green-mid:   #3A8A25;   /* mid green for hover states */
    --c-green-mid:   #3A8A25;   /* mid green for hover states */
    --c-teal:        #1E8A6E;   /* teal accent from S-curve */
    --c-teal-light:  #E4F4EF;   /* teal tint for surfaces */
    --c-lime-light:  #EEF7E2;   /* lime tint for alternating rows */
    --c-bg:          #F7FAF4;   /* warm off-white with green undertone */
    --c-surface:     #FFFFFF;
    --c-border:      #D0E8C4;
    --c-text:        #1A2B18;   /* near-black, green-tinted */
    --c-text-muted:  #556B50;
    --c-amber:       #E8951A;   /* warm amber for callouts */
    --c-amber-mid:   #c97d14;   /* darker amber for hover states */
    --c-amber-light: #FEF3DC;
}

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

/* Prevent layout shift when a scrollbar appears/disappears.
   body { width: 100vw } means the content box is always sized to the full
   viewport width including any scrollbar — so no shift ever occurs.
   overflow-x: hidden clips the tiny overflow caused by 100vw > available width.
   No scrollbar-gutter needed, so no gray reserved-space bar. */
html {
    overflow-x: hidden;
    scrollbar-color: rgba(0,0,0,0.22) transparent; /* Firefox */
}
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.22);
    border-radius: 4px;
}
html::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.35); }

body {
    width: 100vw;           /* always sized to full viewport incl. scrollbar — no shift */
    overflow-x: hidden;     /* clip the ~8px overflow when scrollbar is absent */
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.65;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ── */
header {
    background: var(--c-green);
    border-bottom: 3px solid var(--c-lime);
    padding: 0.75rem 0 0;
    display: flex;
    align-items: flex-end;
    overflow: visible;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: flex-end;
}
.site-brand {
    text-decoration: none;
    display: flex;
    align-items: flex-end;
    gap: 0.9rem;
    margin-bottom: -25px;
}
.site-brand img { height: 118px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; gap: 0.15rem; padding-bottom: 45px; }
.brand-name { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.brand-name .brand-sprout { color: #fff; }
.brand-name .brand-smart  { color: var(--c-lime); }
.brand-tag { color: rgba(255,255,255,0.55); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; }
.brand-tm {
    font-size: 0.45em;
    font-weight: 400;
    vertical-align: super;
    opacity: 0.7;
    letter-spacing: 0;
    color: #fff;
}

/* ── About page ── */
.about-wrap { max-width: 720px; }
.about-lead {
    font-size: 1.1rem;
    color: var(--c-text);
    margin-bottom: 2rem;
    line-height: 1.6;
}
.about-section { margin-bottom: 2.25rem; }
.about-section ul { margin: 0.75rem 0 0 1.5rem; }
.about-section ul li { margin-bottom: 0.6rem; color: var(--c-text-muted); }

/* ── Main content ── */
main { flex: 1; width: 100%; max-width: 1100px; margin: 2rem auto; padding: 0 2rem; }

/* ── Footer ── */
.site-footer {
    margin-top: 4rem;
    background: #0f3d50;
    color: rgba(255,255,255,0.78);
}
.site-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem;
}
/* Link colours inside dark footer — unlayered specificity beats base `a` selector */
.site-footer a {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
}
.site-footer a:hover {
    color: #fff;
    text-decoration: underline;
}
/* DaisyUI .footer-title: reset its opacity so we control colour directly */
.site-footer .footer-title {
    opacity: 1;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.08em;
}
.site-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.site-footer-logo {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}
.site-footer-brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}
.site-footer-brand-name .brand-smart { color: var(--c-lime); }
.site-footer-tagline {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    margin: 0;
    line-height: 1.55;
}
.site-footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
}
.site-footer-bottom-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.38);
}
.site-footer-version { opacity: 0.85; font-size: 0.82rem; }

/* ── Typography ── */
h1 { font-size: 1.9rem; color: var(--c-green); margin-bottom: 0.4rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; color: var(--c-green); margin: 1.75rem 0 0.6rem; font-weight: 700; }
h3 { font-size: 1rem; color: var(--c-text); margin: 1rem 0 0.4rem; font-weight: 600; }
p  { margin-bottom: 1rem; color: var(--c-text-muted); }
a  { color: var(--c-teal); text-decoration: none; }
a:hover { color: var(--c-green); text-decoration: underline; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; background: var(--c-surface); border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
th, td { padding: 0.65rem 1rem; text-align: left; }
th { background: var(--c-green-mid); color: #fff; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
td { border-bottom: 1px solid #b8d9a8; font-size: 0.95rem; }
tr:last-child td { border-bottom: none; }
tr.row-even td { background: #f3f8ee; }
tr.crop-row:hover td { background: #e0f2ec !important; }
tbody tr:hover td { background: #e0f2ec; }

/* ── Badges ── */
.badge {
    display: inline-block;
    background: var(--c-lime-light);
    color: var(--c-green);
    border: 1px solid var(--c-lime);
    padding: 0.2rem 0.7rem;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ── Callout boxes ── */
/* Icons via CSS ::before with inline SVG data URIs */
.note-box, .info-box, .affiliate-box, .warning-box {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding-left: 1.1rem;
}
.note-box::before, .info-box::before, .affiliate-box::before, .warning-box::before {
    content: '';
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.18em;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.note-box {
    background: var(--c-amber-light);
    border-left: 4px solid var(--c-amber);
    padding-top: 0.9rem;
    padding-right: 1.1rem;
    padding-bottom: 0.9rem;
    margin: 1.5rem 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.93rem;
}
/* Circled exclamation — amber */
.note-box::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8951A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Ccircle cx='12' cy='16' r='0.5' fill='%23E8951A'/%3E%3C/svg%3E");
}
.note-box strong { color: var(--c-amber); }

.warning-box {
    background: var(--c-amber-light);
    border-left: 4px solid var(--c-amber);
    padding-top: 0.9rem;
    padding-right: 1.1rem;
    padding-bottom: 0.9rem;
    margin: 1.5rem 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.93rem;
}
/* Circled exclamation — amber */
.warning-box::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E8951A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Ccircle cx='12' cy='16' r='0.5' fill='%23E8951A'/%3E%3C/svg%3E");
}
.warning-box strong { color: var(--c-amber); }

.info-box {
    background: var(--c-teal-light);
    border-left: 4px solid var(--c-teal);
    padding-top: 0.9rem;
    padding-right: 1.1rem;
    padding-bottom: 0.9rem;
    margin: 1.5rem 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.93rem;
}
/* Circled "i" — teal */
.info-box::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E8A6E' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Ccircle cx='12' cy='8' r='0.5' fill='%231E8A6E'/%3E%3C/svg%3E");
}
.info-box strong { color: var(--c-teal); white-space: nowrap; }
.note-box strong { white-space: nowrap; }
.warning-box strong { white-space: nowrap; }

.affiliate-box {
    background: var(--c-lime-light);
    border-left: 4px solid var(--c-lime);
    padding-top: 0.9rem;
    padding-right: 1.1rem;
    padding-bottom: 0.9rem;
    margin: 1.5rem 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.93rem;
}
/* Leaf / sprout — green */
.affiliate-box::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A6B1A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22V12'/%3E%3Cpath d='M12 12C12 7 16 3 21 3C21 8 17 12 12 12Z'/%3E%3Cpath d='M12 12C12 7 8 3 3 3C3 8 7 12 12 12Z'/%3E%3C/svg%3E");
}
.affiliate-box strong { color: var(--c-green); }

/* ── Card ── */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}

/* ── Responsive tables ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
td { white-space: nowrap; }

/* ── Header nav ── */
.header-nav {
    margin-left: auto;
    padding-bottom: 14px;
    display: flex;
    align-items: center;
}

/* ── Nav pill bar ── */
.nav-pills {
    display: flex;
    align-items: center;
}

.nav-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 7.5rem;
    padding: 0.35rem 0.9rem 0.35rem 1.3rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 0 99px 99px 0;
    margin-left: -14px;
    background: var(--c-green);
    color: #fff;
    transition: filter 0.15s;
}
.nav-pill:hover { filter: brightness(1.15); color: #fff; text-decoration: none; }

.nav-pill--first {
    border-radius: 99px;
    margin-left: 0;
    padding-left: 0.9rem;
}

/* Stacking: leftmost pill sits on top */
.nav-pills .nav-pill:nth-child(1) { z-index: 30; }
.nav-pills .nav-pill:nth-child(2) { z-index: 20; }
.nav-pills .nav-pill:nth-child(3) { z-index: 10; }

/* Color progression: lime → mid-green → forest green */
.nav-pills .nav-pill:nth-child(1) { background: #166534; color: #fff; border-color: var(--c-lime); border-width: .1em;}
.nav-pills .nav-pill:nth-child(1):hover { filter: brightness(1.15); color: #fff; }
.nav-pills .nav-pill:nth-child(2) { background: #4E8E22; }
.nav-pills .nav-pill:nth-child(3) { background: #1D5912; }

/* Guest Sign-in adapts: full pill when badge is hidden, second pill when badge shows */
.nav-pills--guest .nav-pill--signin { background: #4E8E22; }
.nav-pills--guest:has(.garden-badge--hidden) .nav-pill--signin {
    border-radius: 99px;
    margin-left: 0;
    padding-left: 0.9rem;
    background: var(--c-lime);
    color: var(--c-text);
}
.nav-pills--guest:has(.garden-badge--hidden) .nav-pill--signin:hover { color: var(--c-text); }

/* Keep hidden utility for HTMX badge OOB swap */
.garden-badge--hidden { display: none !important; }

/* ── Crop detail header ── */
.detail-header {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.detail-header h1 { margin-bottom: 0; flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: nowrap; }

/* ── Back link (shared navigation component) ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--c-text-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
}
.back-link:hover { color: var(--c-green); text-decoration: none; }

/* ── Legal pages (privacy / terms) ── */
.legal-date { color: var(--c-text-muted); font-size: 0.82rem; margin-bottom: 1.5rem; }
main ul { margin: 0.5rem 0 1rem 1.5rem; color: var(--c-text-muted); }
main ul li { margin-bottom: 0.35rem; }

/* ── Alerts ── */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.alert--success { background: var(--c-teal-light); color: var(--c-teal); border: 1px solid #b0ddd3; }
.alert--error   { background: var(--c-amber-light); color: #7a4a00; border: 1px solid #f0c980; }

/* ── Contact form ── */
.form-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 1.75rem;
    max-width: 560px;
    margin-top: 1.25rem;
}
.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 0.3rem;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--c-teal);
    background: #fff;
}
.form-group--error input,
.form-group--error textarea { border-color: var(--c-amber); }
.form-error { color: #7a4a00; font-size: 0.8rem; margin-top: 0.25rem; }
.btn-primary {
    background: var(--c-green);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--c-green-mid); }

/* ── Legal consent line (below sign-up buttons) ── */
.form-legal-notice {
    font-size: 0.8rem;
    color: #666;
    margin-top: 12px;
    line-height: 1.4;
}
.form-legal-notice a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
}
.form-legal-notice a:hover { text-decoration: underline; }

/* ── Scroll buffer — masks content scrolling up under the sticky header ── */
.scroll-buffer {
    position: sticky;
    top: var(--header-h, 90px);
    height: 1.85rem;
    background: var(--c-bg);
    z-index: 99;
    margin-bottom: -1.55rem;
    pointer-events: none;
}

/* ── Page top bar — consistent anchor above every page h1 ── */
/* Acts as a fixed-height row above the page heading on all views.
   Pages slot in breadcrumbs or the garden switcher via {% block page_top_bar %}.
   Pages with no content still get the same vertical space, keeping h1 aligned.
   Full-width, but inner padding matches main's 2rem side + 1100px max-width
   so content left-edge is flush with the page body. */
.page-top-bar {
    width: 100%;
    padding: 1.85rem 0 0.75rem;    /* more top breathing room; bottom aligns to h1 */
    min-height: 4rem;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
/* Constrain inner content to match main's column */
.page-top-bar > * {
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* ── Hamburger toggle (hidden checkbox trick — no JS) ── */
.nav-toggle-check { display: none; }

.nav-hamburger {
    display: none;          /* shown only at mobile breakpoint */
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 6px 4px;
    margin-left: auto;
    margin-bottom: 14px;
}
.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
}
/* Animate to × when checked */
.nav-toggle-check:checked ~ .nav-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle-check:checked ~ .nav-hamburger span:nth-child(2) { opacity: 0; }
.nav-toggle-check:checked ~ .nav-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile ── */
@media (max-width: 800px) {
    .nav-hamburger { display: flex; }

    /* Pill bar: hidden by default, revealed when toggle is checked */
    .nav-pills {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--c-green);
        border-top: 2px solid var(--c-lime);
        border-bottom: 3px solid var(--c-lime);
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0;
        z-index: 200;
    }
    .nav-toggle-check:checked ~ .nav-pills { display: flex; }

    /* Reset pill shapes for vertical list */
    .nav-pill {
        border-radius: 0;
        margin-left: 0;
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-width: unset;
        width: 100%;
        justify-content: flex-end;
    }
    .nav-pill--first { border-radius: 0; padding-left: 1.25rem; }
    .nav-pills .nav-pill:nth-child(1) { background: #166534; }
    .nav-pills .nav-pill:nth-child(2) { background: #1a5c14; }
    .nav-pills .nav-pill:nth-child(3) { background: #143f0f; }
    .nav-pills--guest .nav-pill--signin { background: #1a5c14; border-radius: 0; margin-left: 0; padding-left: 1.25rem; }
    .nav-pills--guest:has(.garden-badge--hidden) .nav-pill--signin {
        border-radius: 0;
        margin-left: 0;
        padding-left: 1.25rem;
        background: var(--c-lime);
    }
}

@media (max-width: 600px) {
    header { padding: 0.5rem 1rem 0; }
    .site-brand img { height: 80px; }
    .brand-name { font-size: 1.4rem; }
    .brand-text { padding-bottom: 32px; }
    .site-brand { margin-bottom: -18px; }
    main { padding: 0 1rem; margin-top: 1.25rem; }
    .site-footer-inner { padding: 2rem 1rem 1.5rem; }
    .site-footer-bottom-inner { padding: 0.75rem 1rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.1rem; }
    .header-nav { padding-bottom: 10px; }
    .nav-pill { font-size: 0.75rem; padding: 0.25rem 0.75rem 0.25rem 1.1rem; }
    .nav-pill--first { padding-left: 0.6rem; }
    .nav-pills--guest:has(.garden-badge--hidden) .nav-pill--signin { padding-left: 0.6rem; }
    .detail-header { flex-wrap: wrap; }
    .detail-header h1 { flex: 0 0 100%; }
}
