/* The public page's whole stylesheet. Tokens that the admin controls live in
   /p/theme.css (generated per settings revision); everything structural is
   here, so a theme change never rewrites layout and never busts this file.

   One token source (house rule): --accent-rgb is the only colour the theme
   supplies, and every tint below is an rgba() of it. */

:root {
    color-scheme: light dark;
    --paper: #f6f6f9;
    --surface: #ffffff;
    --ink: #14161c;
    --muted: #6b7280;
    --line: rgba(0, 0, 0, .07);
    --shadow: 0 1px 2px rgba(16, 18, 26, .06), 0 8px 24px rgba(16, 18, 26, .06);
    --shadow-lift: 0 2px 4px rgba(16, 18, 26, .08), 0 14px 34px rgba(16, 18, 26, .12);
}

/* Dark tokens in one block, applied by the explicit choice OR by the system
   when the page is on "auto" — never by the media query alone, or a page set
   to light would flip on a dark phone. */
html[data-appearance="dark"] {
    --paper: #0e1015;
    --surface: #181b22;
    --ink: #eceef4;
    --muted: #99a0ac;
    --line: rgba(255, 255, 255, .09);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
    html[data-appearance="auto"] {
        --paper: #0e1015;
        --surface: #181b22;
        --ink: #eceef4;
        --muted: #99a0ac;
        --line: rgba(255, 255, 255, .09);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
        --shadow-lift: 0 2px 6px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .45);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Background styles. Each is one layered background over the paper, so the
   token stays the single source of the base colour. */
body.bg-gradient {
    background-image:
        radial-gradient(1100px 620px at 50% -15%, rgba(var(--accent-rgb), .30), transparent 62%);
}
body.bg-mesh {
    background-image:
        radial-gradient(620px 420px at 12% 8%, rgba(var(--accent-rgb), .34), transparent 60%),
        radial-gradient(560px 420px at 88% 22%, rgba(var(--accent-rgb), .18), transparent 62%),
        radial-gradient(700px 500px at 50% 108%, rgba(var(--accent-rgb), .22), transparent 60%);
}
body.bg-dots {
    background-image: radial-gradient(rgba(var(--accent-rgb), .34) 1.2px, transparent 1.2px);
    background-size: 22px 22px;
}
body.bg-grid {
    background-image:
        linear-gradient(rgba(var(--accent-rgb), .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--accent-rgb), .16) 1px, transparent 1px);
    background-size: 32px 32px;
}

.page {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: clamp(36px, 9vw, 72px) 20px calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ---- profile ---- */

.profile { text-align: center; }

.avatar {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    margin: 0 auto 18px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: var(--shadow);
    background: var(--surface);
}
body.avatar-squircle .avatar { border-radius: 30%; }
body.avatar-square .avatar { border-radius: 12px; }

.avatar-initial {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--accent-ink);
    background: var(--accent);
}

.name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    font-size: clamp(22px, 5.5vw, 27px);
    font-weight: 700;
    letter-spacing: -.02em;
}

.badge {
    display: inline-grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    color: var(--accent-ink);
    background: var(--accent);
}
.badge .ic { width: 13px; height: 13px; }

.tagline {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--muted);
}

.bio {
    margin: 12px auto 0;
    max-width: 46ch;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--muted);
    white-space: pre-line;
}

/* ---- socials ---- */

.socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.social {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--ink);
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.social .ic { width: 20px; height: 20px; }
.social .thumb { width: 22px; height: 22px; border-radius: 50%; }

@media (hover: hover) {
    .social:hover { color: var(--accent-ink); background: var(--accent); transform: translateY(-1px); }
}

/* ---- links ---- */

.links {
    display: grid;
    gap: 11px;
    margin-top: 30px;
}

.section {
    margin: 20px 0 2px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-align: center;
    color: var(--muted);
}
.section:first-child { margin-top: 0; }

.link {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 14px;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.mark { display: grid; place-items: center; height: 40px; }
.mark:empty { display: none; }
.link:has(.mark:empty) { grid-template-columns: 0 minmax(0, 1fr) 14px; gap: 0 12px; }

.mark .ic { width: 22px; height: 22px; }
.emoji { font-size: 23px; line-height: 1; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: calc(var(--radius) / 2.4); }

.label { display: grid; gap: 2px; min-width: 0; }
.title { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { font-size: 20px; line-height: 1; color: var(--muted); opacity: .5; }

@media (hover: hover) {
    .link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
}
.link:active { transform: translateY(0) scale(.995); }

/* Outline and glass are the same card with a different skin — never a second
   .link rule set. */
body.fill-outline .link {
    background: transparent;
    border: 1.5px solid rgba(var(--accent-rgb), .55);
    box-shadow: none;
}
body.fill-glass .link {
    background: rgba(255, 255, 255, .62);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-color: rgba(255, 255, 255, .5);
}
html[data-appearance="dark"] body.fill-glass .link { background: rgba(30, 34, 43, .58); border-color: rgba(255, 255, 255, .1); }
@media (prefers-color-scheme: dark) {
    html[data-appearance="auto"] body.fill-glass .link { background: rgba(30, 34, 43, .58); border-color: rgba(255, 255, 255, .1); }
}

/* The featured row: accent-filled, with a slow shine that reads as "look here"
   without moving anything. */
.link.featured {
    position: relative;
    overflow: hidden;
    color: var(--accent-ink);
    background: var(--accent);
    border-color: transparent;
}
.link.featured .sub,
.link.featured .chev { color: var(--accent-ink); opacity: .78; }
.link.featured::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 -60%;
    width: 45%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
    animation: shine 4.5s ease-in-out infinite;
}

@keyframes shine {
    0%, 62% { transform: translateX(0); }
    100% { transform: translateX(420%); }
}

.empty { margin-top: 36px; text-align: center; color: var(--muted); }

.foot {
    margin-top: 42px;
    font-size: 12.5px;
    text-align: center;
    color: var(--muted);
    white-space: pre-line;
}

.ic { display: block; width: 22px; height: 22px; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Motion is opt-out in the admin and opt-out in the OS; both land here. */
body.no-motion *,
body.no-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::after { animation: none !important; transition: none !important; }
}
