/* rawyield — app shell styles.
 *
 * Dark-first (gym-friendly), warm-biased neutrals, one amber accent.
 * Component-scoped styles live next to their components via css``;
 * this file holds tokens, reset, and the app shell only.
 */

:root {
    /* ground */
    --bg: #0c0d0f;
    --surface: #16181c;
    --surface-2: #1e2126;
    --border: #2a2e35;

    /* text */
    --text: #e8e6e1;
    --text-muted: #98958d;
    --text-faint: #5d5b55;

    /* accent */
    --accent: #e0a83c;
    --accent-dim: #8a6a2c;
    --on-accent: #14100a;

    /* semantic (separate from accent) */
    --ok: #6fbf73;
    --warn: #e0a83c;
    --danger: #e05d5d;

    --radius: 10px;
    --tabbar-h: 56px;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* overflow:hidden is load-bearing: iOS standalone PWAs will scroll the
 * document itself if it's scrollable at all, desyncing the visual viewport
 * from the layout viewport (shifted UI, dead fixed-position hit targets).
 * The document never scrolls — only inner containers do. */
html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

/* Standalone iOS under-reports 100dvh/innerHeight by the status-bar height
 * (surface starts at y=0 but dvh=screen−59 here), stranding the layout 59px
 * above the physical bottom. 100vh (the large viewport) reaches the true
 * bottom in standalone; browsers keep the honest 100dvh above. */
@media (display-mode: standalone) {
    html, body { height: 100vh; }
}

#app { height: 100%; position: relative; } /* overlays anchor here, never position:fixed */

.toast {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    left: 16px; right: 16px;
    z-index: 300;
    background: var(--surface-2);
    border: 1px solid var(--danger);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    text-align: center;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); text-decoration: none; }

/* Numbers that line up: timers, weights, reps */
.tnum { font-variant-numeric: tabular-nums; }

/* ── App shell ── */

.shell {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.shell-outlet {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0px);
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

/* ── Tab bar ── */

/* In-flow flex child, NOT position:fixed — standalone iOS misplaces fixed
 * bottom elements when the layout viewport disagrees with the screen.
 * Background matches the page so the OS-inset strip below reads seamless.
 * Bottom padding clears the home indicator, trimmed below Apple's full
 * (excessive) inset; zero on devices without one. */
.tabbar {
    --tabbar-pad-b: max(0px, calc(env(safe-area-inset-bottom, 0px) - 4px));
    flex-shrink: 0;
    height: calc(var(--tabbar-h) + var(--tabbar-pad-b));
    padding-bottom: var(--tabbar-pad-b);
    display: flex;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tab svg { width: 22px; height: 22px; }

.tab.active { color: var(--accent); }

.tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: 8px;
}

/* ── Common bits ── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: background 120ms ease;
}
.btn:active { background: var(--border); }

.btn-accent {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
}
.btn-accent:active { background: var(--accent-dim); }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
