/* ============================================================================
   Server-rendered pages: sign-in and account flows, the legal documents, and
   the placeholder front door. Everything else lives in the React app under
   /app (docs/publisher-build-plan.md). Tokens come from theme.css + ds-bridge.css,
   loaded before this file; the rules below were lifted verbatim from the
   retired app.css so these pages look exactly as they did.
   ============================================================================ */

body {
    margin: 0;
    font-family: 'Google Sans', system-ui, sans-serif;
    color: var(--on-surface);
    background: var(--background);
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--outline-variant);
}

.site-brand {
    font-weight: 500;
    letter-spacing: -0.025em;
    color: var(--on-surface);
    text-decoration: none;
}

.site-main {
    flex: 1;
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    box-sizing: border-box;
}

.site-placeholder h1 {
    font-weight: 500;
    letter-spacing: -0.025em;
    margin: 2rem 0 0.5rem;
}

.site-placeholder p {
    color: var(--on-surface-variant);
}

.app-sidebar-legal {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
}

.app-sidebar-legal a {
    color: inherit;
}

/* ── M3 text field (filled) — shared by login + filter inputs ── */

.md-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.md-field > span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--on-surface-variant);
}

.md-field input,
input.md-input {
    width: 100%;
    height: 3rem;
    padding: 0 0.9rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--on-surface);
    background: var(--surface-container-highest);
    border: none;
    border-bottom: 1px solid var(--on-surface-variant);
    border-radius: var(--md-shape-corner-extra-small) var(--md-shape-corner-extra-small) 0 0;
    transition: border-color 0.15s, background 0.15s;
}

.md-field input:focus,
input.md-input:focus {
    outline: none;
    border-bottom: 2px solid var(--primary);
    background: var(--surface-container-high);
}

/* Locked field — readonly input where the value is fixed (e.g. signup email
   pre-filled from an accepted invitation). Mutes the input and suppresses
   the focus underline so it doesn't read as editable. */
.md-field-locked input,
.md-field-locked input:focus {
    color: var(--on-surface-variant);
    cursor: not-allowed;
    border-bottom: 1px solid var(--on-surface-variant);
    background: var(--surface-container-highest);
}

/* ── M3 filled button — shared ── */

.md-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--md-shape-corner-full);
    background: var(--primary);
    color: var(--on-primary);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-sizing: border-box;
    transition: box-shadow 0.15s, background 0.15s;
}

.md-button:hover {
    box-shadow: var(--md-elevation-1);
    background: color-mix(in srgb, var(--on-primary) 8%, var(--primary));
}

.md-button:active {
    box-shadow: none;
}

/* ── Login ── */

.login-page {
    display: flex;
    /* Column so the legal link stacks under the card. With the card alone this
       centres identically to the row it replaced — both axes still centred. */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    /* --surface-container-low maps to --background, which the bridge leaves to
       theme.css (no cycle-free design-system source for it). The app shell hides
       that behind the sidebar + main pane, but the auth page shows it full-bleed,
       where theme.css's near-black clashes with the Currents indigo-navy card.
       --sidebar is the design system's own chrome tone and sits correctly behind
       a card in both themes. */
    background: var(--sidebar);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--md-shape-corner-large);
    box-shadow: var(--md-elevation-1);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.login-brand .brand-mark {
    width: 30px;
    height: 30px;
    color: var(--primary);
    flex: none;
    /* Beer CSS sets a global `svg { fill: currentColor }`, and CSS always beats
       the fill="none"/stroke="currentColor" presentation attributes on the mark,
       so the arcs have to be restated here or the C renders as a filled blob. */
    fill: none;
    stroke: currentColor;
}

.login-brand span {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--on-surface);
}

.login-sub {
    margin: 0.25rem 0 1.5rem;
    color: var(--on-surface-variant);
    font-size: 0.9rem;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--error-container);
    color: var(--on-error-container);
    border-radius: var(--md-shape-corner-small);
    font-size: 0.875rem;
}

.login-error .material-symbols-outlined {
    font-size: 20px;
}

.login-message {
    margin: 0;
    color: var(--on-surface-variant);
    font-size: 0.95rem;
    line-height: 1.5;
}

.login-message a {
    color: var(--primary);
    text-decoration: none;
}

.login-message a:hover {
    text-decoration: underline;
}

.login-card form {
    display: flex;
    flex-direction: column;
}

.login-card .md-button {
    width: 100%;
    height: 2.75rem;
    margin-top: 0.5rem;
}

/* Sits under the card, on the page background rather than inside the card —
   the terms are about the product, not a field of the form. Capped to the
   card's width so the consent sentence wraps under it rather than past it. */
.login-legal {
    max-width: 400px;
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
}

/* Underlined at rest: inside a sentence in the same colour, the underline is
   the only thing marking these as links. */
.login-legal a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.login-legal a:hover { color: var(--on-surface); }

/* ── Legal pages ────────────────────────────────────────────────────────────
   A reading surface inside the app shell: one measured column, nothing else.
   The shell supplies the chrome, the tokens and the theme. */
.legal-doc {
    max-width: 44rem;
    margin: 0 auto;
    color: var(--on-surface);
    font-size: 0.95rem;
    line-height: 1.65;
}

.legal-doc h1 {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.legal-doc h2 {
    margin: 2.5rem 0 0.75rem;
    font-size: 1.2rem;
    font-weight: 650;
}

.legal-doc h3 {
    margin: 1.75rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--on-surface-variant);
}

.legal-doc p { margin: 0 0 0.9rem; }

.legal-doc ul {
    margin: 0 0 0.9rem;
    padding-left: 1.2rem;
    list-style: disc;
}

.legal-doc li { margin-bottom: 0.35rem; }

.legal-doc a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

/* Definition list as a two-column key/value block for the document header. */
.legal-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0 0 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--outline-variant);
    font-size: 0.88rem;
}

.legal-meta dt {
    color: var(--on-surface-variant);
    font-weight: 500;
}

.legal-meta dd { margin: 0; }

.legal-address { margin-left: 1.2rem; }

.legal-back {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--outline-variant);
}
