/* ==========================================================================
   Native vs. Invasive Field Guide & Swap Planner
   Layered on root /styles.css with safe botanical & strategist tokens
   ========================================================================== */
:root {
    --fg-bg: #f6f5f0;
    --fg-surface: #ffffff;
    --fg-muted: #f0efe8;
    --fg-ink: #1b241f;
    --fg-ink-muted: #4b5851;
    --fg-border: #d8ddd7;
    --fg-forest: #1f513b;
    --fg-forest-dark: #143828;
    --fg-forest-soft: #e6f2ec;
    --fg-invasive: #9f1239;
    --fg-invasive-soft: #fff1f2;
    --fg-invasive-border: #fecdd3;
    --fg-amber: #b45309;
    --fg-amber-soft: #fef3c7;
    --strat-ink: #1e1b4b;
    --strat-accent: #4338ca;
    --strat-accent-dark: #312e81;
    --strat-surface: #eef2ff;
    --strat-border: #c7d2fe;
}

body {
    background: var(--fg-bg);
    color: var(--fg-ink);
}

/* Lab Nav Bar */
.lab-nav {
    background: var(--fg-forest-dark);
    color: #ffffff;
    padding: 0.75rem 0;
}

.lab-nav-inner {
    width: min(1140px, 92%);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lab-nav .back-link,
.lab-nav .fullscreen-link {
    color: #d6ede1;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.lab-nav .back-link:hover,
.lab-nav .fullscreen-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.nav-badge {
    font-size: 0.78rem;
    color: #b7dec9;
    font-weight: 600;
}

.fullscreen-link {
    display: none;
}

/* Main Container & Header */
.tool-container {
    width: min(1140px, 92%);
    margin: 0 auto;
    padding: 1.75rem 0 2.5rem;
}

.tool-header {
    margin-bottom: 1.5rem;
}

.tool-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--fg-forest);
}

.tool-header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.65rem, 3vw, 2.3rem);
    line-height: 1.2;
    color: var(--fg-ink);
}

.tool-subtitle {
    margin: 0;
    max-width: 74ch;
    font-size: 1.02rem;
    color: var(--fg-ink-muted);
    line-height: 1.55;
}

/* Embed Mode (?embed=true) */
body.embed-mode .lab-nav .back-link,
body.embed-mode .nav-badge,
body.embed-mode .tool-header,
body.embed-mode .framing-grid,
body.embed-mode .guide-panel,
body.embed-mode .tool-footer {
    display: none;
}

body.embed-mode .fullscreen-link {
    display: inline-block;
}

body.embed-mode .tool-container {
    padding-top: 1rem;
}

/* Framing Grid & Shared Panels */
.framing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.framing-card,
.panel {
    background: var(--fg-surface);
    border: 1px solid var(--fg-border);
    border-radius: 12px;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 2px 10px rgba(27, 36, 31, 0.05);
}

.framing-card h2 {
    margin: 0 0 0.4rem;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-forest);
}

.framing-card p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--fg-ink-muted);
    line-height: 1.55;
}

/* Guide Panel Accent Override */
.guide-panel .guide-walkthrough {
    border-left-color: var(--fg-forest);
}

.guide-panel .guide-subhead {
    color: var(--fg-forest);
}

/* Control Deck */
.control-deck {
    margin-bottom: 1.35rem;
}

.controls-top {
    display: grid;
    grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1fr);
    gap: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--fg-border);
}

.control-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-ink-muted);
    margin-bottom: 0.5rem;
}

.zip-input-row {
    display: flex;
    gap: 0.6rem;
}

.zip-input-row input {
    flex: 1;
    min-width: 120px;
    padding: 0.65rem 0.85rem;
    font-size: 1rem;
    border: 1.5px solid var(--fg-border);
    border-radius: 8px;
    color: var(--fg-ink);
    background: #ffffff;
}

.zip-input-row input:focus {
    outline: 3px solid rgba(31, 81, 59, 0.25);
    border-color: var(--fg-forest);
}

.field-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.81rem;
    color: var(--fg-ink-muted);
}

/* Buttons & Chips */
.btn-primary,
.btn-secondary,
.btn-strategist,
.chip-btn,
.space-btn,
.pair-tab-btn,
.nav-arrow-btn {
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--fg-forest);
    color: #ffffff;
    border: 1.5px solid var(--fg-forest);
    border-radius: 8px;
    padding: 0.65rem 1.1rem;
    font-size: 0.92rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--fg-forest-dark);
    border-color: var(--fg-forest-dark);
}

.btn-secondary {
    background: #ffffff;
    color: var(--fg-forest);
    border: 1.5px solid var(--fg-forest);
    border-radius: 8px;
    padding: 0.55rem 0.95rem;
    font-size: 0.88rem;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--fg-forest-soft);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.chip-btn {
    background: var(--fg-muted);
    border: 1.5px solid var(--fg-border);
    color: var(--fg-ink);
    border-radius: 999px;
    padding: 0.48rem 0.9rem;
    font-size: 0.85rem;
}

.chip-btn:hover {
    border-color: var(--fg-forest);
    color: var(--fg-forest);
}

.chip-btn[aria-pressed="true"] {
    background: var(--fg-forest);
    border-color: var(--fg-forest);
    color: #ffffff;
}

.status-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1.1rem;
}

.location-status h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.region-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--fg-ink-muted);
}

.eco-pill {
    display: inline-block;
    background: var(--fg-forest-soft);
    color: var(--fg-forest-dark);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}

.error-banner {
    background: #fff1f2;
    border: 1.5px solid #fda4af;
    color: #881337;
    border-radius: 10px;
    padding: 0.9rem 1.15rem;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

/* Section Headers */
.section-block {
    margin-bottom: 1.5rem;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.15rem;
}

.step-pill {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-forest);
    background: var(--fg-forest-soft);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 0.4rem;
}

.section-title {
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
}

.section-subtext {
    margin: 0;
    font-size: 0.92rem;
    color: var(--fg-ink-muted);
}

/* ==========================================================================
   Step 1: Swipeable Invasive vs. Native Lookalike Deck
   ========================================================================== */
.deck-nav-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--fg-border);
}

.pair-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.pair-tab-btn {
    background: var(--fg-muted);
    border: 1.5px solid var(--fg-border);
    color: var(--fg-ink);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
}

.pair-tab-btn[aria-selected="true"] {
    background: var(--fg-ink);
    border-color: var(--fg-ink);
    color: #ffffff;
}

.deck-arrows {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.pair-counter {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--fg-ink-muted);
    padding: 0 0.35rem;
}

.nav-arrow-btn {
    background: #ffffff;
    border: 1.5px solid var(--fg-border);
    color: var(--fg-ink);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.nav-arrow-btn:hover {
    border-color: var(--fg-forest);
    color: var(--fg-forest);
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

.plant-compare-card {
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid var(--fg-border);
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.plant-compare-card.is-invasive {
    border-color: var(--fg-invasive-border);
    background: #fffafb;
}

.plant-compare-card.is-native {
    border-color: #b7dec9;
    background: #f9fdfb;
}

.plant-photo-frame {
    position: relative;
    height: 195px;
    background: linear-gradient(135deg, #274c3b, #3e6b54);
    overflow: hidden;
}

.is-invasive .plant-photo-frame {
    background: linear-gradient(135deg, #6b1d2f, #9f1239);
}

.plant-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.92);
    text-align: center;
    padding: 1rem;
}

.photo-placeholder svg {
    width: 42px;
    height: 42px;
    opacity: 0.9;
}

.photo-placeholder span {
    font-size: 0.8rem;
}

.role-ribbon {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ffffff;
}

.ribbon-invasive {
    background: rgba(159, 18, 57, 0.92);
}

.ribbon-native {
    background: rgba(20, 56, 40, 0.92);
}

.compare-body {
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    flex: 1;
}

.compare-body h3 {
    margin: 0;
    font-size: 1.15rem;
}

.sci-name {
    margin: 0.1rem 0 0;
    font-style: italic;
    font-size: 0.86rem;
    color: var(--fg-ink-muted);
}

.cue-box {
    background: #ffffff;
    border: 1px solid var(--fg-border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    font-size: 0.89rem;
    line-height: 1.5;
}

.cue-box strong {
    display: block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    color: var(--fg-ink-muted);
}

.is-invasive .cue-box strong {
    color: var(--fg-invasive);
}

.is-native .cue-box strong {
    color: var(--fg-forest);
}

.photo-credit {
    margin: auto 0 0;
    padding-top: 0.45rem;
    font-size: 0.74rem;
    color: var(--fg-ink-muted);
}

.spot-difference-bar {
    margin-top: 1rem;
    background: var(--fg-amber-soft);
    border: 1px solid #fcd34d;
    border-left: 4px solid var(--fg-amber);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    font-size: 0.92rem;
    color: #451a03;
}

.spot-difference-bar strong {
    color: #78350f;
}

/* ==========================================================================
   Step 2: Pick 3 Native Replacements Builder
   ========================================================================== */
.space-selector-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.space-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.space-btn {
    background: var(--fg-muted);
    border: 1.5px solid var(--fg-border);
    color: var(--fg-ink);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

.space-btn:hover {
    border-color: var(--fg-forest);
    color: var(--fg-forest);
}

.space-btn[aria-pressed="true"] {
    background: var(--fg-forest);
    border-color: var(--fg-forest);
    color: #ffffff;
}

/* Live 3-Slot Habitat Plan Tray */
.plan-tray {
    background: var(--fg-forest-soft);
    border: 1.5px solid #b7dec9;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.plan-tray-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.plan-tray-top h3 {
    margin: 0;
    font-size: 1.04rem;
    color: var(--fg-forest-dark);
}

.plan-progress-badge {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #96cbb0;
    color: var(--fg-forest-dark);
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    margin-left: 0.5rem;
}

.plan-tray-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.plan-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.plan-slot {
    background: #ffffff;
    border: 1.5px dashed #96cbb0;
    border-radius: 9px;
    padding: 0.75rem 0.85rem;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.plan-slot.filled {
    border-style: solid;
    border-color: var(--fg-forest);
    justify-content: space-between;
}

.slot-empty-text {
    font-size: 0.83rem;
    color: var(--fg-ink-muted);
    text-align: center;
}

.slot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.4rem;
}

.slot-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--fg-ink);
}

.slot-meta {
    font-size: 0.78rem;
    color: var(--fg-ink-muted);
    margin-top: 0.25rem;
}

.slot-remove-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--fg-invasive);
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.slot-remove-btn:hover {
    background: var(--fg-invasive-soft);
}

/* Native Replacement Cards Grid */
.native-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.1rem;
}

.native-card {
    background: #ffffff;
    border: 1.5px solid var(--fg-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.native-card.is-selected {
    border-color: var(--fg-forest);
    box-shadow: 0 0 0 2px rgba(31, 81, 59, 0.2);
}

.native-card .plant-photo-frame {
    height: 155px;
}

.native-card-body {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

.native-card-body h3 {
    margin: 0;
    font-size: 1.08rem;
}

.spec-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.spec-pill {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--fg-muted);
    color: var(--fg-ink);
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
}

.wildlife-note {
    margin: 0;
    font-size: 0.87rem;
    color: var(--fg-ink-muted);
    line-height: 1.5;
}

.space-tip {
    margin: 0;
    font-size: 0.83rem;
    background: var(--fg-forest-soft);
    color: var(--fg-forest-dark);
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
}

.native-card-footer {
    margin-top: auto;
    padding-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pick-btn {
    width: 100%;
}

/* ==========================================================================
   Strategist Mode: Full-Funnel Overlay & Blueprint Layer
   ========================================================================== */
.btn-strategist {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    border: 1.5px solid var(--strat-accent);
    color: var(--strat-accent-dark);
    border-radius: 8px;
    padding: 0.58rem 0.95rem;
    font-size: 0.88rem;
}

.btn-strategist:hover {
    background: var(--strat-surface);
}

.btn-strategist .toggle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.15s ease;
}

.btn-strategist[aria-pressed="true"] {
    background: var(--strat-ink);
    border-color: var(--strat-ink);
    color: #ffffff;
}

.btn-strategist[aria-pressed="true"] .toggle-dot {
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.28);
}

.strategist-bar {
    background: linear-gradient(135deg, #1e1b4b, #2e2a6e);
    color: #ffffff;
    border-radius: 12px;
    padding: 1.35rem 1.45rem;
    margin-bottom: 1.4rem;
    box-shadow: 0 8px 24px rgba(30, 27, 75, 0.16);
    border: 1px solid #3730a3;
}

.strategist-bar[hidden] {
    display: none;
}

.strat-bar-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(199, 210, 254, 0.22);
}

.strat-eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a5b4fc;
}

.strat-bar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.strat-context-pill {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(199, 210, 254, 0.3);
    color: #e0e7ff;
    font-size: 0.79rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.funnel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 0.85rem;
}

.funnel-stage-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(199, 210, 254, 0.22);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.funnel-step-tag {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6ee7b7;
}

.funnel-stage-card h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #ffffff;
}

.funnel-stage-card p {
    margin: 0;
    font-size: 0.83rem;
    color: #e0e7ff;
    line-height: 1.45;
}

.funnel-kpi {
    margin-top: auto;
    padding-top: 0.45rem;
    border-top: 1px dashed rgba(199, 210, 254, 0.25);
    font-size: 0.76rem;
    color: #c7d2fe;
}

.funnel-kpi strong {
    color: #ffffff;
}

.strat-tag,
.strategist-only {
    display: none;
}

body.strategist-mode .strat-tag {
    display: inline-block;
    background: var(--strat-surface);
    color: var(--strat-accent-dark);
    border: 1px solid var(--strat-border);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

body.strategist-mode .strategist-only {
    display: block;
}

.strategist-inline-box {
    margin-top: 1rem;
    background: var(--strat-surface);
    border: 1.5px dashed var(--strat-accent);
    border-radius: 10px;
    padding: 0.95rem 1.1rem;
    color: var(--strat-ink);
    font-size: 0.85rem;
}

.strategist-inline-box h4 {
    margin: 0 0 0.5rem;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--strat-accent-dark);
}

.strategist-inline-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}

.strategist-inline-list code {
    background: rgba(67, 56, 202, 0.12);
    color: var(--strat-accent-dark);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.78rem;
}

.tool-footer {
    border-top: 1px solid var(--fg-border);
    padding: 1.25rem 0 2rem;
    font-size: 0.85rem;
    color: var(--fg-ink-muted);
}

.tool-footer .container {
    width: min(1140px, 92%);
    margin: 0 auto;
}

.tool-footer a {
    color: var(--fg-forest);
    font-weight: 600;
}

/* Focus Visibility & Responsive Breakpoints */
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(31, 81, 59, 0.35);
    outline-offset: 2px;
}

@media (max-width: 820px) {
    .controls-top,
    .comparison-grid,
    .plan-slots-grid {
        grid-template-columns: 1fr;
    }

    .zip-input-row {
        flex-direction: column;
    }
}