/* Hatch Chart V15 — Light Theme / Mobile-First / TU Brand
   Drop-in replacement for hatch-chart-style.css
   Works with existing PHP class names
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Playfair+Display:wght@700;800&display=swap');

:root {
    --hc-brand-blue: #003B77;
    --hc-brand-green: #42af46;
    --hc-blue-light: #e8f0fa;
    --hc-green-light: #eaf7eb;
    --hc-bg: #ffffff;
    --hc-bg-subtle: #f8f9fb;
    --hc-border: #e5e7eb;
    --hc-border-light: #f0f1f3;
    --hc-text: #1a1a2e;
    --hc-text-secondary: #4b5563;
    --hc-text-muted: #6b7280; /* was #9ca3af — failed WCAG AA on white (2.8:1). #6b7280 ≈ 4.8:1 */
    --hc-tab-inactive: #475569; /* dedicated stronger color for inactive interactive labels */
    --hc-radius: 12px;
    --hc-radius-lg: 16px;
    --hc-radius-sm: 8px;
    --hc-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --hc-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --hc-shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --hc-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --hc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --hc-font-display: 'Playfair Display', Georgia, serif;
    --hc-primary: var(--hc-brand-blue);
}

/* ---- APP WRAPPER ---- */
.hc-app-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    background: var(--hc-bg);
    color: var(--hc-text);
    font-family: var(--hc-font);
    -webkit-font-smoothing: antialiased;
    position: relative;
}
.hc-app-wrapper * { box-sizing: border-box; }
@media (min-width: 768px) { .hc-app-wrapper { padding: 2rem 2rem; } }

/* ═══ HEADER AREA — v1.1 compact two-column layout ═══════════════════════ */
/* Mobile: stacked. Desktop (≥768px): title-block left / ctrl-bar right.    */
.hc-header-area {
    padding: clamp(0.85rem, 2.5vw, 1.5rem) 0 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--hc-border-light);
}
@media (min-width: 768px) {
    .hc-header-area {
        display: grid;
        grid-template-columns: 1fr minmax(360px, 480px);
        align-items: end;
        gap: 1.75rem;
        padding-bottom: 1.1rem;
    }
}

/* Title block */
.hc-title-block { padding-bottom: 0.75rem; }
@media (min-width: 768px) { .hc-title-block { padding-bottom: 0; } }

.hc-header-eyebrow {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.2em;
    color: var(--hc-brand-green); margin-bottom: 0.35rem;
}
.hc-app-title {
    font-family: var(--hc-font-display);
    font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800;
    color: var(--hc-text); line-height: 1.1; margin: 0;
}
.hc-app-title span { color: var(--hc-brand-blue); }

/* Subtitle: hidden on mobile, shown on desktop */
.hc-app-subtitle {
    display: none;
    font-size: 0.83rem; color: var(--hc-text-secondary);
    margin: 0.3rem 0 0;
}
@media (min-width: 768px) { .hc-app-subtitle { display: block; } }

/* Meta line: "May · 9 hatches found" — mobile only, below title */
.hc-title-meta {
    margin-top: 0.35rem;
    font-size: 0.83rem; color: var(--hc-text-muted);
    font-weight: 500;
}
@media (min-width: 768px) { .hc-title-meta { display: none; } }

/* ═══ CONTROL BAR — search + month select + toggle in one row ════════════ */
.hc-ctrl-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0 0.85rem;
}
@media (min-width: 768px) {
    .hc-ctrl-bar { padding: 0; }
}

/* ═══ EXPANDING SEARCH — flexbox layout, no absolute children ═══════════ */
/* Using flex instead of absolute so theme button styles can't break it.   */
.hc-search-wrap {
    display: flex;
    align-items: center;
    height: 44px;
    width: 44px;
    overflow: hidden;
    border: 1.5px solid var(--hc-border);
    border-radius: 999px;
    background: var(--hc-bg-subtle);
    cursor: pointer;
    flex-shrink: 0;
    transition: width 350ms cubic-bezier(0.4,0,0.2,1),
                border-color 200ms ease,
                box-shadow 200ms ease;
}
.hc-search-wrap.expanded {
    width: 220px;
    border-color: var(--hc-brand-blue);
    box-shadow: 0 0 0 3px rgba(0,59,119,0.08);
    cursor: text;
}

/* Icon: flex child, fixed size, left-margin gives pill-center look when narrow */
.hc-search-icon {
    width: 15px; height: 15px;
    flex-shrink: 0;
    margin: 0 8px 0 13px;
    color: var(--hc-text-muted);
    pointer-events: none;
    /* no position:absolute — just a flex child */
}

/* Input: flex child that grows to fill remaining space */
.hc-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--hc-text);
    font-size: 0.82rem; font-family: var(--hc-font);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease 80ms;
}
.hc-search-wrap.expanded .hc-search-input { opacity: 1; pointer-events: auto; }
.hc-search-input::placeholder { color: var(--hc-text-muted); }

/* Clear button: flex child after the input, hidden until expanded */
.hc-search-clear {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    flex-shrink: 0;
    margin-right: 8px;
    cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    color: #374151;
    font-size: 13px; font-weight: 700; line-height: 1;
    padding: 0; font-family: var(--hc-font);
    /* no position or z-index needed */
}
.hc-search-wrap.expanded .hc-search-clear { display: flex; }
.hc-search-clear:hover { background: #9ca3af; color: #fff; }

/* Month dropdown */
.hc-month-select {
    height: 44px;
    padding: 0 2.1rem 0 0.9rem;
    border: 1.5px solid var(--hc-border);
    border-radius: 999px;
    background-color: var(--hc-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 11px;
    -webkit-appearance: none; appearance: none;
    font-size: 0.82rem; font-weight: 600;
    font-family: var(--hc-font);
    color: var(--hc-text);
    cursor: pointer;
    transition: var(--hc-transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.hc-month-select:focus {
    outline: none;
    border-color: var(--hc-brand-blue);
    box-shadow: 0 0 0 3px rgba(0,59,119,0.08);
}

/* ═══ STICKY BAR — appears on ALL viewports when header scrolls off ══════ */

/* Visually-hidden helper */
.hc-sr-only {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Removed classes kept for backward-compat (display:none to avoid layout shift) */
.hc-months-bar, .hc-month-list, .hc-all-btn,
.hc-col-sidebar, .hc-sidebar-title { display: none !important; }
.hc-grid-layout { display: block; }
.hc-col-content { width: 100%; }

/* ---- DASHBOARD ---- */
.hc-view-dashboard { animation: hcFade 0.3s ease; }
/* Dashboard header (month + count) moved to .hc-title-meta in the header — hidden here */
.hc-dashboard-header { display: none; }
.hc-dashboard-title, .hc-dashboard-subtitle { display: none; }

/* ---- BUG CARD GRID ---- */
.hc-bug-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    animation: hcFade 0.3s ease;
}
@media (min-width: 550px) { .hc-bug-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .hc-bug-grid { grid-template-columns: repeat(3, 1fr); } }

.hc-bug-card {
    background: var(--hc-bg);
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--hc-transition);
    text-align: left;
    width: 100%;
    color: var(--hc-text);
    font-family: var(--hc-font);
    padding: 0;
    display: flex;
    flex-direction: column;
}
.hc-bug-card:hover {
    border-color: #ccd5e0;
    box-shadow: var(--hc-shadow-lg);
    transform: translateY(-2px);
}
.hc-bug-card.is-active-now { border-color: rgba(66,175,70,0.55); box-shadow: 0 0 0 1px rgba(66,175,70,0.25); }

/* ── Full-width image banner ── */
.hc-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--hc-bg-subtle);
    overflow: hidden;
    flex-shrink: 0;
}
.hc-card-img img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 400ms ease;
}
.hc-bug-card:hover .hc-card-img img { transform: scale(1.04); }
.hc-card-no-img-icon {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; width: 40px; height: 40px;
    margin: auto; color: var(--hc-text-muted);
}
/* Active-now badge — bottom-left of image */
.hc-card-active-now {
    position: absolute; bottom: 0.6rem; left: 0.6rem;
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    background: rgba(255,255,255,0.9);
    color: #1f6a22;
    border: 1px solid rgba(66,175,70,0.45);
    border-radius: 999px;
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    backdrop-filter: blur(4px);
}
.hc-card-active-now .hc-active-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #42af46;
    animation: hcPulse 2s infinite;
}

/* ── Card body (below image) ── */
.hc-card-body { display: flex; flex-direction: column; flex: 1; }

.hc-bug-title {
    font-size: 1rem; font-weight: 700; color: var(--hc-text);
    margin: 0.75rem 1.15rem 0.3rem; line-height: 1.3;
}
.hc-bug-desc {
    font-size: 0.78rem; color: var(--hc-text-secondary);
    line-height: 1.5; padding: 0 1.15rem 1rem;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- MINI TIMELINE BARS (on bug cards) ---- */
.hc-card-tl {
    display: flex; gap: 2px;
    padding: 0.5rem 0.65rem 0.55rem;
    background: var(--hc-bg-subtle);
    border-top: 1px solid var(--hc-border-light);
    border-radius: 0 0 var(--hc-radius) var(--hc-radius);
}
.hc-tlb {
    flex: 1; height: 14px; border-radius: 3px;
    background: var(--hc-border);
    border: 1px solid rgba(0,0,0,0.08);
}
.hc-tlb.sf { background: #003B77 !important; background: var(--hc-brand-blue) !important; border-color: rgba(0,59,119,0.3); }
.hc-tlb.ss { background: #42af46 !important; background: var(--hc-brand-green) !important; border-color: rgba(66,175,70,0.3); }
.hc-tlb.bo { background: linear-gradient(90deg, #003B77 50%, #42af46 50%) !important; background: linear-gradient(90deg, var(--hc-brand-blue) 50%, var(--hc-brand-green) 50%) !important; border-color: rgba(0,59,119,0.25); }
.hc-tl-lbl {
    display: flex; justify-content: space-between;
    padding: 0 0.65rem 0.45rem;
    font-size: 0.55rem; color: var(--hc-text-muted); letter-spacing: 0.02em;
}

/* ---- VIEW TOGGLE ---- */
/* .hc-view-controls is now the .hc-ctrl-bar wrapper — no standalone margin needed */
.hc-view-controls { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0; }
.hc-view-toggle {
    display: flex; gap: 2px; background: var(--hc-bg-subtle);
    border-radius: var(--hc-radius-sm); padding: 2px;
    border: 1px solid var(--hc-border-light);
}
.hc-view-toggle-btn {
    padding: 0.32rem 0.6rem; border-radius: 6px;
    background: transparent; border: none; cursor: pointer;
    color: var(--hc-text-muted); font-size: 0.7rem; font-weight: 600;
    transition: var(--hc-transition); display: flex; align-items: center;
    gap: 0.25rem; font-family: var(--hc-font);
}
.hc-view-toggle-btn:hover { color: var(--hc-text-secondary); }
.hc-view-toggle-btn.active {
    background: #fff; color: var(--hc-brand-blue);
    box-shadow: var(--hc-shadow-sm);
}
.hc-view-toggle-btn svg { width: 13px; height: 13px; }

/* ---- MINI MONTH TIMELINE ON CARDS (optional — requires JS) ---- */
.hc-card-timeline {
    display: flex; gap: 2px;
    padding: 0.5rem 0.65rem 0.55rem;
    background: var(--hc-bg-subtle);
    border-top: 1px solid var(--hc-border);
    border-radius: 0 0 var(--hc-radius) var(--hc-radius);
}
.hc-tl-bar {
    flex: 1; height: 14px; border-radius: 3px;
    background: var(--hc-border);
    border: 1px solid rgba(0,0,0,0.08);
}
.hc-tl-bar.surface { background: var(--hc-brand-blue); border-color: rgba(0,59,119,0.3); }
.hc-tl-bar.subsurface { background: var(--hc-brand-green); border-color: rgba(66,175,70,0.3); }
.hc-tl-bar.both {
    background: linear-gradient(180deg, var(--hc-brand-blue) 50%, var(--hc-brand-green) 50%);
    border-color: rgba(0,59,119,0.25);
}
.hc-tl-labels {
    display: flex; justify-content: space-between;
    font-size: 0.5rem; color: var(--hc-text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    margin: 0.2rem 0.65rem 0.1rem; font-weight: 600;
}

/* ---- DETAIL VIEW ---- */
.hc-view-detail { animation: hcFade 0.3s ease; }
.hc-back-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: none; border: none; padding: 0.5rem 0; margin-bottom: 1rem;
    font-size: 0.78rem; font-weight: 600; color: var(--hc-text-secondary);
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.05em;
    transition: var(--hc-transition); font-family: var(--hc-font);
}
.hc-back-btn:hover { color: var(--hc-brand-blue); }
.hc-back-btn .dashicons { font-size: 16px; width: 16px; height: 16px; line-height: 1; }

.hc-detail-card {
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-lg);
    overflow: hidden;
    box-shadow: var(--hc-shadow);
    background: #fff;
}

/* Hero Header */
.hc-detail-header {
    background: linear-gradient(135deg, var(--hc-brand-blue), #165da8);
    color: #fff;
    display: flex; gap: 1.5rem; align-items: flex-start;
    padding: 2rem 1.5rem;
    position: relative; overflow: hidden;
}
.hc-detail-header::before {
    content: '';
    position: absolute; top: -40%; right: -15%;
    width: 55%; height: 180%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.06) 0%, transparent 65%);
    pointer-events: none;
}
@media (max-width: 600px) {
    .hc-detail-header {
        flex-direction: column; align-items: center;
        text-align: center; padding: 1.5rem 1.25rem;
    }
}
@media (min-width: 768px) { .hc-detail-header { padding: 2.5rem; gap: 2rem; } }

/* Featured Bug Image */
.hc-header-image-container {
    width: 110px; height: 110px; flex-shrink: 0;
    border-radius: var(--hc-radius);
    background: rgba(255,255,255,0.12);
    padding: 4px; cursor: zoom-in;
    transition: var(--hc-transition);
    border: 1px solid rgba(255,255,255,0.18);
}
.hc-header-image-container:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.hc-header-image { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
@media (min-width: 768px) { .hc-header-image-container { width: 130px; height: 130px; } }

.hc-header-content { flex: 1; position: relative; z-index: 1; }
.hc-detail-title {
    font-family: var(--hc-font-display);
    font-size: 1.75rem; font-weight: 800;
    margin: 0 0 0.5rem; line-height: 1.15; color: #fff;
}
@media (min-width: 768px) { .hc-detail-title { font-size: 2.25rem; } }
.hc-detail-desc {
    color: rgba(255,255,255,0.88);
    font-size: 0.88rem; line-height: 1.65;
}
.hc-detail-desc a { color: #93c5fd; }
.hc-detail-desc strong { color: #fff; font-weight: 700; }
.hc-detail-desc p { margin-bottom: 0.5rem; }
.hc-detail-desc p:last-child { margin-bottom: 0; }

/* ---- ACTIVE NOW BADGE ---- */
.hc-active-now {
    display: inline-flex; align-items: center; gap: 0.45rem;
    background: rgba(66,175,70,0.25); color: #d4f9d5;
    border: 1px solid rgba(66,175,70,0.55);
    border-radius: 999px; padding: 0.25rem 0.75rem;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
    margin-bottom: 0.65rem;
}
.hc-active-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #42af46;
    animation: hcPulse 2s infinite;
}
@keyframes hcPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(66,175,70,0.4); }
    50%       { box-shadow: 0 0 0 5px rgba(66,175,70,0); }
}

/* ---- QUICK STATS STRIP ---- */
.hc-stats-strip {
    display: flex; flex-wrap: wrap; gap: 0.45rem;
    margin-top: 0.65rem;
}
.hc-stat {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px; padding: 0.25rem 0.75rem;
    font-size: 0.7rem; font-weight: 600; color: rgba(255,255,255,0.85);
}
.hc-stat svg { width: 13px; height: 13px; flex-shrink: 0; opacity: 0.8; }
.hc-stat.hc-stat-active {
    background: rgba(34, 197, 94, 0.20);
    border-color: rgba(34, 197, 94, 0.45);
    color: #86efac;
}

/* ---- FIELD NOTES TILE GRID (hero body) ---- */
.hc-field-tiles-wrap { margin-top: 0.9rem; position: relative; z-index: 1; }
.hc-field-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}
@media (max-width: 680px) {
    .hc-field-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
    .hc-field-tiles { grid-template-columns: 1fr; }
}
.hc-tile {
    display: flex; gap: 0.55rem; align-items: flex-start;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    min-width: 0;
}
.hc-tile-primary {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.28);
}
.hc-tile-secondary { opacity: 0.88; }
.hc-tile-icon {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,0.14);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
}
.hc-tile-icon svg { width: 16px; height: 16px; }
.hc-tile-body { min-width: 0; flex: 1; }
.hc-tile-label {
    font-size: 0.62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: rgba(255,255,255,0.75);
    margin-bottom: 0.15rem;
}
.hc-tile-value {
    font-size: 0.78rem; line-height: 1.45;
    color: #fff;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.hc-more-notes {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.9);
    position: relative; z-index: 1;
}
.hc-more-notes > summary {
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    list-style: none;
    color: #fff;
}
.hc-more-notes > summary::-webkit-details-marker { display: none; }
.hc-more-notes > summary::after {
    content: '+'; font-size: 0.9rem; line-height: 1;
    margin-left: 0.15rem;
}
.hc-more-notes[open] > summary::after { content: '–'; }
/* Bubble buttons in a horizontal row */
.hc-bubble-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    align-items: flex-start;
}
.hc-bubble-row .hc-more-notes {
    margin-top: 0;
    flex-shrink: 0;
}
.hc-bubble-row .hc-more-notes[open] {
    flex: 1 1 100%;
}
.hc-more-notes-body {
    margin-top: 0.55rem;
    padding: 0.7rem 0.85rem;
    background: rgba(0,0,0,0.18);
    border-radius: 10px;
    line-height: 1.55;
    text-align: left;
}
.hc-detail-desc-fallback {
    /* shown only when parseFieldNotes couldn't find labeled sections */
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem; line-height: 1.6;
    margin-top: 0.75rem;
}

/* ---- ENTOMOLOGY ACCORDION ---- */
.hc-entomology-box { border-bottom: 1px solid var(--hc-border-light); background: var(--hc-bg-subtle); }
.hc-entomology-toggle, .hc-ento-toggle-btn {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    padding: 0.85rem 1.5rem; background: none; border: none; cursor: pointer;
    color: var(--hc-brand-blue); font-weight: 700; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    transition: var(--hc-transition); font-family: var(--hc-font);
}
@media (min-width: 768px) { .hc-entomology-toggle, .hc-ento-toggle-btn { padding: 0.85rem 2.5rem; } }
.hc-entomology-toggle:hover, .hc-ento-toggle-btn:hover { background: rgba(0,59,119,0.03); }
.hc-entomology-toggle .dashicons { transition: transform 0.3s ease; }
.hc-entomology-content {
    max-height: 0; overflow: hidden; transition: max-height 0.4s ease;
    padding: 0 1.5rem; color: var(--hc-text-secondary);
    font-size: 0.88rem; line-height: 1.7; background: var(--hc-bg-subtle);
}
@media (min-width: 768px) { .hc-entomology-content { padding: 0 2.5rem; } }
/* JS toggles .hidden class — remap to max-height */
.hc-entomology-content:not(.hidden) { max-height: 800px; padding-bottom: 1.25rem; }
.hc-entomology-content a { color: var(--hc-brand-blue); }
.hc-entomology-content p { margin-bottom: 0.65rem; }

/* ---- STAGE TABS ---- */
.hc-stage-tabs {
    display: flex; overflow-x: auto;
    border-bottom: 2px solid var(--hc-border-light);
    background: #fff; scrollbar-width: none;
}
.hc-stage-tabs::-webkit-scrollbar { display: none; }
.hc-tab-btn {
    flex: 1; min-width: max-content;
    padding: 0.85rem 1rem; text-align: center;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; background: none; border: none;
    border-bottom: 3px solid transparent; cursor: pointer;
    color: var(--hc-tab-inactive); transition: var(--hc-transition);
    white-space: nowrap; font-family: var(--hc-font); margin-bottom: -2px;
}
.hc-tab-btn:hover { color: var(--hc-brand-blue); background: var(--hc-bg-subtle); }
.hc-tab-btn:focus-visible {
    outline: 2px solid var(--hc-brand-blue);
    outline-offset: -2px;
}
.hc-tab-btn.active {
    border-bottom-color: var(--hc-brand-blue);
    color: #fff;
    background: var(--hc-brand-blue);
}
.hc-tab-btn.disabled { opacity: 0.3; cursor: not-allowed; }
/* Pattern count badge on stage tabs */
.hc-stab-ct {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: 0.45rem; min-width: 18px; height: 18px; padding: 0 5px;
    background: rgba(0,59,119,0.1); color: var(--hc-brand-blue);
    border-radius: 999px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0;
    vertical-align: middle;
}
.hc-tab-btn.active .hc-stab-ct { background: #fff; color: var(--hc-brand-blue); }
.hc-tab-btn[aria-selected="true"] { /* mirror .active for ARIA-driven state */
    border-bottom-color: var(--hc-brand-blue);
    color: #fff;
    background: var(--hc-brand-blue);
}
.hc-tab-btn[aria-selected="true"] .hc-stab-ct { background: #fff; color: var(--hc-brand-blue); }

/* Stage Body */
.hc-stage-wrapper {
    padding: 1.5rem 1.25rem; background: #fff; min-height: 300px;
}
@media (min-width: 768px) { .hc-stage-wrapper { padding: 2rem 2.5rem; } }

/* ---- Stage hook size banner ---- */
.hc-stage-hook-banner {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--hc-bg-subtle);
    border: 1px solid var(--hc-border-light);
    border-left: 3px solid var(--hc-brand-blue);
    border-radius: var(--hc-radius-sm);
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem; color: var(--hc-text-secondary);
}
.hc-stage-hook-banner .dashicons {
    color: var(--hc-brand-blue); font-size: 1rem; flex-shrink: 0;
}
.hc-stage-hook-banner strong { color: var(--hc-brand-blue); }

/* ---- Stage Life-Cycle Image (Natural Insect Reference) ---- */
.hc-real-bug {
    text-align: center;
    padding: 1.5rem;
    background: var(--hc-bg-subtle);
    border: 1px solid var(--hc-border-light);
    border-radius: var(--hc-radius);
    margin-bottom: 2rem;
}
.hc-real-bug h4 {
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--hc-brand-blue); margin: 0 0 0.75rem 0;
}
.hc-real-bug img {
    max-width: 100%; max-height: 320px; object-fit: cover;
    border-radius: var(--hc-radius-sm);
    border: 1px solid var(--hc-border);
    cursor: zoom-in; transition: var(--hc-transition);
    display: block; margin: 0 auto;
}
.hc-real-bug img:hover { box-shadow: var(--hc-shadow); }
.hc-ref-stage-label {
    display: block; margin-top: 0.65rem;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--hc-text-muted);
}

/* ---- PATTERN CARDS (centered, stacked single-column) ---- */
.hc-stage-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ---- 2-COLUMN PATTERN GRID ---- */
.hc-patterns-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.hc-patterns-grid.hc-single { grid-template-columns: 1fr; }
@media (max-width: 640px) { .hc-patterns-grid { grid-template-columns: 1fr; } }

.hc-pattern-card {
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    overflow: hidden;
    background: #fff;
    transition: var(--hc-transition);
    display: flex; flex-direction: column;
    text-align: left;
}
.hc-pattern-card:hover { box-shadow: var(--hc-shadow); }

.hc-pattern-image-container { position: relative; }
.hc-pattern-image {
    max-width: 640px; max-height: 220px; object-fit: cover;
    display: block; margin: 0 auto;
    cursor: zoom-in; transition: var(--hc-transition);
    background: var(--hc-bg-subtle);
    border-top: 1px solid var(--hc-border-light);
    border-bottom: 1px solid var(--hc-border-light);
}
.hc-pattern-image:hover { opacity: 0.93; }
.hc-pattern-media {
    width: 100%; height: 120px;
    display: flex; align-items: center; justify-content: center;
    background: var(--hc-bg-subtle);
    color: var(--hc-text-muted); font-size: 0.75rem;
    border-bottom: 1px solid var(--hc-border-light);
}

.hc-pattern-header {
    padding: 0.75rem 1rem 0.6rem;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
    border-bottom: 1px solid var(--hc-border-light);
}
.hc-pattern-title {
    font-family: var(--hc-font-display);
    font-size: 0.95rem; font-weight: 700;
    color: var(--hc-text); margin: 0;
    line-height: 1.3;
}
.hc-pattern-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; flex-shrink: 0; margin: 0; }
.badge {
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-Nymph { background: var(--hc-green-light); color: #2d8a30; border: 1px solid rgba(66,175,70,0.2); }
.badge-Wet { background: var(--hc-blue-light); color: var(--hc-brand-blue); border: 1px solid rgba(0,59,119,0.15); }
.badge-Dry { background: #fef9ee; color: #b45309; border: 1px solid rgba(180,83,9,0.15); }
.badge-Streamer { background: #f5f0ff; color: #6d28d9; border: 1px solid rgba(109,40,217,0.12); }
.badge-size {
    padding: 2px 7px; border-radius: 999px; font-size: 0.6rem; font-weight: 600;
    background: var(--hc-bg-subtle); color: var(--hc-text-secondary);
    border: 1px solid var(--hc-border);
}

/* ---- PATTERN IMAGE PLACEHOLDER ---- */
.hc-pat-ph {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 2rem 1rem;
    background: var(--hc-bg-subtle); border-bottom: 1px solid var(--hc-border-light);
    color: var(--hc-text-muted);
}
.hc-pat-ph svg { width: 40px; height: 40px; opacity: 0.3; }
.hc-pat-ph span { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }

/* Recipe collapse */
.hc-recipe-wrapper { padding: 0 1.15rem; margin-bottom: 0.75rem; }
.hc-recipe-box {
    border: 1px solid var(--hc-border-light);
    border-radius: var(--hc-radius-sm);
    overflow: hidden;
}
.hc-recipe-toggle {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0.85rem; cursor: pointer;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--hc-text-secondary);
    transition: var(--hc-transition);
}
.hc-recipe-toggle:hover { background: var(--hc-bg-subtle); color: var(--hc-text); }
.hc-recipe-content {
    max-height: 0; overflow: hidden; transition: max-height 0.35s ease;
    padding: 0 0.85rem; font-size: 0.82rem; color: var(--hc-text-secondary);
    line-height: 1.8; white-space: pre-wrap;
}
/* JS uses .hidden — remap */
.hc-recipe-content:not(.hidden) {
    max-height: 400px; padding: 0.5rem 0.85rem 0.85rem;
    border-top: 1px solid var(--hc-border-light);
}

/* ---- VIDEO THUMBNAIL (click-to-play) ---- */
.hc-video-thumb {
    position: relative; cursor: pointer;
    background: #000; overflow: hidden;
    border-bottom: 1px solid var(--hc-border-light);
    aspect-ratio: 16 / 9;
}
.hc-video-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    display: block; opacity: 0.88;
    transition: opacity 0.15s;
}
.hc-video-thumb:hover img { opacity: 1; }
.hc-thumb-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.hc-thumb-play-circle {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.hc-video-thumb:hover .hc-thumb-play-circle {
    background: #cc0000;
    transform: scale(1.1);
}
.hc-thumb-play-circle svg { width: 15px; height: 15px; fill: #fff; margin-left: 2px; }
.hc-thumb-src-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 5px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    font-size: 0.65rem; color: rgba(255,255,255,0.85); font-weight: 600;
}

/* Iframe swap (after thumbnail click) */
.hc-video-iframe-wrap {
    border-bottom: 1px solid var(--hc-border-light);
    aspect-ratio: 16 / 9; overflow: hidden; background: #000;
}
.hc-video-iframe-wrap iframe {
    width: 100%; height: 100%; border: none; display: block;
}

/* Legacy wrappers — kept for any other usage */
.hc-video-wrapper { padding: 0 1.15rem 1.15rem; }
.aspect-video-container {
    position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
    border-radius: var(--hc-radius-sm); background: #000;
}
.aspect-video-container iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}
.hc-video-label { display: flex; justify-content: space-between; margin-top: 0.35rem; font-size: 0.65rem; color: var(--hc-text-muted); }
.hc-video-label a, .hc-video-source { color: var(--hc-brand-blue); text-decoration: none; }
.hc-video-label a:hover { text-decoration: underline; }

/* ---- LIGHTBOX ---- */
.hc-lightbox {
    position: fixed; inset: 0; z-index: 2147483647;
    background: rgba(0,0,0,0.88); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out; animation: hcFadeIn 0.2s ease;
}
.hc-lightbox img {
    max-width: 92%; max-height: 92%; border-radius: 8px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.4); object-fit: contain;
}

/* ---- EMPTY STATE ---- */
.hc-empty-state {
    text-align: center; padding: 3.5rem 1.5rem;
    color: var(--hc-text-muted); background: var(--hc-bg-subtle);
    border-radius: var(--hc-radius);
}
.hc-empty-state .dashicons { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.3; }

/* ---- GRAPHIC TIMELINE (Gantt Chart) ---- */
.hc-graphic-wrapper { position: relative; }
.hc-chart-controls {
    display: flex; flex-wrap: wrap; gap: 1rem;
    align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem; padding: 0.75rem 1rem;
    background: var(--hc-bg-subtle);
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius-sm);
}
@media (max-width: 600px) { .hc-chart-controls { flex-direction: column; align-items: flex-start; } }
.hc-legend { display: flex; gap: 1.25rem; font-size: 0.72rem; font-weight: 600; color: var(--hc-text-secondary); }
.hc-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.hc-dot { width: 8px; height: 8px; border-radius: 50%; }
.hc-dot.surface { background: var(--hc-brand-blue); }
.hc-dot.subsurface { background: var(--hc-brand-green); }

.hc-filters { display: flex; gap: 0.25rem; }
.hc-filter-btn {
    padding: 0.25rem 0.6rem; border-radius: 999px;
    border: 1px solid var(--hc-border); background: #fff;
    color: var(--hc-text-secondary); font-size: 0.68rem; font-weight: 600;
    cursor: pointer; transition: var(--hc-transition); font-family: var(--hc-font);
}
.hc-filter-btn:hover { border-color: var(--hc-brand-blue); color: var(--hc-brand-blue); }
.hc-filter-btn.active { background: var(--hc-brand-blue); color: #fff; border-color: var(--hc-brand-blue); }

.hc-graphic-container {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    background: #fff;
}
.hc-graphic-table {
    width: 100%; min-width: 860px; border-collapse: collapse;
}
.hc-graphic-table th, .hc-graphic-table td {
    padding: 0 !important; text-align: center; vertical-align: middle;
    border-bottom: 1px solid var(--hc-border-light);
}
.hc-graphic-table thead th {
    position: sticky; top: 0; z-index: 10;
    background: var(--hc-bg-subtle);
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--hc-text-muted); font-weight: 700; padding: 0.7rem 0.2rem !important;
    border-bottom: 2px solid var(--hc-border);
}
/* Label column — sticky left, shrinks when .scrolled is on .hc-graphic-container */
.hc-graphic-table th:first-child, .hc-graphic-table td:first-child {
    position: sticky; left: 0; z-index: 20;
    background: #fff; text-align: left;
    width: 170px; min-width: 170px; padding: 0.55rem 0.75rem !important;
    font-weight: 600; font-size: 0.82rem; color: var(--hc-text);
    border-right: 1px solid var(--hc-border-light);
    box-shadow: 2px 0 6px -2px rgba(0,0,0,0.06);
    transition: width 300ms ease, min-width 300ms ease;
}
.hc-graphic-table thead th:first-child { z-index: 30; background: var(--hc-bg-subtle); }

/* ── Alternating row shading ───────────────────────────────────────────── */
.hc-graphic-table tbody tr:nth-child(odd)  td { background: #fafafa; }
.hc-graphic-table tbody tr:nth-child(even) td { background: #f0f2f5; }
/* Sticky first column needs solid opaque background to stay clean on h-scroll */
.hc-graphic-table tbody tr:nth-child(odd)  td:first-child { background: #fafafa; }
.hc-graphic-table tbody tr:nth-child(even) td:first-child { background: #f0f2f5; }
/* Hover overrides shading */
.hc-graphic-table tbody tr:hover td             { background: rgba(0,59,119,0.05) !important; }
.hc-graphic-table tbody tr:hover td:first-child { background: #e8f0fa !important; color: var(--hc-brand-blue); }

/* ── Insect name: full + abbr spans ────────────────────────────────────── */
.ins-full {
    display: block; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    transition: opacity 180ms ease;
}
.ins-abbr {
    display: none; /* shown only in .scrolled state */
    font-size: 0.72rem; font-weight: 700;
    color: #0d9488; white-space: nowrap;
    opacity: 0; transition: opacity 180ms ease;
}
/* Shrunk state — triggered by JS adding .scrolled to .hc-graphic-container */
.hc-graphic-container.scrolled .hc-graphic-table th:first-child,
.hc-graphic-container.scrolled .hc-graphic-table td:first-child {
    width: 62px !important; min-width: 62px !important;
}
.hc-graphic-container.scrolled .ins-full { display: none; }
.hc-graphic-container.scrolled .ins-abbr { display: block; opacity: 1; }

/* Legacy .hc-hatch-name kept for PHP static shortcode until updated */
.hc-hatch-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hc-graphic-link { text-decoration: none; color: inherit; transition: var(--hc-transition); }
.hc-graphic-link:hover { color: var(--hc-brand-blue); }

/* ── Bar cells — vertical-align centering, tighter spacing ───────────── */
.hc-bar-cell {
    vertical-align: middle;
    padding: 0.3rem 0.1rem !important; min-width: 30px;
}
/* single-bar <a> inside a cell — block so it respects margin: auto */
.hc-bar-cell > a { display: block; }
.hc-hatch-bar {
    display: block; width: calc(100% - 3px); margin: auto;
    border-radius: 3px; opacity: 0.88; transition: var(--hc-transition);
}
.hc-hatch-bar:hover { opacity: 1; transform: scaleY(1.2); }
/* Single bars — taller so they're visible & centered in the cell */
.hc-hatch-bar.surface    { height: 12px; background: var(--hc-brand-blue); }
.hc-hatch-bar.subsurface { height: 12px; background: var(--hc-brand-green); }
/* Split container — two slim bars stacked with tight gap */
.hc-split-container {
    display: flex; flex-direction: column; gap: 2px;
    align-items: stretch; width: 100%;
}
.hc-split-container a { display: block; }
.hc-split-container a .hc-hatch-bar { width: calc(100% - 3px); margin: auto; }
.hc-hatch-bar.split-top    { height: 7px; background: var(--hc-brand-blue);  border-radius: 3px 3px 0 0; }
.hc-hatch-bar.split-bottom { height: 7px; background: var(--hc-brand-green); border-radius: 0 0 3px 3px; }

/* Filter visibility — use visibility:hidden so absent bar still holds height */
.hc-show-surface    .hc-hatch-bar.subsurface,
.hc-show-surface    .hc-hatch-bar.split-bottom { visibility: hidden; }
.hc-show-surface    .hc-hatch-bar.split-top    { height: 7px !important; border-radius: 3px !important; }
.hc-show-subsurface .hc-hatch-bar.surface,
.hc-show-subsurface .hc-hatch-bar.split-top    { visibility: hidden; }
.hc-show-subsurface .hc-hatch-bar.split-bottom { height: 7px !important; border-radius: 3px !important; }

.hc-mobile-scroll-hint {
    display: none; text-align: right; font-size: 0.68rem;
    color: var(--hc-text-muted); margin-bottom: 0.35rem; font-style: italic;
}
@media (max-width: 860px) { .hc-mobile-scroll-hint { display: block; } }

/* ---- UTILITIES ---- */
.hidden { display: none !important; }
.fade-in { animation: hcFade 0.3s ease; }
@keyframes hcFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes hcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- ADMIN STYLES (preserved from v14) ---- */
.hc-pattern-row { position: relative; padding-left: 25px !important; }
.hc-drag-handle { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); color: #a7aaad; cursor: move; font-size: 20px; padding: 10px 5px; }
.hc-drag-handle:hover { color: #2271b1; }
.sortable-placeholder { border: 2px dashed #b5d6fd; background: #f0f6fc; height: 100px; margin-bottom: 15px; }
.hc-help-container { max-width: 1000px; background: #fff; padding: 30px; margin-top: 20px; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0,0,0,.04); }
.hc-help-section { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid #f0f0f1; }
.hc-help-section:last-child { border-bottom: none; }
.hc-help-section h2 { font-size: 1.6em; margin-bottom: 15px; }
.hc-help-code { background: #f6f7f7; padding: 15px; border-left: 4px solid #72aee6; font-family: monospace; margin: 10px 0; }
.hc-doc-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.hc-doc-table th, .hc-doc-table td { text-align: left; padding: 10px; border-bottom: 1px solid #f0f0f1; }
.hc-doc-table th { font-weight: 600; background: #f9f9f9; }
