
:root {
    color-scheme: dark;

    /* Catppuccin Mocha */
    --rosewater: #f5e0dc;
    --flamingo: #f2cdcd;
    --pink: #f5c2e7;
    --mauve: #cba6f7;
    --red: #f38ba8;
    --maroon: #eba0ac;
    --peach: #fab387;
    --yellow: #f9e2af;
    --green: #a6e3a1;
    --teal: #94e2d5;
    --sky: #89dceb;
    --sapphire: #74c7ec;
    --blue: #89b4fa;
    --lavender: #b4befe;

    --text: #cdd6f4;
    --subtext1: #bac2de;
    --subtext0: #a6adc8;
    --overlay2: #9399b2;
    --overlay1: #7f849c;
    --overlay0: #6c7086;

    --surface2: #585b70;
    --surface1: #45475a;
    --surface0: #313244;

    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--base);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}

/* Reasonable link defaults — colour inherits, no underline. Specific
   link classes / content regions style themselves below. Do NOT use
   'all: unset' here: it wipes the CTA button and every styled link on
   the page. */
a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

/* Body-text links (legal pages + homepage content sections) use the
   Catppuccin link colour, with Lavender on hover and an underline for
   affordance. */
section p a,
section li a,
article.legal p a,
article.legal li a {
    color: var(--blue);
    transition: color 0.15s ease;
}
section p a:hover,
section li a:hover,
article.legal p a:hover,
article.legal li a:hover {
    color: var(--lavender);
    text-decoration: underline;
}

.wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

header.site {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* The avatar + brand are wrapped in a single anchor so the whole block
   is one clickable target back to /. Inherit colour so the brand text
   doesn't get the body-link colour. */
header.site a.brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: inherit;
    text-decoration: none;
    min-width: 0; /* allow the brand text to truncate / wrap on narrow screens */
}

header.site img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface0);
    object-fit: cover;
    flex-shrink: 0;
}

header.site .brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

header.site .brand strong {
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--text);
}

header.site .brand span {
    color: var(--subtext0);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

nav.top {
    margin-left: auto;
    display: flex;
    gap: 1.25rem;
    font-size: 0.9rem;
}

nav.top a {
    color: var(--subtext1);
    transition: color 0.15s ease;
}

nav.top a:hover {
    color: var(--pink);
}

nav.top .nav-dropdown {
    position: relative;
}

nav.top .nav-dropdown > .nav-dropdown-toggle {
    /* reset native button styling so it matches the other nav links */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    color: var(--subtext1);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s ease;
}

nav.top .nav-dropdown:hover > .nav-dropdown-toggle,
nav.top .nav-dropdown:focus-within > .nav-dropdown-toggle {
    color: var(--pink);
}

nav.top .nav-dropdown > .nav-dropdown-toggle::after {
    content: "▾";
    font-size: 0.7em;
    color: var(--overlay1);
    transition: transform 0.15s ease;
}

nav.top .nav-dropdown:hover > .nav-dropdown-toggle::after,
nav.top .nav-dropdown:focus-within > .nav-dropdown-toggle::after {
    transform: rotate(180deg);
}

nav.top .nav-dropdown .menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 160px;
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 10px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 20;

    /* Hidden until hovered / focused / explicitly opened. Using
       visibility (not display:none) keeps the bridge hoverable. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        visibility 0s linear 0.15s;
}

/* Transparent bridge filling the gap between the trigger and the panel
   so the hover state survives the mouse travelling between them. */
nav.top .nav-dropdown .menu::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    left: 0;
    right: 0;
    height: 0.5rem;
}

nav.top .nav-dropdown:hover .menu,
nav.top .nav-dropdown:focus-within .menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition:
        opacity 0.15s ease,
        transform 0.15s ease,
        visibility 0s;
}

nav.top .nav-dropdown .menu a {
    padding: 0.5rem 0.75rem;
    border-radius: 7px;
    color: var(--subtext1);
    white-space: nowrap;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

nav.top .nav-dropdown .menu a:hover {
    background: var(--surface0);
    color: var(--pink);
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 0 3rem;
}

.hero img.avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: var(--surface0);
    object-fit: cover;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    margin-bottom: 1.5rem;
    border: 2px solid var(--surface1);
}

.hero h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    color: var(--pink);
}

.hero p.tagline {
    color: var(--subtext0);
    font-size: 1.15rem;
    margin: 0 0 2rem;
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--pink);
    color: var(--crust);
    border-radius: 10px;
    font-weight: 700;
    transition:
        background 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
    box-shadow: 0 8px 24px rgba(245, 194, 231, 0.25);
}

.cta:hover {
    background: var(--mauve);
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(203, 166, 247, 0.3);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2.5rem 0;
}

.features .card {
    background: var(--mantle);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--surface0);
    transition:
        border-color 0.15s ease,
        transform 0.15s ease;
}

.features .card:hover {
    border-color: var(--pink);
    transform: translateY(-2px);
}

.features .card h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--pink);
}

.features .card p {
    margin: 0;
    color: var(--subtext0);
    font-size: 0.9rem;
}

/* ── "Join us" two-column section ───────────────────────────────────
   Left column holds the invitation copy; the right column is a
   sidebar card wrapping the live Discord widget iframe. Collapses to
   a single stacked column on narrow screens. */
.join {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2rem;
    margin: 3rem 0 1rem;
}

.join .join-copy {
    flex: 1 1 280px;
    min-width: 0;
}

.join .join-copy h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--flamingo);
}

.join .join-copy p {
    color: var(--subtext0);
}

.join aside.join-widget {
    flex: 0 0 350px;
    max-width: 100%;
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 0.75rem;
}

.join aside.join-widget iframe {
    display: block;
    width: 100%;
    height: 500px;
    border: 0;
    border-radius: 8px;
}

@media (max-width: 640px) {
    .join aside.join-widget {
        flex-basis: 100%;
    }
}

article.legal h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: var(--pink);
}

article.legal .effective {
    color: var(--overlay1);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

article.legal h2 {
    margin-top: 2rem;
    font-size: 1.25rem;
    color: var(--flamingo);
}

article.legal h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
    color: var(--rosewater);
}

/* ── Collapsible policy sections (privacy page) ─────────────────────
   Each of the four policies is a <details>; its <summary> is the
   clickable button that expands it. */
article.legal details.policy {
    border: 1px solid var(--surface0);
    border-radius: 12px;
    background: var(--mantle);
    margin: 1rem 0;
    overflow: hidden;
    scroll-margin-top: 1rem;
    transition: border-color 0.15s ease;
}

article.legal details.policy[open] {
    border-color: var(--surface2);
}

/* Highlight a policy that another policy linked to. */
article.legal details.policy:target {
    border-color: var(--pink);
}

article.legal details.policy > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pink);
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

/* Hide the native disclosure triangle in WebKit and Firefox. */
article.legal details.policy > summary::-webkit-details-marker {
    display: none;
}
article.legal details.policy > summary {
    list-style-type: none;
}

/* Our own rotating chevron. */
article.legal details.policy > summary::before {
    content: "▸";
    color: var(--overlay1);
    font-size: 0.85em;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
article.legal details.policy[open] > summary::before {
    transform: rotate(90deg);
}

article.legal details.policy > summary:hover {
    background: var(--surface0);
    color: var(--flamingo);
}

article.legal details.policy[open] > summary {
    border-bottom: 1px solid var(--surface0);
}

article.legal details.policy .policy-tag {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--subtext0);
    background: var(--surface0);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    flex-shrink: 0;
}

article.legal .policy-body {
    padding: 0.25rem 1.25rem 1.25rem;
}

/* First heading inside a policy body shouldn't add a big top gap. */
article.legal .policy-body > h3:first-child,
article.legal .policy-body > p:first-child {
    margin-top: 0.75rem;
}

article.legal p,
article.legal li {
    color: var(--subtext1);
}

article.legal ul {
    padding-left: 1.25rem;
}

article.legal code {
    background: var(--surface0);
    color: var(--rosewater);
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
}

/* Data registry table (generated from DATA_DOMAINS) */
table.data-registry {
    width: 100%; border-collapse: collapse; font-size: 0.82rem;
    margin: 0.75rem 0 1rem; color: var(--subtext1);
}
table.data-registry th {
    text-align: left; padding: 0.4rem 0.6rem;
    border-bottom: 2px solid var(--surface1);
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--overlay1); white-space: nowrap;
}
table.data-registry td {
    padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--surface0);
    vertical-align: top; line-height: 1.4;
}
table.data-registry tr:last-child td { border-bottom: none; }
table.data-registry td:nth-child(5),
table.data-registry td:nth-child(6),
table.data-registry td:nth-child(7) { white-space: nowrap; }

footer.site {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--surface0);
    color: var(--overlay1);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
}

footer.site .grow {
    flex: 1;
}

footer.site a {
    color: var(--subtext0);
    transition: color 0.15s ease;
}

footer.site a:hover {
    color: var(--pink);
}

/* ── Mobile: <= 540px ─────────────────────────────────────────────
   The previous breakpoint hid the nav entirely, which left mobile
   users with no top-bar navigation. Instead we let the header wrap
   so the nav sits below the brand on a second row, shrink the hero
   avatar, and tighten paddings. */
@media (max-width: 540px) {
    .wrap {
        padding: 2rem 1rem 3rem;
    }

    header.site {
        flex-wrap: wrap;
        gap: 0.75rem 1rem;
        margin-bottom: 2rem;
    }

    header.site a.brand-link {
        gap: 0.75rem;
    }

    header.site img {
        width: 48px;
        height: 48px;
    }

    header.site .brand strong {
        font-size: 1.05rem;
    }

    header.site .brand span {
        font-size: 0.8rem;
    }

    nav.top {
        margin-left: 0;
        width: 100%;
        gap: 1rem;
        flex-wrap: wrap;
    }

    /* Anchor the dropdown panel to the left of its trigger on mobile so
       it doesn't run off the right edge of a narrow screen. */
    nav.top .nav-dropdown .menu {
        right: auto;
        left: 0;
    }

    .hero {
        padding: 1rem 0 2rem;
    }

    .hero img.avatar {
        width: 96px;
        height: 96px;
        margin-bottom: 1.25rem;
    }

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

    .hero p.tagline {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .cta {
        padding: 0.7rem 1.25rem;
        font-size: 0.95rem;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin: 2rem 0;
    }

    article.legal h1 {
        font-size: 1.6rem;
    }

    article.legal h2 {
        font-size: 1.1rem;
    }

    footer.site {
        gap: 0.5rem 1.25rem;
        margin-top: 3rem;
    }

    /* On a narrow screen the spacer-grow trick stops being useful;
       let the links wrap normally instead. */
    footer.site .grow {
        display: none;
    }
}

/* ─── Single-card pages (OAuth callbacks, 404, /coffee teapot) ───────────── */

body.message-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.message-card {
    background: var(--surface0);
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    text-align: center;
    line-height: 1.6;
    color: var(--text);
    border: 1px solid var(--surface1);
}

.message-card h1 {
    margin-top: 0;
    color: var(--pink);
    letter-spacing: -0.01em;
}

.message-card p {
    color: var(--subtext1);
}

.message-card .ok    { color: var(--green); }
.message-card .err   { color: var(--red); }
.message-card .warn  { color: var(--yellow); }

.message-card .muted {
    color: var(--overlay1);
    font-size: 0.9rem;
    margin-top: 1.5rem;
}

.message-card code {
    background: var(--mantle);
    color: var(--rosewater);
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
}

.message-card a.home-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: var(--pink);
    transition: color 0.15s ease;
}

.message-card a.home-link:hover {
    color: var(--flamingo);
    text-decoration: underline;
}

.message-card .glyph {
    font-size: 2.75rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

@media (max-width: 540px) {
    .message-card {
        padding: 1.75rem 1.5rem;
    }
}

/* ── Nav user chip & login button ──────────────────────────────────────────── */

/* Small avatar inside the toggle button */
nav.top .nav-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* The user chip reads as "normal text" (--text) rather than muted subtext;
   hover/focus-within still shift it to --pink via the parent rule above. */
nav.top .nav-user-dropdown > .nav-dropdown-toggle {
    color: var(--text);
}

/* Discord-blurple "Login with Discord" pill */
nav.top .nav-login {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #5865f2;
    color: #fff !important;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s ease;
}

nav.top .nav-login:hover {
    background: #4752c4;
    color: #fff !important;
}

/* Red logout link inside the user dropdown */
nav.top .nav-dropdown .menu a.nav-logout {
    color: var(--red) !important;
}

nav.top .nav-dropdown .menu a.nav-logout:hover {
    background: rgba(243, 139, 168, 0.12);
    color: var(--red) !important;
}

@media (max-width: 540px) {
    nav.top .nav-login {
        font-size: 0.8rem;
        padding: 0.25rem 0.6rem;
    }
}
