/* Hurrbee home rails — saved sites + search history honeycombs.
   Tile box is set by the SVG width/height attributes in hurrbee-rails.js
   (36x42). Pointy-top hexagons tile in rows: row pitch is 3/4 of tile
   height, alternate rows offset by half tile width. */

.hb-home {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(0, 680px) minmax(200px, 1fr);
    gap: 40px;
    align-items: start;
    width: 100%;
    margin: 2rem auto 0;
    padding: 0 32px;
}

.hb-hero { padding-top: 8px; text-align: center; }
.hb-home .search-form { margin-top: 0; padding-top: 0; }
.hb-home #keyword-search-form { max-width: 100%; }
.hb-rail { padding-top: 3.5rem; }

.hb-rail-head { display: flex; align-items: center; justify-content: space-between; }
.hb-rail-title { font-size: 12px; font-weight: 500; color: #6b6b6b; margin: 0 0 12px; }
.hb-icon-btn { background: none; border: 0; padding: 4px; color: #9a9a9a; cursor: pointer; line-height: 1; }
.hb-icon-btn:hover { color: #4a4a4a; }

.hb-rail-right .hb-rail-head { justify-content: flex-end; gap: 8px; }
.hb-rail-right .hb-rail-title { margin-bottom: 0; }
.hb-rail-right .hb-rail-head { margin-left: auto; max-width: 200px; }
.hb-rail-left .hb-rail-head { max-width: 200px; }

.hb-comb { min-height: 0; }
.hb-comb-skeleton { height: 100px; }
.hb-comb-row { display: flex; gap: 0; margin-top: -10px; }
.hb-comb-row:first-child { margin-top: 0; }
.hb-comb-row.hb-row-2 { margin-left: 18px; }
.hb-comb-row.hb-row-4 { margin-left: -18px; }
.hb-comb.hb-wide { padding: 0 18px; }

.hb-rail-right .hb-comb-row { justify-content: flex-end; }
.hb-rail-right .hb-comb-row.hb-row-2 { margin-left: 0; margin-right: 18px; }
.hb-rail-right .hb-comb-row.hb-row-4 { margin-left: 0; margin-right: -18px; }

.hb-cell { width: 36px; position: relative; flex: 0 0 auto; }
.hb-tile { display: block; width: auto; height: auto; line-height: 0; border: 0; padding: 0; background: none; cursor: pointer; }
.hb-tile svg { display: block; }
.hb-tile:focus-visible { outline: 2px solid #b8860b; outline-offset: 3px; border-radius: 4px; }
.hb-label { display: none; }

.hb-remove {
    position: absolute; top: -2px; left: 0;
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid #d5d5d5; background: #fff; color: #6b6b6b;
    font-size: 10px; line-height: 1; padding: 0; cursor: pointer;
    opacity: 0; transition: opacity 120ms ease;
}
.hb-cell:hover .hb-remove, .hb-remove:focus-visible, .hb-cell.is-editing .hb-remove { opacity: 1; }

.hb-empty { font-size: 11px; line-height: 1.5; color: #9a9a9a; }
.hb-empty a { color: #b8860b; }
.hb-rail-right .hb-empty { text-align: right; }

.hb-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 10px 14px; font-size: 12px; color: #4a4a4a;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08); z-index: 60;
    display: flex; align-items: center; gap: 12px;
}
.hb-toast button { background: none; border: 0; padding: 0; font-size: 12px; color: #b8860b; cursor: pointer; }

@media (max-width: 900px) {
    .hb-home {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 16px;
        margin-top: 1rem;
    }

    .hb-hero { order: 1; }
    .hb-rail-left { order: 2; }
    .hb-rail-right { order: 3; }

    .hb-rail { padding-top: 0; }

    .hb-rail-head,
    .hb-rail-right .hb-rail-head,
    .hb-rail-left .hb-rail-head { max-width: none; justify-content: space-between; }

    .hb-rail-title { margin-bottom: 8px; }

    /* Centred rows on a single-column layout. */
    /* Centring already offsets the shorter rows — the explicit margins would
       double it, so they are cleared here. */
    .hb-comb-row,
    .hb-rail-right .hb-comb-row { justify-content: center; }

    /* The row is centred, so a margin on the row itself moves nothing. Padding
       the row shifts its centred contents instead. */
    .hb-comb-row.hb-row-2,
    .hb-rail-right .hb-comb-row.hb-row-2 { margin: -10px 0 0; padding-left: 4px; }

    .hb-comb-row.hb-row-4,
    .hb-rail-right .hb-comb-row.hb-row-4 { margin-left: 18px; margin-right: 0; }

    .hb-comb.hb-wide { padding: 0; }

    .hb-empty, .hb-rail-right .hb-empty { text-align: left; }

    /* Corner badges are under the 44px touch minimum, so long-press enters
       edit mode and the badge grows to a tappable size. */
    .hb-remove { width: 26px; height: 26px; font-size: 14px; top: -6px; left: -8px; }
}

@media (prefers-reduced-motion: reduce) {
    .hb-remove { transition: none; }
}

/* Pinned search terms carry a small filled honeycomb, matching the save
   control on the results page. */
.hb-pinned-mark {
    position: absolute;
    right: 1px;
    bottom: 4px;
    line-height: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);
}

/* Idle bee — drifts to a few tiles after two minutes of inactivity. */
.hb-bee {
    position: absolute;
    width: 28px;
    height: auto;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: left 1.5s cubic-bezier(.45,.05,.35,1), top 1.5s cubic-bezier(.45,.05,.35,1), opacity 1.2s ease, transform 1.5s ease;
}

@media (prefers-reduced-motion: reduce) { .hb-bee { display: none; } }

.hb-bee { width: 38px; transition: left .95s cubic-bezier(.4,.1,.3,1), top .95s cubic-bezier(.4,.1,.3,1), opacity 1s ease, transform 1s ease; }

/* Walking is slower and linear; flight keeps the swooping easing. */
.hb-bee-walk { transition: left .7s linear, top .7s linear, opacity 1s ease, transform .7s linear !important; }

/* Row offsets are set inline by comb(); these only handle the vertical pitch. */
.hb-comb-row { margin-top: -10px; }
.hb-comb-row:first-child { margin-top: 0; }
.hb-cell { width: auto; }

@media (min-width: 901px) {
    .hb-comb-row { margin-top: -14px; }
}

@media (max-width: 900px) {
    .hb-comb-row,
    .hb-rail-right .hb-comb-row { justify-content: flex-start; }
    .hb-comb-row.hb-row-2, .hb-comb-row.hb-row-4 { padding-left: 0; }
}

/* Desktop: tiles sit desaturated until hovered, so colour marks intent. */
@media (min-width: 901px) and (hover: hover) {
    .hb-tile svg {
        filter: grayscale(1);
        transition: filter .18s ease;
    }

    .hb-cell:hover .hb-tile svg,
    .hb-tile:focus-visible svg {
        filter: none;
    }
}

/* Two circles over a rail lights every tile in it for two minutes. */
@media (min-width: 901px) and (hover: hover) {
    .hb-rail.hb-lit .hb-tile svg { filter: none; }
}
