/**
 * Year Navigation — ArtistFolio
 * ==============================
 * Optional year-based works navigation.
 * Three variants: top-bar, left-rail, floating-dots.
 *
 * All variants share:
 *   - opacity 0 / pointer-events none → show via .is-visible (JS)
 *   - Active year via .is-active on .year-nav__item
 *   - CSS custom props from 00-base.css
 */

/* ── Shared base ──────────────────────────────────────────────────────────── */

.year-nav {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t, 0.25s ease);
    z-index: 90;
}

.year-nav.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.year-nav__count {
    opacity: 0.5;
    font-weight: 400;
    margin-left: 2px;
}

/* ── Variant 1: top-bar ───────────────────────────────────────────────────── */
/*
 * Fixed bar docked directly below the site header.
 * Slides in via opacity when works section is in view (JS adds .is-visible).
 */

.year-nav--top-bar {
    position: fixed;
    top: var(--header-height, 112px);
    left: 0;
    right: 0;
    height: var(--year-nav-height, 36px);
    background: var(--bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    z-index: 90;
}

.year-nav--top-bar .year-nav__inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: var(--max-width, 1100px);
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
}

.year-nav--top-bar .year-nav__inner::-webkit-scrollbar {
    display: none;
}

.year-nav--top-bar .year-nav__item {
    display: inline-flex;
    align-items: center;
    height: var(--year-nav-height, 36px);
    padding: 0 14px;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: color var(--t-fast, 0.15s ease);
    flex-shrink: 0;
}

/* Separator dots between items */
.year-nav--top-bar .year-nav__item + .year-nav__item::before {
    content: '·';
    position: absolute;
    left: -1px;
    color: var(--border);
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
}

.year-nav--top-bar .year-nav__item:hover {
    color: var(--fg);
}

.year-nav--top-bar .year-nav__item.is-active {
    color: var(--fg);
    font-weight: 600;
}

/* Active underline indicator */
.year-nav--top-bar .year-nav__item.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: var(--accent, var(--fg));
    border-radius: 1px 1px 0 0;
}

/* Mobile top-bar */
@media (max-width: 900px) {
    .year-nav--top-bar {
        top: var(--header-height-mobile, 80px);
    }

    .year-nav--top-bar .year-nav__item {
        padding: 0 10px;
        font-size: 9px;
    }
}


/* Suppress the header's bottom border when year nav sits flush below it */
body.has-year-nav .site-header {
    border-bottom: none;
}

/* Push the whole #works section down so the page title clears the year nav */
body.has-year-nav #works {
    padding-top: calc(var(--year-nav-height, 36px) + 24px);
    scroll-margin-top: calc(var(--header-height, 112px) + var(--year-nav-height, 36px) + 8px);
}

/* Year-section headings: generous scroll-offset so they land with comfortable spacing */
body.has-year-nav .works-year {
    scroll-margin-top: calc(var(--header-height, 112px) + var(--year-nav-height, 36px) + 32px);
}

/* ── Variant 2: left-rail ─────────────────────────────────────────────────── */
/*
 * Fixed vertical strip in the left gutter beside the content column.
 * Years listed top→bottom (newest first), active one has a longer line.
 * Hidden below 1200px where there's no gutter.
 */

.year-nav--left-rail {
    position: fixed;
    /* Sit in the left gutter: half of (viewport - max-width) minus own width */
    left: max(12px, calc((100vw - var(--max-width, 1100px)) / 2 - 68px));
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.year-nav--left-rail .year-nav__inner {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.year-nav--left-rail .year-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 0;
    white-space: nowrap;
    justify-content: flex-end;
    transition: color var(--t-fast, 0.15s ease);
}

/* Horizontal tick mark on the right of the label */
.year-nav--left-rail .year-nav__item::after {
    content: '';
    display: block;
    width: 14px;
    height: 1px;
    background: currentColor;
    opacity: 0.3;
    transition: width var(--t-fast, 0.15s ease), opacity var(--t-fast, 0.15s ease);
    flex-shrink: 0;
}

.year-nav--left-rail .year-nav__item:hover {
    color: var(--fg);
}

.year-nav--left-rail .year-nav__item:hover::after {
    width: 20px;
    opacity: 0.6;
}

.year-nav--left-rail .year-nav__item.is-active {
    color: var(--fg);
    font-weight: 600;
}

.year-nav--left-rail .year-nav__item.is-active::after {
    width: 24px;
    height: 2px;
    background: var(--accent, var(--fg));
    opacity: 1;
}

/* Hide when no gutter space */
@media (max-width: 1200px) {
    .year-nav--left-rail {
        display: none;
    }
}


/* ── Variant 3: floating-dots ─────────────────────────────────────────────── */
/*
 * Compact fixed dots on the right edge, year label revealed on hover/active.
 * All sizes — on mobile the dots sit at bottom-right.
 */

.year-nav--floating-dots {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.year-nav--floating-dots .year-nav__inner {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.year-nav--floating-dots .year-nav__item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
}

/* Year label — hidden until hover or active */
.year-nav--floating-dots .year-nav__label {
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 3px 7px;
    border-radius: 3px;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity var(--t-fast, 0.15s ease), transform var(--t-fast, 0.15s ease);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.06));
}

.year-nav--floating-dots .year-nav__item:hover .year-nav__label,
.year-nav--floating-dots .year-nav__item.is-active .year-nav__label {
    opacity: 1;
    transform: translateX(0);
}

/* The dot */
.year-nav--floating-dots .year-nav__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.35;
    transition:
        width var(--t-fast, 0.15s ease),
        height var(--t-fast, 0.15s ease),
        opacity var(--t-fast, 0.15s ease),
        background var(--t-fast, 0.15s ease);
    flex-shrink: 0;
}

.year-nav--floating-dots .year-nav__item:hover .year-nav__dot {
    opacity: 0.7;
    width: 7px;
    height: 7px;
}

.year-nav--floating-dots .year-nav__item.is-active .year-nav__dot {
    width: 8px;
    height: 8px;
    background: var(--accent, var(--fg));
    opacity: 1;
}

/* Mobile: move to bottom-right, horizontal layout */
@media (max-width: 768px) {
    .year-nav--floating-dots {
        right: 12px;
        bottom: 24px;
        top: auto;
        transform: none;
    }

    .year-nav--floating-dots .year-nav__inner {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    /* On mobile always show label for active item */
    .year-nav--floating-dots .year-nav__item.is-active .year-nav__label {
        display: none; /* hidden on mobile, dot only */
    }
}


/* ── Dark mode ────────────────────────────────────────────────────────────── */

[data-theme="dark"] .year-nav--top-bar,
.dark-mode .year-nav--top-bar {
    background: var(--bg);
}

[data-theme="dark"] .year-nav--floating-dots .year-nav__label,
.dark-mode .year-nav--floating-dots .year-nav__label {
    background: var(--bg);
    border-color: var(--border);
}


/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .year-nav,
    .year-nav__item,
    .year-nav__dot,
    .year-nav__label {
        transition: none !important;
    }
}
