/* ========================================
   EC&S Design System
   ======================================== */

/* ========================================
   Font Faces
   ======================================== */

/* IBM Plex Sans */
@font-face {
    font-family: 'IBM Plex Sans';
    src: url('/static/fonts/IBMPlexSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('/static/fonts/IBMPlexSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans';
    src: url('/static/fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Berkeley Mono */
@font-face {
    font-family: 'Berkeley Mono';
    src: url('/static/fonts/TX-02-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Berkeley Mono';
    src: url('/static/fonts/TX-02-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Berkeley Mono';
    src: url('/static/fonts/TX-02-Oblique.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Berkeley Mono';
    src: url('/static/fonts/TX-02-Bold-Oblique.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

/* --- Color Palette (from Design Bible) --- */
:root {
    --color-harbor: #236192;
    --color-ice: #DFE6EB;
    --color-mist: #DAE1E2;
    --color-slate: #587489;
    --color-void: #2D036E;
    /* Fathom -- the eighth colour, Pantone 7546 C. Resolves §3's undefined
       "Graphite": the deep end, where A1's RF floor sits. */
    --color-fathom: #253746;
    --color-paper: #FCFDFE;
    --color-ink: #111111;
}

/* --- Heritage — the 29-block rainbow --- */
/*
 * Bible §3: un-retired as "Heritage", a hero/masthead motif. It is NOT the top
 * bar -- that is A1, the Spectral Standard, generated into brand.css. Never two
 * stripe forms on one surface.
 *
 * This sequence is the record of itself: §3 cites these exact lines as the
 * "sequence of record". It is drawn, not derived, and that is fine -- Heritage
 * is bright visible light and makes no physical claim.
 */
.masthead--heritage {
    display: flex;
    width: 100%;
    height: 8px;
}

.masthead--heritage .block {
    flex: 1;
    height: 100%;
}

.masthead--heritage .block:nth-child(1)  { background: #8B0000; }
.masthead--heritage .block:nth-child(2)  { background: #9A0000; }
.masthead--heritage .block:nth-child(3)  { background: #B00000; }
.masthead--heritage .block:nth-child(4)  { background: #D00000; }
.masthead--heritage .block:nth-child(5)  { background: #F00000; }
.masthead--heritage .block:nth-child(6)  { background: #FF2000; }
.masthead--heritage .block:nth-child(7)  { background: #FF4000; }
.masthead--heritage .block:nth-child(8)  { background: #FF6000; }
.masthead--heritage .block:nth-child(9)  { background: #FF8400; }
.masthead--heritage .block:nth-child(10) { background: #FFA000; }
.masthead--heritage .block:nth-child(11) { background: #FFB500; }
.masthead--heritage .block:nth-child(12) { background: #FFD000; }
.masthead--heritage .block:nth-child(13) { background: #FFE800; }
.masthead--heritage .block:nth-child(14) { background: #FFFF00; }
.masthead--heritage .block:nth-child(15) { background: #CFFF00; }
.masthead--heritage .block:nth-child(16) { background: #8FFF00; }
.masthead--heritage .block:nth-child(17) { background: #4FFF00; }
.masthead--heritage .block:nth-child(18) { background: #00FF00; }
.masthead--heritage .block:nth-child(19) { background: #00FF60; }
.masthead--heritage .block:nth-child(20) { background: #00FFB0; }
.masthead--heritage .block:nth-child(21) { background: #00FFFF; }
.masthead--heritage .block:nth-child(22) { background: #00CFFF; }
.masthead--heritage .block:nth-child(23) { background: #008FFF; }
.masthead--heritage .block:nth-child(24) { background: #004FFF; }
.masthead--heritage .block:nth-child(25) { background: #0000FF; }
.masthead--heritage .block:nth-child(26) { background: #3000FF; }
.masthead--heritage .block:nth-child(27) { background: #7000FF; }
.masthead--heritage .block:nth-child(28) { background: #9800FF; }
.masthead--heritage .block:nth-child(29) { background: #4800AA; }

/* --- Typography Scale --- */
:root {
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Berkeley Mono', ui-monospace, 'Consolas', monospace;
    
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.5rem;
}

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

/* --- Base --- */
html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-paper);
    color: var(--color-ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 600;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }

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

a:hover {
    text-decoration: underline;
}

code, pre {
    font-family: var(--font-mono);
    background-color: var(--color-mist);
    border-radius: 3px;
}

code {
    padding: 0.125em 0.25em;
    font-size: var(--text-sm);
}

/* --- Layout --- */
header {
    padding: 1rem 2rem;
    /* §7: the header carries a 2px Void divider, and §7's structure rule is
       "2px Void rule for primary divisions, 1px Mist hairline" for secondary.
       Header-to-content is a primary division; this was a 1px Mist hairline,
       which is the secondary weight doing a primary job. */
    border-bottom: 2px solid var(--color-void);
}

header nav a {
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--color-harbor);
}

header nav a:hover {
    color: var(--color-void);
    text-decoration: none;
}

main {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 64rem;
    width: 100%;
    margin: 0 auto;
}

footer {
    padding: 2rem;
    border-top: 1px solid var(--color-mist);
    color: var(--color-slate);
    font-size: var(--text-sm);
    text-align: center;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 2rem 0 3rem;
}

.hero h1 {
    margin-bottom: 0.25rem;
}

.hero .location {
    font-size: var(--text-sm);
    color: var(--color-slate);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.hero .tagline {
    font-size: var(--text-lg);
    color: var(--color-slate);
}

/* --- Main Navigation --- */
.main-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 0;
}

.main-nav a {
    font-size: var(--text-lg);
    color: var(--color-ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.main-nav a:hover {
    color: var(--color-void);
}

.nav-divider {
    width: 3rem;
    height: 1px;
    background: var(--color-mist);
    margin: 0.5rem 0;
}

/* --- Header Nav --- */
header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wordmark {
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--color-harbor);
}

.wordmark:hover {
    color: var(--color-void);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-size: var(--text-sm);
    color: var(--color-slate);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links a:hover {
    color: var(--color-void);
    text-decoration: none;
}

/* --- Page Styles --- */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-header .subtitle {
    color: var(--color-slate);
    font-size: var(--text-lg);
}

.page-content {
    line-height: 1.7;
}

.page-content .notice {
    color: var(--color-slate);
    font-style: italic;
}

.page-content .status-ok {
    color: #1a7f37;
    font-weight: 500;
}

/* Prose inside a page. Heading hierarchy stays H1 -> H2 -> H3 (§10); these are
   the H2s under a page's single H1. */
.page-content h2 {
    font-size: var(--text-xl);
    margin: 2.25rem 0 0.6rem;
}

.page-content p {
    margin-bottom: 1rem;
    max-width: 42rem;
}

.page-content ul {
    margin: 0 0 1rem 1.25rem;
    max-width: 42rem;
}

.page-content li {
    margin-bottom: 0.4rem;
}

/* A closing line of links or provenance. Slate, and set apart. */
.page-content .meta {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-mist);
    color: var(--color-slate);
    font-size: var(--text-sm);
}

/* --- Footer --- */
/* The seal sits above the copyright, understated (§7). currentColor so it
   inherits the footer's Slate rather than carrying its own. */
/* One partial, sized and coloured per context. The footer wants it understated
   in Slate; the hero wants it as the mark, in Harbor. */
footer svg {
    display: block;
    margin: 0 auto 0.75rem;
    color: var(--color-slate);
}

.hero svg {
    display: block;
    width: 88px;
    height: 88px;
    margin: 0 auto 1.5rem;
    color: var(--color-harbor);
}

/* ========================================
   Responsive
   ========================================

   The site had no media queries at all. On a phone the header is a flex row
   holding the wordmark plus five nav links, which cannot fit -- so it overflowed
   horizontally, the whole page scrolled sideways, and the top bar looked like it
   stopped short of the edge because it was 100% of the viewport while the
   content was wider than one.
   ======================================== */

/* Nothing may push the page wider than the viewport. The bar is full-bleed and
   any overflow shows up as white beyond its right edge. */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

@media (max-width: 48rem) {
    header {
        padding: 0.85rem 1.25rem;
    }

    /* Stack rather than squeeze: five links and a wordmark do not fit on one
       phone-width row, and shrinking them to fit costs legibility. */
    header nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .wordmark {
        padding-bottom: 0.6rem;
    }

    /* Separated, because stacked without one the wordmark reads as the first
       nav item rather than as the mark. 1px Mist -- §7's secondary weight, for
       a division inside the header rather than at its edge. */
    .nav-links {
        flex-wrap: wrap;
        gap: 0.5rem 1.25rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--color-mist);
    }

    main {
        padding: 2rem 1.25rem 2.5rem;
    }

    /* The display sizes are set for a desktop measure. At 390px a 4xl heading
       is most of the screen. */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.15rem; }

    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-content h2 {
        margin: 1.75rem 0 0.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero svg {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }

    .main-nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-divider {
        display: none;
    }

    footer {
        padding: 1.5rem 1.25rem;
    }
}

/* Narrow phones: the wordmark and the first nav link were touching, because
   space-between had nothing to distribute. */
@media (max-width: 26rem) {
    .nav-links {
        gap: 0.4rem 0.9rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }
}

/* ========================================
   The product domain's front door

   essexcompute.com, served by the same binary via Host routing. One screen,
   two actions: sign in, or read what this is. The detail lives on
   /compute so there is one copy of it.
   ======================================== */

main.apex {
    max-width: 34rem;
    margin: 0 auto;
    padding: 5rem 1.5rem;
}

main.apex h1 {
    font-family: 'Berkeley Mono', ui-monospace, monospace;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-void);
    margin: 0;
}

.apex-lede {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--color-ink);
    margin: 1rem 0 2rem;
}

.apex-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin: 0 0 3rem;
}

.apex-actions .button {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: var(--color-void);
    color: var(--color-paper);
    text-decoration: none;
    font-weight: 600;
}
.apex-actions .button:hover { background: var(--color-harbor); }
.apex-actions a:not(.button) { color: var(--color-harbor); }

.apex-meta {
    /* The one rule on the page, and the same 1px Mist §7 uses for a secondary
       division everywhere else. */
    border-top: 1px solid var(--color-mist);
    padding-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-slate);
}
.apex-meta a { color: var(--color-slate); }

@media (max-width: 30rem) {
    main.apex { padding: 3rem 1rem; }
}

/* ========================================
   /status

   Three states, and the middle one is the reason this page exists: the old
   page could only ever say "operational". See src/status.rs.
   ======================================== */

.status-ok      { font-weight: 600; color: var(--color-harbor); }
.status-problem { font-weight: 600; color: var(--color-void); }

.status-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.status-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-mist);
    vertical-align: baseline;
}
.status-table td:last-child { color: var(--color-slate); }

/* The estate's own vocabulary: = correct, ! needs a human. Colour is a second
   channel here, never the only one -- the glyph carries it alone. */
.status-table .mark {
    font-family: 'Berkeley Mono', ui-monospace, monospace;
    font-weight: 600;
    width: 2rem;
    text-align: center;
}
