/* dock.css - the Apple liquid-glass nav dock + Spotlight search,
   shared so the homepage matches every inner page exactly.
   Self-contained token aliases (values mirror the retuned style.css). */
:root {
  --heading-color: #18181b;
  --text-color: #18181b;
  --accent-color: #6b7280;
  --link-color: #2f5d9e;
  --font-mono: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  --font-main: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius-pill: 999px;
  --radius-lg: 24px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --ease-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.075);
}

/* interactions.js prepends a decorative dot-grid <canvas> into <header>.
   Pin it so it never takes layout space (otherwise the header balloons into
   a full screen of whitespace) and never intercepts clicks. */
header { position: relative; }
.dot-grid-canvas {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
header > *:not(.dot-grid-canvas) { position: relative; z-index: 1; }


.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 2px;
    background: var(--heading-color);
    z-index: 10000;
    transform-origin: left;
    transform: scaleX(0);
    will-change: transform;
}

/* Section indicator removed - replaced by .nav-dock */
.section-indicator { display: none !important; }

.nav-dock {
    position: fixed;
    bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translate3d(0, 16px, 0) scale(0.96);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem;
    isolation: isolate; /* contain pseudo-element blend modes */
    background: rgba(255, 255, 255, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-pill);
    backdrop-filter: blur(24px) saturate(220%) brightness(1.04);
    -webkit-backdrop-filter: blur(24px) saturate(220%) brightness(1.04);
    box-shadow:
        /* outer ambient depth */
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 22px 60px rgba(0, 0, 0, 0.1),
        /* outline glow */
        0 0 0 0.5px rgba(255, 255, 255, 0.7),
        /* internal layering: top specular + bottom shadow */
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 0 rgba(255, 255, 255, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.45s var(--ease-smooth),
        transform 0.55s var(--ease-spring),
        background-color 0.3s var(--ease-smooth),
        box-shadow 0.3s var(--ease-smooth);
    will-change: opacity, transform;
}

/* Specular top sheen - thin curved light catch like a polished glass tube */
.nav-dock::before {
    content: "";
    position: absolute;
    inset: 1px 1px auto 1px;
    height: 45%;
    border-radius: var(--radius-pill) var(--radius-pill) 50% 50% / var(--radius-pill) var(--radius-pill) 100% 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.1) 75%, transparent);
    pointer-events: none;
    opacity: 0.55;
    z-index: -1;
}

/* Soft inner glow + a hint of refraction across the lower half */
.nav-dock::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(120% 80% at 50% -20%, rgba(255,255,255,0.5), transparent 60%),
        radial-gradient(120% 80% at 50% 120%, rgba(255,255,255,0.18), transparent 60%);
    pointer-events: none;
    z-index: -1;
}

.nav-dock.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translate3d(0, 0, 0) scale(1);
}

@media (hover: hover) {
    .nav-dock:hover {
        background: rgba(255, 255, 255, 0.18);
        border-color: rgba(0, 0, 0, 0.14);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.65),
            inset 0 -1px 0 rgba(0, 0, 0, 0.06),
            0 6px 20px rgba(0, 0, 0, 0.07),
            0 24px 56px rgba(0, 0, 0, 0.06);
    }
}

.nav-dock-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: none;
    transition:
        background-color 0.22s var(--ease-smooth),
        color 0.22s var(--ease-smooth),
        transform 0.22s var(--ease-spring),
        box-shadow 0.22s var(--ease-smooth);
    white-space: nowrap;
    position: relative;
}

.nav-dock-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    transition: transform 0.22s var(--ease-spring);
}

.nav-dock-item:hover {
    background: rgba(255, 255, 255, 0.55);
    color: var(--heading-color);
    border-bottom: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-dock-item:hover svg {
    transform: scale(1.08);
}

.nav-dock-item:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}

.nav-dock-item.active {
    background: var(--heading-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.nav-dock-item.active:hover {
    background: #000;
    color: #fff;
    transform: translateY(-1px);
}

.nav-dock-divider {
    width: 1px;
    height: 18px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

/* Spotlight trigger in dock */
.nav-dock-search {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-color);
}

.nav-dock-search .nav-dock-shortcut {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.12rem 0.32rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.08);
    color: var(--accent-color);
    letter-spacing: 0.5px;
    margin-left: 0.1rem;
}

/* ── Spotlight Search Modal ────────────────── */
.spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 15, 25, 0.35);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s var(--ease-smooth);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 1rem 1rem;
}

.spotlight-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spotlight {
    width: 100%;
    max-width: 560px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transform: translateY(-12px) scale(0.98);
    opacity: 0;
    transition:
        transform 0.32s var(--ease-spring),
        opacity 0.22s var(--ease-smooth);
}

.spotlight-overlay.visible .spotlight {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.spotlight-search {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.spotlight-icon {
    width: 18px;
    height: 18px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.spotlight-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-color);
    padding: 0.2rem 0;
}

.spotlight-input::placeholder {
    color: var(--accent-color);
    opacity: 0.6;
}

.spotlight-hint,
.spotlight-footer kbd {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.14rem 0.42rem;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--accent-color);
    letter-spacing: 0.5px;
}

.spotlight-results {
    list-style: none;
    padding: 0.35rem;
    margin: 0;
    max-height: 50vh;
    overflow-y: auto;
}

.spotlight-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.12s var(--ease-smooth);
    color: var(--text-color);
}

.spotlight-item.active {
    background: rgba(56, 97, 143, 0.1);
}

.spotlight-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    flex: 1;
    min-width: 0;
}

.spotlight-item-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--heading-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotlight-item-desc {
    font-size: 0.78rem;
    color: var(--accent-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotlight-item-group {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent-color);
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.spotlight-item.active .spotlight-item-group {
    color: var(--link-color);
    background: rgba(56, 97, 143, 0.12);
}

.spotlight-empty {
    list-style: none;
    padding: 1.4rem 1rem;
    text-align: center;
    color: var(--accent-color);
    font-size: 0.9rem;
}

.spotlight-footer {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 1.1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
    font-size: 0.72rem;
    color: var(--accent-color);
}

.spotlight-footer span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

@media (max-width: 640px) {
    .spotlight-overlay { padding-top: 8vh; }
    .spotlight-input { font-size: 16px; }
    .nav-dock-search .nav-dock-shortcut { display: none; }
}

@media (max-width: 700px) {
    /* Phone dock: one fixed bar, every item always visible. No horizontal
       scrolling (it cut icons in half and looked broken), no emphasised
       search pill, no inset-shadow "underline" on the active item. */
    .nav-dock {
        bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px));
        left: 12px;
        right: 12px;
        width: auto;
        transform: translate3d(0, 16px, 0) scale(0.98);
        justify-content: space-between;
        gap: 0;
        padding: 0.3rem 0.4rem;
        /* More opaque than desktop: thin glass over body text reads as a
           rendering bug on phones (and some browsers skip backdrop-filter). */
        background: rgba(255, 255, 255, 0.9);
    }
    .nav-dock.visible {
        transform: translate3d(0, 0, 0) scale(1);
    }

    .nav-dock-item {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;            /* WCAG touch target */
        padding: 0.5rem 0;
        justify-content: center;
        border-radius: 12px;
    }
    .nav-dock-item .nav-dock-label { display: none; }
    .nav-dock-item svg { width: 20px; height: 20px; }
    .nav-dock-divider { display: none; }

    /* "Top" is redundant on phones (status-bar tap / quick flick) and the
       column it frees keeps the remaining seven targets comfortably wide.
       !important: keep in sync with style.css, where a coarse-pointer
       a:not(...) rule would otherwise re-apply display. */
    .nav-dock-top { display: none !important; }

    /* Search looks like every other item on phones. */
    .nav-dock-search {
        background: none;
        border: none;
    }
    .nav-dock-search .nav-dock-shortcut { display: none; }

    /* Active item: quiet tinted pill, same shape as the tap target. */
    .nav-dock-item.active {
        background: rgba(56, 97, 143, 0.14);
        color: var(--heading-color);
        box-shadow: none;
    }
    .nav-dock-item.active:hover { background: rgba(56, 97, 143, 0.2); color: var(--heading-color); }
}

/* Tiny phones: tighter still */
@media (max-width: 380px) {
    .nav-dock {
        bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
        left: 8px;
        right: 8px;
        padding: 0.26rem 0.3rem;
    }
    .nav-dock-item {
        min-height: 42px;
        padding: 0.45rem 0;
    }
    .nav-dock-item svg { width: 18px; height: 18px; }
}
