/* ==========================================================================
   DBES site base — shared primitives for the portal landing page and the
   Designs / Demos showcase pages. Keep this in sync with any layout that
   links it; portal-only visuals (notify band, globe footer) live in
   portal.css instead.
   ========================================================================== */

/* Light is the default. Dark applies when the user picks it (data-theme="dark")
   or when the OS prefers dark AND the user hasn't explicitly picked light. */
:root {
    color-scheme: light;
    --bg: #f8fafc; --card: #ffffff; --ink: #0f172a; --muted: #64748b;
    --border: #e2e8f0; --ring: rgba(99, 102, 241, .35);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0b1120; --card: #111827; --ink: #e5e7eb; --muted: #94a3b8;
        --border: #1f2937; --ring: rgba(99, 102, 241, .45);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120; --card: #111827; --ink: #e5e7eb; --muted: #94a3b8;
    --border: #1f2937; --ring: rgba(99, 102, 241, .45);
}

* { box-sizing: border-box; }

body {
    margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Full-width bands (hero / header / footer) span edge-to-edge; each has an
   "-inner" wrapper that re-applies the page's 72rem reading column so
   text/content stay comfortably centered. */
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

.site-hero { position: relative; z-index: 1; }
.hero-inner { max-width: 72rem; margin: 0 auto; padding: 3.5rem 1.5rem; position: relative; }

.site-header-band { position: relative; z-index: 1; }
.header-inner { max-width: 72rem; margin: 0 auto; padding: 2.5rem 1.5rem 0; }
h1.section-title { font-size: clamp(1.4rem, 3vw, 1.75rem); margin: 0 0 .35rem; letter-spacing: -0.02em; }
.header-inner p { color: var(--muted); font-size: 1.02rem; margin: 0; max-width: 40rem; }

.grid {
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    margin-top: 2rem;
}
.card {
    position: relative; display: flex; flex-direction: column; gap: .75rem;
    background: var(--card); border: 1px solid var(--border);
    border-radius: 1.25rem; padding: 1.5rem; text-decoration: none; color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px -12px var(--ring); border-color: var(--accent); }
.card > * { position: relative; z-index: 1; }
.badge {
    width: 2.75rem; height: 2.75rem; border-radius: .75rem; display: grid; place-items: center;
    font-weight: 700; font-size: 1.1rem; color: #fff; letter-spacing: -0.03em;
}
.card h2 { font-size: 1.15rem; margin: 0; }
.card .tag { color: var(--accent); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card p { color: var(--muted); font-size: .92rem; margin: 0; line-height: 1.5; }
.go { margin-top: auto; color: var(--accent); font-weight: 600; font-size: .9rem; }
.empty { color: var(--muted); }

/* Lock badge on gated app cards. */
.card .lock-pill {
    position: absolute; top: 1rem; right: 1rem; z-index: 2;
    display: inline-flex; align-items: center; gap: .3rem;
    background: rgba(15, 23, 42, .06); color: var(--muted);
    border-radius: 999px; padding: .25rem .55rem; font-size: .72rem; font-weight: 700;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card .lock-pill { background: rgba(255, 255, 255, .08); } }
:root[data-theme="dark"] .card .lock-pill { background: rgba(255, 255, 255, .08); }

/* ── Theme toggle button (portal + showcase auth bars) ────────────────── */
.theme-toggle {
    display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem;
    border-radius: .5rem; border: 1px solid var(--border); background: transparent;
    color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}

footer.site.full-width { border-top: 1px solid var(--border); margin-top: 4rem; position: relative; z-index: 1; }
.footer-inner {
    max-width: 72rem; margin: 0 auto; padding: 1.5rem;
    display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem;
}
.footer-inner img { width: 1.3rem; height: 1.3rem; border-radius: 50%; }

/* ── Side utility rail (theme toggle + log in / register) ─────────────── */
.auth-bar {
    position: fixed; top: 50%; right: 0; transform: translateY(-50%);
    z-index: 40; display: flex; flex-direction: column; align-items: stretch;
    gap: .4rem; margin: 0; padding: .5rem; font-size: .8rem;
    background: var(--card); border: 1px solid var(--border); border-right: 0;
    border-radius: .8rem 0 0 .8rem; box-shadow: 0 10px 34px -14px var(--ring);
}
.auth-bar .greeting { color: var(--muted); text-align: center; max-width: 8rem; line-height: 1.3; }
.auth-bar form { margin: 0; }
.auth-bar .theme-toggle { align-self: center; }
.auth-bar a, .auth-bar button:not(.theme-toggle) {
    font: inherit; text-decoration: none; cursor: pointer; border-radius: .5rem;
    padding: .5rem .8rem; font-weight: 600; text-align: center; white-space: nowrap; width: 100%;
}
.auth-bar a.ghost { color: var(--ink); border: 1px solid var(--border); background: transparent; }
.auth-bar a.solid, .auth-bar button.solid { color: #fff; background: #6366f1; border: 1px solid #6366f1; }
.auth-bar button.ghost { color: var(--muted); border: 1px solid var(--border); background: transparent; }

@media (max-width: 720px) {
    .auth-bar {
        top: auto; bottom: 0; transform: none;
        flex-direction: row; align-items: center; border-radius: .8rem 0 0 0;
    }
    .auth-bar .greeting { display: none; }
    .auth-bar a, .auth-bar button:not(.theme-toggle) { width: auto; }
}

/* ── Login-required modal ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 50;
    display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
    position: relative;
    background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem;
    padding: 1.75rem; width: min(24rem, 100%); text-align: left;
}
.modal-card h3 { margin: 0 0 .5rem; font-size: 1.1rem; }
.modal-card p { margin: 0 0 1.25rem; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.modal-actions { display: flex; gap: .6rem; }
.modal-actions a { flex: 1; text-align: center; padding: .65rem; border-radius: .6rem; font-weight: 700; font-size: .9rem; text-decoration: none; }
.modal-actions a.solid { background: #6366f1; color: #fff; }
.modal-actions a.ghost { border: 1px solid var(--border); color: var(--ink); }
.modal-close { position: absolute; top: 1rem; right: 1.25rem; background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }

/* ── Shared marketing-site nav ────────────────────────────────────────── */
.site-nav { position: relative; z-index: 3; border-bottom: 1px solid var(--border); background: var(--bg); }
.site-nav__inner {
    max-width: 72rem; margin: 0 auto; padding: .65rem 1.5rem;
    display: flex; align-items: center; gap: 1.25rem;
}
.site-nav__logo { display: inline-flex; flex: 0 0 auto; }
.site-nav__logo img { width: 3rem; height: 3rem; border-radius: 50%; display: block; }
.site-nav__links { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.site-nav__links > a,
.site-nav__has-dropdown > a {
    font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--muted);
    padding: .45rem .7rem; border-radius: .5rem; display: inline-flex; align-items: center; gap: .3rem;
}
.site-nav__links > a:hover,
.site-nav__has-dropdown > a:hover { color: var(--ink); }
.site-nav__links a.is-active { color: var(--ink); background: var(--card); border: 1px solid var(--border); }
.site-nav__item { position: relative; }
.site-nav__caret { font-size: .7rem; }
.site-nav__dropdown {
    position: absolute; top: 100%; right: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: .75rem;
    padding: .4rem; display: none; gap: .05rem .25rem;
    grid-template-columns: repeat(3, minmax(9.5rem, 1fr));
    box-shadow: 0 16px 40px -18px var(--ring); z-index: 10;
}
.site-nav__has-dropdown:hover .site-nav__dropdown,
.site-nav__has-dropdown:focus-within .site-nav__dropdown,
.site-nav__has-dropdown.is-open .site-nav__dropdown { display: grid; }
.site-nav__dropdown a {
    text-decoration: none; color: var(--ink); font-size: .88rem; font-weight: 500;
    padding: .5rem .65rem; border-radius: .5rem;
}
.site-nav__dropdown a:hover { background: var(--bg); }
.site-nav__toggle {
    display: none; margin-left: auto; flex-direction: column; gap: .28rem;
    background: none; border: 1px solid var(--border); border-radius: .5rem;
    padding: .5rem .55rem; cursor: pointer;
}
.site-nav__toggle span:not(.site-nav__sr) { width: 1.1rem; height: 2px; background: var(--ink); display: block; }
.site-nav__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 720px) {
    .site-nav__toggle { display: flex; }
    .site-nav__links {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: .15rem;
        background: var(--bg); border-bottom: 1px solid var(--border);
        padding: .6rem 1.5rem 1rem; margin-left: 0;
    }
    .site-nav__links.is-open { display: flex; }
    .site-nav__has-dropdown { display: flex; flex-direction: column; }
    .site-nav__dropdown {
        position: static; right: auto; box-shadow: none; margin: .1rem 0 .3rem .7rem;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Centralised logo-only header (non-marketing views) ───────────────── */
.site-logo-only { text-align: center; padding: 1.25rem 1rem .25rem; }
.site-logo-mark { width: 3.5rem; height: 3.5rem; border-radius: 50%; display: inline-block; }

/* ── Shared footer extras ────────────────────────────────────────────── */
.footer-inner.site-footer { flex-direction: column; align-items: flex-start; gap: 1rem; }
.site-footer__brand { display: flex; gap: .75rem; align-items: flex-start; }
.site-footer__brand img { width: 2rem; height: 2rem; border-radius: 50%; flex: 0 0 auto; }
.site-footer__desc { margin: 0; max-width: 46rem; line-height: 1.6; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.site-footer__links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.site-footer__links a:hover { color: var(--ink); }
.site-footer__legal { margin: 0; }

/* ── About page ──────────────────────────────────────────────────────── */
.about-body { max-width: 46rem; }
.about-body section { margin-top: 2rem; }
.about-body h2 { font-size: 1.2rem; margin: 0 0 .6rem; letter-spacing: -0.01em; }
.about-body p { color: var(--ink); line-height: 1.7; margin: 0 0 .9rem; }
.about-body a { color: #6366f1; text-decoration: none; font-weight: 600; }
.about-body a:hover { text-decoration: underline; }
