/* Base: reset, type, page frame, accessibility helpers and the reference entrance motion. */
*, *::before, *::after { box-sizing: border-box; }

html {
    background: var(--canvas);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 96px;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.menu-open { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: var(--blue-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
[hidden] { display: none !important; }

h1 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-book);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h3 { font-size: var(--text-md); font-weight: var(--weight-medium); line-height: 1.3; }

@media (min-width: 768px) {
    h1 { font-size: var(--text-3xl); }
}

.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.secondary { color: var(--ink-secondary); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--light-fill);
    color: var(--ink-on-light);
    font-weight: var(--weight-medium);
    text-decoration: none;
    transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Page frame: one centred column shared by the nav and every view, so the mark aligns with headings. */
.frame {
    width: 100%;
    max-width: calc(var(--content) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.main { display: block; min-height: 60vh; }
.main:focus { outline: none; }

.view {
    width: 100%;
    max-width: calc(var(--content) + 2 * var(--gutter));
    margin: 0 auto;
    padding: var(--s8) var(--gutter) var(--s12);
}

.view[aria-busy="true"] { cursor: progress; }

.boot {
    display: flex;
    min-height: 70vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s4);
    color: var(--ink-secondary);
}

.boot-mark { animation: breathe 1.6s var(--ease-out) infinite alternate; }

/* Entrance motion from the reference: elements start hidden and are revealed only by forwards fill. */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-down {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-scale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes bar-grow {
    from { opacity: 0; transform: scaleY(0); }
    to { opacity: 1; transform: scaleY(1); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes breathe {
    from { opacity: 0.45; }
    to { opacity: 1; }
}

.anim { opacity: 0; animation-fill-mode: forwards; animation-timing-function: var(--ease-out); }
.fade-down { animation-name: fade-down; animation-duration: var(--dur-fade-down); }
.fade-up { animation-name: fade-up; animation-duration: var(--dur-fade-up); }
.fade-scale { animation-name: fade-scale; animation-duration: var(--dur-scale); }
.fade-in { animation-name: fade-in; animation-duration: 400ms; }

#nav-pill { animation-delay: 100ms; }
#nav-actions, #menu-toggle { animation-delay: 200ms; }

.bar-grow {
    opacity: 0;
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: bar-grow var(--dur-bar) var(--ease-out) forwards;
}

@media (prefers-reduced-motion: reduce) {
    .anim, .bar-grow, .boot-mark {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }

    *, *::before, *::after {
        transition-duration: 1ms !important;
        animation-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}

/* Temporary address notice (subtle; Settings, Config and the sign-in footer). */
.address-note {
    display: flex;
    gap: var(--s3);
    align-items: flex-start;
    padding: var(--s3) var(--s4);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--ink-secondary);
    font-size: var(--text-sm);
}

.address-note .icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--ink-muted); }
.address-note strong { color: var(--ink); font-weight: var(--weight-medium); }

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
