/* THE NOBLE HOUSE™ — Compass edition navigator (index.hbs, assets/js/edition-navigator.js) */
.edition-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "dateline actions" "row row";
    align-items: center;
    gap: 10px 1rem;
    margin: 1.5rem 0 0;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(92, 183, 255, .14);
    letter-spacing: 0;
}

.edition-nav[hidden], .edition-nav [hidden] { display: none !important; }
.edition-nav:not([hidden]) + .daily-desk__rail { margin-top: 0; border-top: 0; }

.edition-nav button {
    font-family: var(--font-body);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.edition-nav button:disabled { cursor: default; }
.edition-nav button:focus-visible { outline: 2px solid #69c4ff; outline-offset: 2px; }

.edition-nav__dateline {
    grid-area: dateline;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: rgba(255, 255, 255, .38);
    font: 400 22px/1.15 var(--font-display);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.edition-nav__state {
    color: #69b7e0;
    font: 600 12px/1 var(--font-body);
    letter-spacing: .12em;
}

.edition-nav.is-archive .edition-nav__state { color: var(--noble-gold-light); }
.edition-nav__date { color: #f2f5f9; }

.edition-nav__actions {
    grid-area: actions;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edition-nav__all,
.edition-nav__today,
.edition-cal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--radius-pill);
    background: transparent;
    color: rgba(255, 255, 255, .86);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: border-color 160ms ease, color 160ms ease;
}

.edition-nav__all:hover,
.edition-nav__all[aria-expanded="true"] { border-color: rgba(255, 255, 255, .45); color: var(--pure-white); }

.edition-nav__today {
    border-color: rgba(212, 175, 55, .45);
    background: linear-gradient(135deg, rgba(212, 175, 55, .07), rgba(212, 175, 55, .02));
    color: var(--noble-gold-light);
}

.edition-nav__today:hover { border-color: var(--noble-gold); color: var(--noble-gold-bright); }

.edition-nav__row {
    grid-area: row;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.edition-nav__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #91a9ba;
    transition: color 160ms ease, background-color 160ms ease;
}

.edition-nav__step:hover:not(:disabled) { background: rgba(255, 255, 255, .06); color: var(--pure-white); }
.edition-nav__step:disabled { opacity: .3; }

.edition-nav__strip {
    position: relative;
    display: flex;
    gap: 8px;
    min-width: 0;
    padding: 4px 2px 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.edition-nav__strip::-webkit-scrollbar { display: none; }

.edition-nav__card {
    position: relative;
    flex: 1 0 104px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 46px;
    padding: 7px 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    color: inherit;
    text-align: left;
    scroll-snap-align: center;
    transition: transform 200ms ease, border-color 160ms ease, box-shadow 200ms ease;
}

/* Muting dims the text only, so a Special Report corner keeps its full gold. */
.edition-nav__card > span { opacity: .55; transition: opacity 160ms ease; }
.edition-nav__card:hover,
.edition-nav__card:focus-visible { border-color: rgba(255, 255, 255, .24); }
.edition-nav__card:hover > span,
.edition-nav__card:focus-visible > span,
.edition-nav__card.is-current > span { opacity: 1; }
.edition-nav .edition-nav__card:focus-visible { outline-offset: -2px; }

.edition-nav__day {
    color: #9fb3c4;
    font: 600 12px/1.1 var(--font-body);
    font-variant-caps: all-small-caps;
    letter-spacing: .06em;
    white-space: nowrap;
}

.edition-nav__lead {
    overflow: hidden;
    color: #e6ebf0;
    font: 500 12px/1.25 var(--font-body);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.edition-nav__card.is-current {
    border-color: rgba(212, 175, 55, .45);
    background: linear-gradient(135deg, rgba(212, 175, 55, .1), rgba(255, 255, 255, .04));
    box-shadow: 0 5px 10px -5px rgba(0, 0, 0, .8);
    transform: translateY(-3px);
}

.edition-nav__card.is-current .edition-nav__day { color: var(--noble-gold-light); }

.edition-nav__card.is-current::after {
    content: '';
    position: absolute;
    right: 10px;
    bottom: 0;
    left: 10px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--noble-gold), var(--noble-gold-bright));
}

.edition-nav__card.is-special::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 13px;
    height: 13px;
    background: var(--noble-gold);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

/* All editions: popover anchored to the button; a bottom sheet below 640px */
.edition-cal {
    position: absolute;
    inset: calc(100% + 8px) 0 auto auto;
    z-index: 40;
    width: 320px;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 0;
    overscroll-behavior: contain;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    background: #0c0c13;
    color: #e9eef3;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

.edition-cal__panel { display: grid; gap: 10px; padding: 14px; }
.edition-cal__panel:focus { outline: none; }

.edition-cal__head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    text-align: center;
}

.edition-cal__title {
    margin: 0;
    color: #f2f5f9;
    font: 400 18px/1.2 var(--font-display);
}

.edition-cal__count {
    margin: 2px 0 0;
    color: #8ea2b3;
    font: 600 12px/1 var(--font-body);
    font-variant-caps: all-small-caps;
    letter-spacing: .06em;
}

.edition-cal__weekdays,
.edition-cal__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    justify-items: center;
    gap: 2px;
}

.edition-cal__weekdays span { color: #6f8293; font: 600 11px/20px var(--font-body); }

.edition-cal__day {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: rgba(255, 255, 255, .2);
    font: 500 12px/1 var(--font-body);
}

button.edition-cal__day {
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(105, 183, 224, .24);
    color: var(--pure-white);
    transition: background-color 160ms ease;
}

button.edition-cal__day:hover { background: rgba(105, 183, 224, .42); }

button.edition-cal__day.is-special {
    background: linear-gradient(135deg, var(--noble-gold), var(--noble-gold-light));
    color: var(--pure-black);
    font-weight: 700;
}

button.edition-cal__day.is-current { box-shadow: 0 0 0 2px #0c0c13, 0 0 0 4px var(--noble-gold-light); }

.edition-cal__legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 0;
    color: #8ea2b3;
    font: 500 11px/1 var(--font-body);
}

.edition-cal__legend span::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: rgba(105, 183, 224, .5);
}

.edition-cal__legend span + span::before { background: var(--noble-gold); }
.edition-cal .edition-cal__close { display: none; }

@media (max-width: 639px) {
    .edition-nav {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "dateline" "row" "actions";
        gap: 4px;
        padding-bottom: 0;
    }

    .edition-nav__row { gap: 2px; }
    .edition-nav__card { flex: 0 0 104px; }
    .edition-nav__all { order: -1; }

    .edition-cal {
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .edition-cal[open] { animation: edition-sheet 220ms ease-out; }
    .edition-cal::backdrop { background: rgba(4, 4, 8, .62); }
    .edition-cal__panel { padding: 10px 16px 14px; }

    .edition-cal__panel::before {
        content: '';
        justify-self: center;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, .22);
    }

    .edition-cal__day { width: 44px; height: 44px; font-size: 14px; }
    .edition-cal .edition-cal__close { display: flex; width: 100%; margin-top: 4px; font-size: 14px; }
}

@keyframes edition-sheet { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
    .edition-nav__card,
    .edition-nav__card > span,
    .edition-nav__step,
    .edition-nav__all,
    .edition-nav__today,
    button.edition-cal__day { transition: none; }

    .edition-cal[open] { animation: none; }
}
