/* layout.css — Page structure, containers, responsive */

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

html {
    /* Fluid typography: smoothly scales between ≡13px (mobile) and ≡15px (desktop)
       at browser default 16px. Uses em (not px) so it respects user font-size preference. */
    font-size: clamp(0.8125em, calc(0.75em + 0.3vw), 0.9375em);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Form controls otherwise default to UA fonts (Arial on Chromium, system-control
   on others) which breaks visual parity with surrounding text. Opt them back
   into normal inheritance so buttons/inputs/selects/textareas all render with
   the page's font, size, weight, and line-height. */
button, input, select, textarea {
    font: inherit;
}

.page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
}

.page-header {
    --title-size: 2rem;
    text-align: center;
    padding: var(--space-xl) 0 var(--space-lg);
}

.page-header h1 {
    font-size: var(--title-size);
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.5px;
}

.page-header .subtitle {
    font-size: var(--fs-100);
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
    font-style: italic;
}

.page-header .logo {
    display: block;
    height: calc(var(--title-size) * 2.5);
    margin: var(--space-md) auto;
    border-radius: var(--radius-md);
}

@keyframes logo-breathe {
    0%   { transform: scale(1);    filter: drop-shadow(0 0 0px transparent); }
    50%  { transform: scale(1.12); filter: drop-shadow(0 6px 24px rgba(0,0,0,0.28)); }
    100% { transform: scale(1);    filter: drop-shadow(0 0 0px transparent); }
}

/* Full-screen splash — hidden by default, shown only when load takes >60 ms */
.logo-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg, #fff);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.logo-splash.splash-visible {
    opacity: 1;
    pointer-events: none;
}

.logo-splash-img {
    width: min(36vw, 36vh);
    height: auto;
    border-radius: var(--radius-md);
    animation: logo-breathe 1.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
    .logo-splash-img { animation: none; }
}

@media (max-width: 640px) {
    .page-header .logo.logo-loading {
        animation: logo-breathe 1.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
        transform-origin: center;
    }

    @media (prefers-reduced-motion: reduce) {
        .page-header .logo.logo-loading { animation: none; }
    }
}


.table-wrapper {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-xl);
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - var(--nav-height, 48px) - 40px);
}

/* Loading / Error */
.loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-text-muted);
    font-size: var(--fs-110);
}

.error {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-loss);
    font-size: var(--fs-110);
}

/* Responsive */
@media (max-width: 768px) {
    /* html font-size handled by fluid clamp() above — no breakpoint override */

    .page-container {
        padding: var(--space-md) var(--space-sm);
    }

    .page-header {
        padding: var(--space-lg) 0 var(--space-md);
    }
}

/* Phone — edge-to-edge so cards can span the full viewport width */
@media (max-width: 640px) {
    .page-container {
        padding: var(--space-md) var(--space-xs);
    }

    /* Remove vertical cap so all rows show; page scrolls naturally */
    .table-scroll {
        max-height: none;
    }
}
