/**
 * DeSent — shared branding stylesheet (header, footer, brand lockup,
 * form fields, theme toggle, pixel-font @font-faces).
 *
 * Linked by every page AFTER tokens.css (public pages) so it can layer
 * on top of the token palette. On admin.php it layers over that page's
 * own red-tinted :root tokens instead — every rule below reads only the
 * common token names (--bg/--card/--border/--accent/--text/--muted),
 * with safe fallbacks for surfaces that don't define the rarer ones.
 *
 * The @font-face rules moved here from main.css (2026-08-20) so the
 * wordmark font renders on every page, not just the landing.
 *
 * Cache note: served from the week-cached /assets/ location — bump the
 * ?v=brandN query on every page link when this file changes.
 */

/* ===== Self-hosted pixel fonts (OFL, latin subset only) =====
   Fetched from Google Fonts; served from /assets/fonts/ so the CSP stays
   tight (font-src 'self') with no third-party CDN. */
@font-face {
    font-family: 'Press Start 2P';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(/static/assets/fonts/pressstart2p-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                   U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(/static/assets/fonts/silkscreen-400-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                   U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url(/static/assets/fonts/silkscreen-700-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                   U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Brand mark (partials/ds-mark.php) =====
   Fill follows currentColor, so one glyph recolors per surface. */
.brand-mark {
    display: block;
    width: 28px;
    height: 28px;
    color: var(--accent);
    flex-shrink: 0;
}
.brand-mark-sm { width: 18px; height: 18px; }

/* ===== Site header ===== */
/* Owns the site-wide gap between the header bar and the page content.
   Pages no longer pad their own top — they zero it out so the
   spacing comes from exactly one place. The admin panel opts out (its
   tab bar hugs the header; it pads its own page-body instead) and
   inbox app-mode opts out to keep the dense app viewport.
   No border-bottom: the hairline under the header was removed site-wide
   (2026-08-25) — the gap alone separates header from content. */
.site-header {
    background: var(--bg);
    margin-bottom: var(--header-gap, 16px);
}
.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.brand-name {
    font-family: 'Press Start 2P', var(--font-mono, monospace);
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: 1px;
    color: var(--accent);
}
/* Stacked brand text (mark left, name over tagline) — same pattern as
   directory.desent.xyz. The sub is the property tagline. */
.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.brand-sub {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 3px;
    font-weight: 600;
    text-transform: uppercase;
}
.site-nav {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}
.site-nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
}
.site-nav-link:hover { color: var(--accent); }

/* ===== Site footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 48px;
}
.site-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 22px 20px;
}
.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}
.footer-copy {
    font-size: 12px;
    color: var(--muted);
}
.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.footer-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
}
.footer-link:hover { color: var(--accent); }
/* Analytics transparency note (docs/ANALYTICS.md) — one muted line. */
.footer-privacy {
    margin: 10px 0 0;
    font-size: 11.5px;
    color: var(--muted);
}

/* ===== Form fields (shared, branded) =====
   Square corners per the design tokens (--radius: 0), --card fill,
   accent border + soft ring on focus. Pages add .field to inputs and
   .field-label to their labels. */
.field {
    display: block;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: var(--radius, 0);
    font-size: 13px;
    font-family: inherit;
    transition: border-color var(--transition, .15s ease),
                box-shadow var(--transition, .15s ease);
}
.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft, transparent);
}
.field::placeholder { color: var(--muted); opacity: .65; }
.field-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
    margin: 12px 0 4px;
}

/* ===== Theme toggle (base look — pages may restyle on top) ===== */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius, 0);
    color: var(--muted);
    cursor: pointer;
    transition: color var(--transition, .15s ease),
                border-color var(--transition, .15s ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.theme-toggle svg { display: block; }

/* ===== Phones: tighten the header/footer gutters ===== */
@media (max-width: 640px) {
    .site-header { margin-bottom: 12px; }
    .site-header-inner { padding: 12px 16px; }
    .site-footer-inner { padding: 18px 16px; }
    .footer-row { flex-direction: column; align-items: flex-start; }
    .brand-name { font-size: 10px; }
    .brand-sub { font-size: 8.5px; letter-spacing: 1.5px; }
}

/* ===== Waitlist dialog (shared; markup injected by assets/js/waitlist.js,
   opened from any [data-wl-open] control). Scoped under #wlModal so pages
   with their own inline .waitlist forms (e.g. register) are unaffected.
   margin:auto re-centers the modal: universal resets (*{margin:0}) override
   the UA stylesheet's dialog{margin:auto} centering, pinning it top-left. */
#wlModal {
    border: 1px solid var(--border-strong);
    background: var(--card);
    color: var(--text);
    padding: 0;
    max-width: 430px;
    width: calc(100% - 40px);
    margin: auto;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}
#wlModal::backdrop { background: rgba(0, 0, 0, 0.6); }
.wl-card { padding: 24px; }
#wlModal form.waitlist { display: flex; flex-direction: column; gap: 8px; }
.wl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wl-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; }
.wl-close {
    background: none; border: none; color: var(--muted);
    font-size: 22px; line-height: 1; cursor: pointer;
    padding: 2px 6px; font-family: inherit;
}
.wl-close:hover { color: var(--text); }
.wl-sub { color: var(--muted); font-size: 13px; margin: 8px 0 16px; }
.wl-toggle { display: flex; border: 1px solid var(--border); }
.wl-opt {
    flex: 1; background: var(--bg); border: none; color: var(--muted);
    padding: 10px 12px; font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.wl-opt + .wl-opt { border-left: 1px solid var(--border); }
.wl-opt.active { background: var(--accent-soft); color: var(--accent); }
.wl-field {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 11px 13px; font-size: 14px; font-family: inherit;
}
.wl-field:focus { outline: none; border-color: var(--accent); }
.wl-field::placeholder { color: var(--muted); }
.wl-lbl { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }
select.wl-field { cursor: pointer; }
.wl-ext-msg { font-size: 12px; color: var(--muted); min-height: 0; word-break: break-all; }
.wl-ext-msg.ok { color: var(--success); }
#wlModal .msg { font-size: 13px; min-height: 18px; }
#wlModal .msg.ok { color: var(--success); }
#wlModal .msg.err { color: var(--error); }
#wlModal .btn.ghost { background: var(--hover); color: var(--text); border: 1px solid var(--hover); }
