/* ===========================================================================
   Platform stylesheet — deliberately unbranded.

   Everything visual is a custom property in the :root block below. To rebrand,
   change those values; you should not need to touch anything further down.

   The palette is neutral greys plus a single accent, defined for both light
   and dark. Dark mode follows the OS via prefers-color-scheme.
   =========================================================================== */

:root {
    /* --- Brand: change these ------------------------------------------- */
    --accent:            #2f6feb;
    --accent-hover:      #1d4fbd;
    --accent-contrast:   #ffffff;

    /* Neutrals */
    --bg:                #ffffff;
    --bg-soft:           #f7f7f8;
    --bg-raised:         #ffffff;
    --ink:               #17181c;
    --ink-soft:          #3b3d45;
    --ink-muted:         #6f727d;
    --rule:              #e4e5e9;
    --rule-strong:       #cfd1d7;

    /* Status */
    --ok:                #15803d;
    --warn:              #b45309;
    --danger:            #b91c1c;

    /* --- Type ----------------------------------------------------------- */
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                 "Liberation Mono", monospace;

    /* --- Metrics -------------------------------------------------------- */
    --shell-max: 1080px;
    --gutter: 1.5rem;
    --header-h: 60px;
    --radius: 10px;
    --radius-sm: 6px;

    --shadow-sm: 0 1px 2px rgba(16, 18, 22, 0.06);
    --shadow-md: 0 4px 16px rgba(16, 18, 22, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent:          #6b9bff;
        --accent-hover:    #8db2ff;
        --accent-contrast: #0d1117;

        --bg:              #0e1014;
        --bg-soft:         #16191f;
        --bg-raised:       #191d24;
        --ink:             #f0f1f4;
        --ink-soft:        #c8cad2;
        --ink-muted:       #8b8f9b;
        --rule:            #262a33;
        --rule-strong:     #363b47;

        --ok:              #4ade80;
        --warn:            #fbbf24;
        --danger:          #f87171;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink-soft);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

h1, h2, h3, h4 {
    color: var(--ink);
    margin: 0 0 0.5em;
    line-height: 1.2;
    letter-spacing: -0.011em;
    font-weight: 600;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1em; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

code, pre { font-family: var(--font-mono); font-size: 0.875em; }

.muted { color: var(--ink-muted); }

.eyebrow {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
}

/* --- Layout ------------------------------------------------------------- */

.shell {
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

main { flex: 1 0 auto; }

.section {
    padding: 2.5rem 0;
}
.section + .section { border-top: 1px solid var(--rule); }
.section.soft { background: var(--bg-soft); }

.page-head {
    padding: 2.5rem 0 1.75rem;
    border-bottom: 1px solid var(--rule);
}
.page-head h1 { margin-bottom: 0.35rem; }
.page-head p { color: var(--ink-muted); margin: 0; }

/* --- Header / footer ---------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(150%) blur(10px);
    border-bottom: 1px solid var(--rule);
}
.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--header-h);
}

/* Wordmark. A CSS square stands in for a logo — replace the .mark rule (or
   swap the whole anchor for an <img>) when there is real artwork. */
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.site-brand:hover { color: var(--ink); text-decoration: none; }
.site-brand .mark {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    flex: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.875rem;
}
.site-nav a { color: var(--ink-soft); font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.site-nav .who { color: var(--ink-muted); font-size: 0.8125rem; }

.logout-form { display: inline; margin: 0; }
.logout-form button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
}
.logout-form button:hover { color: var(--accent); }

.site-footer {
    flex: none;
    border-top: 1px solid var(--rule);
    padding: 1.25rem 0;
    color: var(--ink-muted);
    font-size: 0.8125rem;
}

/* --- Buttons ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-contrast);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease,
                color 120ms ease;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-contrast); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--rule-strong);
}
.btn-secondary:hover {
    background: var(--bg-soft);
    color: var(--ink);
    border-color: var(--ink-muted);
}

.btn-block { width: 100%; }

/* --- Cards / grid ------------------------------------------------------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    height: 100%;
    padding: 1.25rem;
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 140ms ease, box-shadow 140ms ease,
                transform 140ms ease;
}
.card h3 { margin: 0; font-size: 1.0625rem; }
.card p { margin: 0; font-size: 0.9rem; color: var(--ink-muted); flex: 1 1 auto; }

a.card-link { color: inherit; display: block; height: 100%; }
a.card-link:hover { text-decoration: none; }
a.card-link:hover .card {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
a.card-link:hover .card h3 { color: var(--accent); }

.card .go {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
}
.card .go::after { content: " →"; }

.card.is-restricted { background: var(--bg-soft); box-shadow: none; }

.empty {
    margin-top: 1rem;
    padding: 1.75rem;
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius);
    color: var(--ink-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* --- Auth pages --------------------------------------------------------- */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem var(--gutter);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--bg-raised);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.auth-card h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.auth-card-head { margin-bottom: 1.5rem; }
.auth-card-head p { color: var(--ink-muted); font-size: 0.9rem; margin: 0; }

.auth-field { margin-bottom: 1rem; }
.auth-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
}
.auth-field input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
}
.auth-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.auth-help-text {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
}
.auth-field-error,
.auth-error {
    margin-top: 0.4rem;
    font-size: 0.8125rem;
    color: var(--danger);
}
.auth-error {
    margin: 0 0 1rem;
    padding: 0.65rem 0.8rem;
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-radius: var(--radius-sm);
}
.auth-error p { margin: 0; }

.auth-submit { margin-top: 0.5rem; }
.auth-foot {
    margin-top: 1.25rem;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    text-align: center;
}

/* --- Utilities ---------------------------------------------------------- */

.stack > * + * { margin-top: 1rem; }

@media (max-width: 640px) {
    :root { --gutter: 1rem; }
    h1 { font-size: 1.6rem; }
    .site-nav { gap: 0.9rem; font-size: 0.8125rem; }
    .site-nav .who { display: none; }
}
