/* base.css - Variables, reset, navigation, footer and the components both pages share (every page) */

/* =============================================
   CSS CUSTOM PROPERTIES
   ============================================= */
:root {
    --color-bg:             #F5F8FF;
    --color-surface:        #FFFFFF;
    --color-surface-hover:  #EDF2FF;
    --color-accent:         #2563EB;
    --color-accent-light:   #1D4ED8;
    --color-border:         #C0D0E8;
    --color-text-primary:   #0C1A2E;
    --color-text-secondary: #3A5070;
    --color-text-muted:     #7A90AA;

    --color-orange:       #F59E0B;
    --color-red-dark:     #B91C1C;
    --color-green:        #15803D;
    --color-warning-bg:   #FFF7E6;
    --color-warning-text: #8A5200;
    --color-on-accent:    #FFFFFF;
    --shadow-popup: 0 6px 18px rgba(12, 26, 46, 0.12);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --font-mono: 'Space Mono', monospace;
    --font-sans: 'DM Sans', sans-serif;

    /* Font sizes of the text (headings use their own clamp() sizes) */
    --text-2xs: 0.7rem;
    --text-xs:  0.75rem;
    --text-sm:  0.8rem;
    --text-md:  0.85rem;
    --text-lg:  0.9rem;
    --text-xl:  0.95rem;
    --text-2xl: 1rem;

    --nav-height: 64px;
    --max-width:  1100px;
    --pad-x:      2rem;

    @media (max-width: 768px) {
        --pad-x: 1.5rem;
    }
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover { color: var(--color-accent-light); }

img { max-width: 100%; display: block; }

/* =============================================
   NAVIGATION (the tool's name, then links to the code and to the author's site)
   ============================================= */
.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(245, 248, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--pad-x);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.nav-logo:hover { color: var(--color-accent-light); }

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;

    @media (max-width: 768px) {
        gap: 1.25rem;
    }
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.nav-links a:hover { color: var(--color-accent-light); }
/* Narrow phones: the author's site by its logo rather than its domain */
.nav-short { display: none; }
@media (max-width: 480px) {
    .nav-long { display: none; }
    .nav-short { display: inline; }
}

/* =============================================
   LAYOUT UTILITIES
   ============================================= */
/* Read by screen readers, not shown */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--pad-x);
    position: relative;
    z-index: 1;
}

/* =============================================
   CARDS: white surface with a border (form, map, results)
   ============================================= */
.chart-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;

    /* Less padding on phones: the map needs the width */
    @media (max-width: 768px) {
        padding: 1rem;
    }
}

.chart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-bottom: 1rem;
}

/* Bold mono titles of cards */
.chart-title {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    list-style: none;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}
.chart-legend li { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }

.status-message {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    color: var(--color-text-muted);
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
    padding: calc(var(--nav-height) + 4rem) 0 3rem;
}

/* Spaced mono label in the accent color: "// prototype" */
.page-header-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.page-header-title {
    font-family: var(--font-mono);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--color-text-primary);
}

.page-header-intro {
    margin-top: 0.75rem;
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 300;
    color: var(--color-text-muted);
}

/* Main content of a page */
.page-main { padding-bottom: 5rem; }

/* =============================================
   FOOTER
   ============================================= */
.footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    position: relative;
    z-index: 1;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--pad-x);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;

    @media (max-width: 768px) {
        flex-direction: column;
        text-align: center;
    }
}

.footer-text {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.footer-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-text a:hover { color: var(--color-accent); }
