/* ══════════════════════════════════════════════════════════════════
   SIDER iOS — BOTTOM TAB BAR + PAGE CHROME
   ──────────────────────────────────────────────────────────────────
   Local to apps/sider-ios/ — shared by index.html, privacy.html and
   terms.html. Deliberately NOT in the site-wide design-system.css so
   the other app pages are untouched; copy this folder to adopt it.

   Depends on design-system.css for the --ds-* tokens.
   ══════════════════════════════════════════════════════════════════ */

:root {
    --sd-tabbar-h: 60px;          /* bar height, excluding the safe-area inset */
    --sd-tabbar-gap: 0px;         /* distance from the bottom edge (desktop dock) */
}

/* Reserve room so the footer is never trapped under the bar, and so
   anchor jumps don't land content behind it. */
body {
    padding-bottom: calc(var(--sd-tabbar-h) + var(--sd-tabbar-gap) + env(safe-area-inset-bottom, 0px) + 0.75rem);
}
html {
    scroll-padding-top: 1rem;
    scroll-padding-bottom: calc(var(--sd-tabbar-h) + var(--sd-tabbar-gap) + env(safe-area-inset-bottom, 0px) + 1rem);
}


/* ── Skip link — first tab stop, visible only when focused ───────── */
.sd-skip {
    position: fixed;
    top: 0.6rem;
    left: 50%;
    z-index: 3000;
    transform: translate(-50%, -160%);
    padding: 0.6rem 1.2rem;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-accent);
    color: #fff;
    font-family: var(--ds-font);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--ds-shadow-md);
    transition: transform var(--ds-dur-fast) var(--ds-ease);
}
.sd-skip:focus-visible {
    transform: translate(-50%, 0);
    outline: 2px solid var(--ds-text);
    outline-offset: 2px;
}


/* ══════════════════════════════════════════════════════════════════
   TAB BAR
   ────────────────────────────────────────────────────────────────── */
.sd-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    background: rgba(18, 33, 28, 0.86);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-top: 1px solid var(--ds-border-strong);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.30);
}

.sd-tabbar-inner {
    display: flex;
    align-items: stretch;
    max-width: 620px;
    margin: 0 auto;
    padding: 0 0.3rem;
}

.sd-tab {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-height: var(--sd-tabbar-h);
    padding: 0.45rem 0.15rem;
    border-radius: var(--ds-radius-md);
    color: var(--ds-text-dim);
    text-decoration: none;
    font-family: var(--ds-font);
    -webkit-tap-highlight-color: transparent;
    transition: color var(--ds-dur-fast) var(--ds-ease);
}

/* Active pill sits behind the icon + label */
.sd-tab::before {
    content: '';
    position: absolute;
    inset: 0.25rem 0.15rem;
    border-radius: var(--ds-radius-md);
    background: rgba(66, 132, 117, 0.20);
    opacity: 0;
    transform: scale(0.86);
    transition: opacity var(--ds-dur-fast) var(--ds-ease),
                transform var(--ds-dur) var(--ds-ease-bounce);
    pointer-events: none;
}

.sd-tab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform var(--ds-dur) var(--ds-ease-bounce);
}
.sd-tab-label {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Hover is a desktop-only affordance — never leave a stuck :hover on touch */
@media (hover: hover) {
    .sd-tab:hover { color: var(--ds-text-soft); }
    .sd-tab:hover .sd-tab-icon { transform: translateY(-2px); }
}
.sd-tab:active .sd-tab-icon { transform: scale(0.9); }

.sd-tab.is-active { color: var(--ds-accent-light); }
.sd-tab.is-active::before { opacity: 1; transform: scale(1); }

.sd-tab:focus-visible {
    outline: 2px solid var(--ds-accent-light);
    outline-offset: -3px;
}

/* ── Desktop: float the bar into a centred dock ──────────────────── */
@media (min-width: 768px) {
    :root {
        --sd-tabbar-h: 52px;
        --sd-tabbar-gap: 22px;
    }
    .sd-tabbar {
        left: 50%;
        right: auto;
        bottom: var(--sd-tabbar-gap);
        transform: translateX(-50%);
        width: max-content;
        max-width: calc(100vw - 2rem);
        border: 1px solid var(--ds-border-strong);
        border-radius: var(--ds-radius-pill);
        box-shadow: var(--ds-shadow-lg);
        padding-bottom: 0;
    }
    .sd-tabbar-inner { padding: 0.25rem; max-width: none; }
    .sd-tab {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 0.45rem;
        min-height: var(--sd-tabbar-h);
        padding: 0 1.05rem;
        border-radius: var(--ds-radius-pill);
    }
    .sd-tab::before { inset: 0; border-radius: var(--ds-radius-pill); }
    .sd-tab-icon { width: 19px; height: 19px; }
    .sd-tab-label { font-size: 0.78rem; letter-spacing: 0.2px; }
}

/* Very narrow phones — keep five labels legible */
@media (max-width: 359px) {
    .sd-tab-label { font-size: 0.58rem; letter-spacing: 0; }
    .sd-tab-icon { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .sd-tab,
    .sd-tab::before,
    .sd-tab-icon,
    .sd-skip { transition: none !important; }
}

/* Printing a legal page shouldn't print the navigation */
@media print {
    .sd-tabbar,
    .sd-skip { display: none !important; }
    body { padding-bottom: 0; }
}
