/* ═════════════════════════════════════════════════════════════════════
   Gear Guide styles
   =====================================================================
   Uses the design-system.css CSS variables (--sp-*) so the palette stays
   in sync with the rest of the app. All colors come from those vars —
   do not hard-code hex values here except for transparency overlays
   already used elsewhere.
   ═════════════════════════════════════════════════════════════════════ */


/* ── Two-column layout ─────────────────────────────────────────────── */

.gear-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 28px;
    /* No align-items: start here — we want the right column to stretch
       to match the skier image height so the callouts can distribute
       across the same vertical space. The sticky .gear-hero sets its
       own align-self: start so it still pins to the top. */
}

@media (max-width: 960px) {
    .gear-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Hero image + hotspot overlay ──────────────────────────────────── */

.gear-hero {
    position: sticky;
    top: 84px;  /* site header (64px) + 20px breathing room */
    align-self: start;
}

@media (max-width: 960px) {
    /* Sticky hero breaks on narrow screens — the image takes up too much
       of the viewport and panels never get visual priority. */
    .gear-hero { position: static; }
}

.gear-hero__frame {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(45, 63, 82, 0.7);
    box-shadow: var(--shadow-lg);
}

.gear-hero__picture {
    display: block;
    width: 100%;
}

.gear-hero__img {
    display: block;
    width: 100%;
    height: auto;
}

.gear-hotspot-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;  /* children opt back in individually */
}

.gear-hero__caption {
    margin-top: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sp-fog);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Expert-fit callout (full width, below the two-column grid) ──── */

.gear-expert {
    margin-top: 32px;
    padding: 22px 28px;
    background: rgba(0, 191, 165, 0.08);
    border: 1px solid rgba(0, 191, 165, 0.3);
    border-radius: var(--radius-lg);
}

.gear-expert__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.gear-expert__icon {
    color: #5eead4;
    font-size: 18px;
}

.gear-expert__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--sp-snow);
    letter-spacing: -0.01em;
}

.gear-expert__lede {
    margin: 0 0 18px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--sp-fog);
    max-width: 780px;
}

.gear-expert__items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 760px) {
    .gear-expert__items {
        grid-template-columns: 1fr;
    }
}

.gear-expert__item {
    padding: 14px 18px;
    background: rgba(15, 23, 35, 0.55);
    border: 1px solid rgba(45, 63, 82, 0.6);
    border-radius: var(--radius-md);
}

.gear-expert__label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5eead4;
    margin-bottom: 6px;
}

.gear-expert__copy {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--sp-snow);
}


/* ── Hotspot buttons ───────────────────────────────────────────────── */
/*
 * Invisible click rectangles with only a pulsing dot showing through —
 * no border, no background. The rectangle is still the hit target so
 * users can click anywhere in the gear item's area, but the visible UI
 * is just the dot in the center. Calibrate mode re-adds a visible box
 * via its own CSS so positions can still be dragged / resized.
 */

.gear-hotspot {
    position: absolute;
    /* pointer-events:none so only the visible dot is clickable — the
       surrounding invisible rectangle doesn't catch clicks, which
       would otherwise steal hits from nearby dots when rectangles
       overlap (e.g., gloves inside the jacket area). */
    pointer-events: none;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gear-hotspot:focus-visible {
    outline: none;
}

/* Keyboard users still need a visible indicator — draw it on the dot
   instead of the (invisible) full rectangle. */
.gear-hotspot:focus-visible .gear-hotspot__dot {
    outline: 2px solid #00e5ff;
    outline-offset: 3px;
}

.gear-hotspot__dot {
    /* Dot diameter is controlled directly in pixels via --dot-size,
       set inline on each hotspot from the DB's dot_size field.
       Calibrate mode's scroll wheel adjusts the variable live;
       Save persists it back to the DB. */
    width: var(--dot-size, 14px);
    height: var(--dot-size, 14px);
    /* Opt back into mouse events so only the dot itself captures
       clicks. Events still bubble to the parent <button> so existing
       click / drag / wheel handlers keep working unchanged. */
    pointer-events: auto;
    cursor: pointer;
    position: relative;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.18),
                0 0 12px rgba(0, 229, 255, 0.6);
    animation: gear-hotspot-pulse 2.4s ease-in-out infinite;
    transition: transform var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

/* Invisible tap halo — extends the dot's hit area to ~34px for touch
   without resurrecting the full-rectangle overlap steals the
   pointer-events:none design avoids. */
.gear-hotspot__dot::after {
    content: "";
    position: absolute;
    inset: calc((var(--dot-size, 14px) - 34px) / 2);
    border-radius: 50%;
}

.gear-hotspot:hover .gear-hotspot__dot {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(0, 229, 255, 0.22),
                0 0 16px rgba(0, 229, 255, 0.8);
}

.gear-hotspot.is-active .gear-hotspot__dot {
    background: #fbbf24;
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.25),
                0 0 18px rgba(251, 191, 36, 0.7);
    animation: gear-hotspot-pulse-active 1.8s ease-in-out infinite;
    transform: none;
}

@keyframes gear-hotspot-pulse-active {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.25), 0 0 18px rgba(251, 191, 36, 0.7); }
    50%      { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.35), 0 0 24px rgba(251, 191, 36, 0.9); }
}

@keyframes gear-hotspot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(0.8); opacity: 0.55; }
}


/* ── Callouts (right column) ───────────────────────────────────────── */
/*
 * Each category renders as one compact card:
 *   - Header (always visible): category label + chevron on top row,
 *     then product name + "Top pick" badge + Shop button on a second row.
 *   - Expandable body: expert note + single-line alternatives list.
 *
 * No icons, no price ranges, no descriptions — everything optimised for
 * scanability. Clicking the card toggles the body; clicking the Shop
 * link opens the retailer (gear.js ignores clicks that originate inside
 * an anchor so the card doesn't expand when you hit Shop).
 */

.gear-panels {
    display: flex;
    flex-direction: column;
    /* Clean stack from the top with a consistent gap. Natural content
       height determines the column height; if it's shorter than the
       skier image we don't care — empty space below the last card is
       fine. If it's taller, the grid cell allows overflow below. */
    gap: 10px;
}

.gear-callout {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(45, 63, 82, 0.7);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.gear-callout.is-highlighted {
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.3), var(--shadow-md);
}

/* ── Always-visible header ────────────────────────────────────────── */
/*
 * The header is a block container with two children:
 *   1. .gear-callout__main  — a flex row with category label, product
 *                             name, badge, shop button, chevron.
 *   2. .gear-callout__desc  — the featured product's one-line pitch
 *                             (always visible, not hidden behind the
 *                             expand toggle).
 */

.gear-callout__head {
    display: block;
    padding: 11px 16px;
    cursor: pointer;
    user-select: none;
    color: var(--sp-snow);
}

.gear-callout__head:focus-visible {
    outline: 2px solid rgba(0, 229, 255, 0.7);
    outline-offset: -2px;
}

.gear-callout__main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.gear-callout__desc {
    margin: 5px 0 0 0;
    font-size: 11px;
    color: var(--sp-fog);
    line-height: 1.5;
}

/* Left block — category label + product name + top-pick badge.
   Wrapping is allowed so long product names don't get truncated or
   shove the shop button off the card. */
.gear-callout__info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 240px;
    min-width: 0;
    flex-wrap: wrap;
    line-height: 1.3;
}

.gear-callout__category {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sp-fog);
    flex-shrink: 0;
}

.gear-callout__product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--sp-snow);
    /* No nowrap — long names are allowed to wrap to a second line
       rather than get ellipsised, which looks much cleaner. */
}

.gear-callout__badge {
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Right block — shop button + expand chevron. */
.gear-callout__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.gear-callout__shop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    background: var(--sp-teal);
    color: var(--sp-midnight);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.gear-callout__shop:hover {
    background: var(--sp-teal-hover);
    color: var(--sp-midnight);
}

.gear-callout__shop-price {
    font-family: var(--font-mono);
    font-weight: 700;
    padding-left: 8px;
    border-left: 1px solid rgba(15, 23, 35, 0.35);
    font-size: 10px;
}

.gear-callout__chevron {
    color: var(--sp-fog);
    transition: transform var(--duration-normal) var(--ease-out);
    font-size: 11px;
    width: 14px;
    text-align: center;
}

.gear-callout.is-open .gear-callout__chevron {
    transform: rotate(180deg);
    color: #67e8f9;
}


/* ── Expandable body (note + alternatives) ───────────────────────── */
/*
 * Uses max-height transitioning between 0 and a large fixed ceiling.
 * The grid-template-rows:0fr trick can leak content depending on how
 * the children are laid out, so this is the safer pattern — overflow
 * hidden on a zero-max-height container absolutely cannot render any
 * descendant, including the teal expert-note background.
 */

.gear-callout__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-normal) var(--ease-out);
    border-top: 0 solid rgba(45, 63, 82, 0.5);
}

.gear-callout.is-open .gear-callout__body {
    /* 1600px is comfortably larger than any expanded body we render
       (8 cats × ~180px note + ~60px/alt ≈ well under 1000px). */
    max-height: 1600px;
    border-top-width: 1px;
}

.gear-callout__body-inner {
    padding: 12px 14px 14px 14px;
}

.gear-callout__note {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 191, 165, 0.08);
    border: 1px solid rgba(0, 191, 165, 0.3);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.gear-callout__note-icon {
    color: #5eead4;
    font-size: 12px;
    margin-top: 2px;
    flex-shrink: 0;
}

.gear-callout__note p {
    margin: 0;
    color: var(--sp-snow);
    font-size: 12px;
    line-height: 1.5;
}


/* ── "What would Jerry do?" — humorous anti-advice ─────────────── */
/*
 * Red-tinted warning card with repeating hazard-stripe left border
 * and warning-triangle icons. Visually distinct from the teal
 * expert note — signals "don't do this" without being aggressive.
 */

.gear-callout__jerry {
    padding: 12px 14px 12px 18px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 4px solid #ef4444;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    position: relative;
}

.gear-callout__jerry-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.gear-callout__jerry-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gear-callout__jerry-badge::before {
    content: "\26A0";  /* ⚠ warning sign */
    font-style: normal;
    font-size: 11px;
}

.gear-callout__jerry-text {
    margin: 0;
    color: #fca5a5;
    font-size: 12px;
    line-height: 1.6;
    font-style: italic;
}

.gear-callout__alts-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sp-fog);
    margin-bottom: 6px;
}

.gear-callout__alts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gear-alt {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(15, 23, 35, 0.6);
    border: 1px solid rgba(45, 63, 82, 0.6);
    border-radius: var(--radius-sm);
    transition: border-color var(--duration-fast) var(--ease-out);
}

.gear-alt:hover {
    border-color: rgba(0, 229, 255, 0.45);
}

.gear-alt__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.gear-alt__name {
    font-size: 13px;
    font-weight: 700;
    color: var(--sp-snow);
    line-height: 1.3;
}

.gear-alt__price {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--sp-snow);
    white-space: nowrap;
}

.gear-alt__desc {
    margin: 0;
    font-size: 11px;
    color: var(--sp-fog);
    line-height: 1.55;
}

.gear-alt__shop {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #67e8f9;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    align-self: flex-start;
}

.gear-alt__shop:hover {
    color: #8ef1ff;
}

.gear-callout__empty {
    color: var(--sp-fog);
    font-size: 12px;
    font-style: italic;
    margin: 0;
}


/* ── Jerry CTA on the gear guide page ─────────────────────────────── */

.gear-jerry-cta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    padding: 16px 20px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 4px solid #ef4444;
    border-radius: var(--radius-md);
}

@media (max-width: 640px) {
    .gear-jerry-cta {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* ── Affiliate disclosure ──────────────────────────────────────────── */

.gear-disclosure {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 32px;
    padding: 14px 18px;
    background: rgba(15, 23, 35, 0.6);
    border: 1px solid rgba(45, 63, 82, 0.5);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--sp-fog);
    line-height: 1.55;
}

.gear-disclosure i {
    color: var(--sp-fog);
    margin-top: 2px;
    flex-shrink: 0;
}


/* ── Mobile tweaks ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .gear-callout__actions {
        margin-left: 0;
    }
    .gear-alt {
        flex-wrap: wrap;
    }
}


/* ═════════════════════════════════════════════════════════════════════
   Calibration mode styles — only active when ?calibrate=1 is on the URL
   (and the viewer is staff or DEBUG). Makes hotspots visibly draggable
   and adds a resize handle + a floating panel with the Python dict.
   ═════════════════════════════════════════════════════════════════════ */

/* Calibrate mode keeps the invisible rectangle as the drag hit-area
   but shows ONLY the dot + a label above it. No box, no resize handle.
   Dragging the dot moves the rectangle's top/left in place. */

[data-gear-calibrate] .gear-hotspot.is-calibrating {
    background: transparent;
    border: none;
}

/* Swap the live cyan dot for a gold one so the calibrator can tell
   calibrate mode from live mode at a glance, and stop the pulse so
   positions are easier to judge against the hero image. Cursor is
   `move` because scroll wheel resizes and click-drag repositions. */
[data-gear-calibrate] .gear-hotspot.is-calibrating .gear-hotspot__dot {
    display: block;
    background: #ffd700;
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.25),
                0 0 10px rgba(255, 215, 0, 0.7);
    animation: none;
    transform: none;
    cursor: move;
}

/* Floating label above the dot, centered horizontally on the hotspot.
   Positioned outside any visible box so the calibrator can see both
   the label and the dot cleanly. pointer-events:none so the label
   can't steal clicks from the drag handler on the hotspot. */
.gear-calibrate-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, calc(-50% - 22px));
    background: rgba(15, 23, 35, 0.95);
    color: #ffd700;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.6);
    z-index: 2;
}

/* Floating output panel with the live Python dict + copy button. */
#gear-calibrate-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 400px;
    max-height: 70vh;
    background: rgba(15, 23, 35, 0.97);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-family: var(--font-body);
}

.gear-calibrate-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ffd700;
}

.gear-calibrate-panel__exit {
    color: var(--sp-fog);
    font-size: 10px;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid rgba(45, 63, 82, 0.6);
    border-radius: var(--radius-full);
}
.gear-calibrate-panel__exit:hover {
    color: var(--sp-snow);
    border-color: var(--sp-fog);
}

.gear-calibrate-panel__hint {
    font-size: 11px;
    color: var(--sp-fog);
    line-height: 1.5;
    margin: 0;
}
.gear-calibrate-panel__hint code {
    background: rgba(45, 63, 82, 0.5);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--sp-snow);
    font-family: var(--font-mono);
    font-size: 10px;
}

#gear-calibrate-output {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(45, 63, 82, 0.6);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--sp-snow);
    line-height: 1.5;
    white-space: pre;
}

.gear-calibrate-panel__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gear-calibrate-panel__save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: var(--sp-teal);
    color: var(--sp-midnight);
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--duration-fast) var(--ease-out),
                transform var(--duration-fast) var(--ease-out);
}
.gear-calibrate-panel__save:hover {
    background: var(--sp-teal-hover);
    transform: translateY(-1px);
}
.gear-calibrate-panel__save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gear-calibrate-panel__status {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--sp-fog);
    line-height: 1.4;
}
.gear-calibrate-panel__status.is-ok     { color: #5eead4; }
.gear-calibrate-panel__status.is-error  { color: #fca5a5; }
.gear-calibrate-panel__status.is-pending { color: var(--sp-fog); }

.gear-calibrate-panel__details {
    border-top: 1px solid rgba(45, 63, 82, 0.5);
    padding-top: 10px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.gear-calibrate-panel__details summary {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-fog);
    cursor: pointer;
    user-select: none;
}
.gear-calibrate-panel__details[open] summary {
    margin-bottom: 4px;
}

.gear-calibrate-panel__copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(45, 63, 82, 0.6);
    color: var(--sp-snow);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(45, 63, 82, 0.8);
    cursor: pointer;
    font-family: inherit;
    transition: background var(--duration-fast) var(--ease-out);
}
.gear-calibrate-panel__copy:hover {
    background: rgba(45, 63, 82, 0.9);
}

@media (max-width: 760px) {
    #gear-calibrate-panel {
        width: calc(100% - 24px);
        right: 12px;
        bottom: 12px;
    }
}
