/* ==========================================================================
   thelink.id — design tokens
   Soft neumorphic surfaces, Inter, pill controls with a light press.
   ========================================================================== */

:root {
    /* palette — light */
    --bg:            #f0f2f5;
    --bg-glow-1:     rgba(255, 255, 255, 0.80);
    --bg-glow-2:     rgba(255, 255, 255, 0.90);
    --surface:       #ffffff;
    --surface-hover: #fafafa;
    --surface-sunk:  #e9ecf1;
    --surface-edge:  rgba(255, 255, 255, 1);
    --glass:         rgba(255, 255, 255, 0.60);

    --text:          #1a1a1a;
    --text-soft:     #555555;
    --text-muted:    #8a8f98;
    --accent:        #222222;
    --danger:        #c8443c;

    /* light & shadow */
    --light:         rgba(255, 255, 255, 0.90);
    --light-strong:  rgba(255, 255, 255, 1);
    --shade:         rgba(0, 0, 0, 0.10);
    --shade-strong:  rgba(0, 0, 0, 0.16);

    --sh-raised:
        -4px -4px 10px var(--light),
         4px  4px 15px var(--shade);
    --sh-raised-hi:
        -6px -6px 15px var(--light-strong),
         6px  6px 20px var(--shade);
    /* Pressed: shadows tighten and the surface settles. No hard inset -
       the movement should be felt, not stared at. */
    --glow:          rgba(255, 255, 255, 0.95);
    --sh-pressed:
        -2px -2px 6px var(--light),
         2px  2px 7px var(--shade);
    --sh-card:
        0 20px 40px var(--shade),
        inset 0 0 0 1px var(--light-strong);
    --sh-sunk:
        inset 3px 3px 8px var(--shade-strong),
        inset -3px -3px 8px var(--light);

    /* geometry */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-xl: 40px;
    --r-pill: 999px;

    /* type */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --fs-xs: 12px;
    --fs-sm: 13px;
    --fs-md: 14px;
    --fs-lg: 18px;
    --fs-xl: 24px;

    --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
    --dur: 0.3s;
    --dur-press: 0.12s;
}

[data-theme="graphite"] {
    --bg:            #1a1c1f;
    --bg-glow-1:     rgba(255, 255, 255, 0.05);
    --bg-glow-2:     rgba(255, 255, 255, 0.03);
    --surface:       #26282c;
    --surface-hover: #2c2f33;
    --surface-sunk:  #1e2023;
    --surface-edge:  rgba(255, 255, 255, 0.07);
    --glass:         rgba(38, 40, 44, 0.66);

    --text:          #eef0f3;
    --text-soft:     #b9bec6;
    --text-muted:    #7d838c;
    --accent:        #ffffff;

    --light:         rgba(255, 255, 255, 0.05);
    --light-strong:  rgba(255, 255, 255, 0.09);
    --shade:         rgba(0, 0, 0, 0.55);
    --glow:          rgba(255, 255, 255, 0.16);
    --shade-strong:  rgba(0, 0, 0, 0.7);

    --sh-card:
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ------------------------------------------------------------------ reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* The UA rule for [hidden] is display:none, but any class that sets its own
   display outranks it and the element stays visible. Make it authoritative. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 50%, var(--bg-glow-1) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, var(--bg-glow-2) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ------------------------------------------------------------- primitives */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-radius: var(--r-xl);
    border: 1px solid var(--surface-edge);
    box-shadow: var(--sh-card);
}

/* Flat white pill, soft double shadow, lifts on hover, settles on press. */
.btn3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 22px;
    font: 600 var(--fs-md)/1 var(--font);
    letter-spacing: 0.5px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--r-pill);
    box-shadow: var(--sh-raised);
    transform: translateY(0);
    transition:
        transform var(--dur-press) var(--ease),
        box-shadow var(--dur) var(--ease),
        background var(--dur) var(--ease);
}

.btn3d:hover {
    transform: translateY(-2px);
    background: var(--surface-hover);
    box-shadow: var(--sh-raised-hi);
}

.btn3d:active {
    transform: translateY(1px) scale(0.988);
    box-shadow: var(--sh-pressed);
}

.btn3d[disabled], .btn3d[aria-disabled="true"] {
    opacity: 0.5;
    pointer-events: none;
}

.btn3d--primary {
    color: #ffffff;
    background: #1f2124;
    border-color: rgba(255, 255, 255, 0.12);
}

.btn3d--primary:hover { background: #2a2d31; }

.btn3d--danger { color: var(--danger); }

.field {
    width: 100%;
    padding: 12px 16px;
    font: 400 var(--fs-md)/1.4 var(--font);
    color: var(--text);
    background: var(--surface-sunk);
    border: 1px solid var(--surface-edge);
    border-radius: var(--r-md);
    box-shadow: var(--sh-sunk);
    transition: box-shadow var(--dur) var(--ease);
}

.field::placeholder { color: var(--text-muted); }
.field:focus { outline: none; box-shadow: var(--sh-sunk), 0 0 0 2px var(--accent); }

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ==========================================================================
   Galaxy - premium theme
   ========================================================================== */
[data-theme="galaxy"] {
    --bg:            #0f1024;
    --bg-glow-1:     rgba(120, 110, 255, 0.16);
    --bg-glow-2:     rgba(70, 190, 255, 0.10);
    --surface:       #1b1d3a;
    --surface-hover: #212448;
    --surface-sunk:  #15162e;
    --surface-edge:  rgba(160, 160, 255, 0.12);
    --glass:         rgba(27, 29, 58, 0.66);

    --text:          #e9e9ff;
    --text-soft:     #bcbce0;
    --text-muted:    #8384b0;
    --accent:        #b9a4ff;

    --light:         rgba(150, 140, 255, 0.10);
    --light-strong:  rgba(170, 160, 255, 0.16);
    --shade:         rgba(0, 0, 0, 0.55);
    --shade-strong:  rgba(0, 0, 0, 0.72);
    --glow:          rgba(185, 164, 255, 0.30);

    --sh-card:
        0 20px 44px rgba(0, 0, 0, 0.55),
        inset 0 0 0 1px rgba(160, 160, 255, 0.08);
}


/* ==========================================================================
   Matte grain - a fine sand texture over the background.
   ========================================================================== */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
}

[data-theme="graphite"] body::after,
[data-theme="galaxy"] body::after {
    mix-blend-mode: screen;
    opacity: 0.28;
}


/* ==========================================================================
   Site footer - plain text, no bar, no border
   ========================================================================== */
.sitefooter {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 22px 20px 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: var(--fs-xs);
    letter-spacing: 0.4px;
    color: var(--text-muted);
    text-align: center;
    /* Same reason as .page__wrapper: a full-width strip of mostly empty space
       sitting over the bubbles. Only the words themselves take clicks. */
    pointer-events: none;
}

.sitefooter > *,
.sitefooter a,
.sitefooter__link { pointer-events: auto; }

.sitefooter a,
.sitefooter__link {
    color: var(--text-soft);
    font: inherit;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color var(--dur) var(--ease);
}

.sitefooter a:hover,
.sitefooter__link:hover { color: var(--text); }

/* ==========================================================================
   Cookie consent
   ========================================================================== */
.cookiebar {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 300;
    width: calc(100% - 32px);
    max-width: 460px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--r-lg);
    box-shadow: 0 20px 44px var(--shade-strong);
}

.cookiebar__text {
    font-size: var(--fs-sm);
    line-height: 1.55;
    color: var(--text-soft);
    margin-bottom: 16px;
}

.cookiebar__buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.cookiebar__buttons .btn3d { flex: 1; padding: 12px 16px; font-size: var(--fs-sm); }

/* ==========================================================================
   Brand mark, theme switch and page shell - shared by every interface page
   ========================================================================== */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand img { width: 46px; height: 46px; }

.brand__name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
}

/* "In" carries the weight, "Link" recedes - one word, two tones. */
.brand__name span { color: var(--text-muted); }

.brand--sm img { width: 30px; height: 30px; }
.brand--sm .brand__name { font-size: 18px; }
.brand--sm { gap: 9px; }

.themeswitch {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--r-pill);
    background: var(--surface-sunk);
    box-shadow: var(--sh-sunk);
}

.themeswitch__btn {
    padding: 8px 16px;
    font: 600 var(--fs-xs)/1 var(--font);
    letter-spacing: 0.4px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-pill);
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

/* Active pill glows instead of casting a shadow: inside a sunken track a
   drop shadow reads as a second, contradictory light source. */
.themeswitch__btn.is-active {
    color: var(--text);
    background: var(--surface);
    border-color: var(--surface-edge);
    box-shadow:
        0 0 0 1px var(--surface-edge),
        0 0 14px var(--glow);
}

.themeswitch__btn:active { transform: translateY(1px) scale(0.98); }

/* ------------------------------------------------------------------ shell */
/* Sign in, invite and legal share the landing's shape: switch pinned to the
   corner, one card in the middle, footer at the bottom. */
.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 24px 0 0;
    overflow-x: hidden;
}

.shell__switch {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 20;
}

.shell__wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.shell__wrapper--wide { max-width: 780px; }

.shell__card {
    width: 100%;
    padding: 38px 30px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.shell__brand { margin-bottom: 2px; }

@media (max-width: 420px) {
    .shell__switch { top: 16px; right: 16px; }
    .shell__card { padding: 32px 22px 26px; }
    .brand img { width: 40px; height: 40px; }
    .brand__name { font-size: 21px; }
}

/* ==========================================================================
   Dialog
   ========================================================================== */
.dialog {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dialog[hidden] { display: none; }

.dialog__panel {
    width: 100%;
    max-width: 380px;
    padding: 26px 24px 22px;
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--r-lg);
    box-shadow: 0 24px 50px var(--shade-strong);
}

.dialog__text {
    font-size: var(--fs-md);
    line-height: 1.55;
    color: var(--text-soft);
    margin-bottom: 16px;
}

.dialog__input { margin-bottom: 16px; }

.dialog__actions { display: flex; gap: 10px; }
.dialog__actions .btn3d { flex: 1; padding: 12px 16px; font-size: var(--fs-sm); }

/* ==========================================================================
   Phone colours - premium themes.

   Borrowed from the finishes people already know from their handsets: the
   matte titanium and glass backs of recent iPhone and Galaxy models. Each is
   a full token set, so every control follows without extra rules.
   ========================================================================== */

/* Titanium violet - Galaxy's muted purple */
/* Retired from the picker when Nebula joined: it sat too close to Galaxy and
   left the dark half one longer than the light one. Kept here, and only here,
   so bringing it back is a single line in config/themes.php. */
[data-theme="violet"] {
    --bg:            #241f30;
    --bg-glow-1:     rgba(190, 165, 255, 0.08);
    --bg-glow-2:     rgba(160, 140, 235, 0.05);
    --surface:       #302941;
    --surface-hover: #38304c;
    --surface-sunk:  #1d1928;
    --surface-edge:  rgba(210, 195, 255, 0.10);
    --glass:         rgba(48, 41, 65, 0.68);

    --text:          #efeaf7;
    --text-soft:     #c4bad6;
    --text-muted:    #9a90ad;
    --accent:        #d9c9ff;

    --light:         rgba(200, 180, 255, 0.08);
    --light-strong:  rgba(210, 195, 255, 0.14);
    --shade:         rgba(0, 0, 0, 0.52);
    --shade-strong:  rgba(0, 0, 0, 0.7);
    --glow:          rgba(210, 195, 255, 0.26);
}

/* The matte finish: heavier grain on the coloured themes, the way a phone
   back diffuses light instead of reflecting it. */

/* Positive state - turquoise rather than the usual green. */
:root {
    --on-1: #37c7c0;
    --on-2: #1f9fae;
    --ok-1: #2fb8ad;
    --ok-2: #1c8f9c;
    --warn-1: #ef7fa7;
    --warn-2: #c9366d;
}

/* Destructive confirmation: filled rose, white text - unmistakable next to
   the plain Cancel beside it. */
.btn3d--warn {
    color: #ffffff;
    background: linear-gradient(180deg, var(--warn-1) 0%, var(--warn-2) 100%);
    border-color: color-mix(in srgb, var(--warn-2) 70%, transparent);
}

.btn3d--warn:hover {
    background: linear-gradient(180deg, var(--warn-1) 10%, var(--warn-2) 100%);
}

/* Pink - deeper than a pastel, still soft enough to read on */
/* The highlight on a coloured surface is that colour lit, not white paint.
   Pure white here made every light theme look like it had a flash on it; each
   one now carries its own hue into the raised edge and the glow. */
[data-theme="pink"] {
    --bg:            #f2c6d1;
    --bg-glow-1:     rgba(255, 240, 245, 0.55);
    --bg-glow-2:     rgba(255, 232, 240, 0.35);
    --surface:       #fbdde4;
    --surface-hover: #ffe8ed;
    --surface-sunk:  #e7b5c2;
    --surface-edge:  rgba(255, 255, 255, 0.85);
    --glass:         rgba(251, 221, 228, 0.7);

    --text:          #3d1f27;
    --text-soft:     #6b3f4a;
    --text-muted:    #9d6b78;
    --accent:        #3d1f27;

    --light:         rgba(255, 243, 247, 0.92);
    --light-strong:  rgba(255, 250, 252, 1);
    --shade:         rgba(122, 45, 66, 0.18);
    --shade-strong:  rgba(122, 45, 66, 0.28);
    --glow:          rgba(255, 226, 237, 0.95);
}

/* Teal - saturated mint */
[data-theme="teal"] {
    --bg:            #b6ddd6;
    --bg-glow-1:     rgba(238, 253, 249, 0.55);
    --bg-glow-2:     rgba(228, 250, 244, 0.35);
    --surface:       #d3ece7;
    --surface-hover: #e0f3ef;
    --surface-sunk:  #a4cfc7;
    --surface-edge:  rgba(255, 255, 255, 0.85);
    --glass:         rgba(211, 236, 231, 0.7);

    --text:          #123330;
    --text-soft:     #32544f;
    --text-muted:    #5f8880;
    --accent:        #123330;

    --light:         rgba(240, 254, 250, 0.92);
    --light-strong:  rgba(248, 255, 253, 1);
    --shade:         rgba(11, 71, 64, 0.18);
    --shade-strong:  rgba(11, 71, 64, 0.28);
    --glow:          rgba(214, 248, 240, 0.95);
}

/* Raspberry - dark berry, warm and quiet */
[data-theme="raspberry"] {
    --bg:            #230d16;
    --bg-glow-1:     rgba(255, 150, 190, 0.07);
    --bg-glow-2:     rgba(255, 120, 170, 0.04);
    --surface:       #371524;
    --surface-hover: #431a2c;
    --surface-sunk:  #1b0a11;
    --surface-edge:  rgba(255, 190, 215, 0.10);
    --glass:         rgba(55, 21, 36, 0.7);

    --text:          #f7e2ea;
    --text-soft:     #d5b3c1;
    --text-muted:    #a37e8e;
    --accent:        #ffc2d6;

    --light:         rgba(255, 190, 215, 0.07);
    --light-strong:  rgba(255, 200, 220, 0.13);
    --shade:         rgba(0, 0, 0, 0.55);
    --shade-strong:  rgba(0, 0, 0, 0.72);
    --glow:          rgba(255, 190, 215, 0.26);
}

/* Beige - dark warm sand */
[data-theme="beige"] {
    --bg:            #1e1a14;
    --bg-glow-1:     rgba(255, 226, 180, 0.06);
    --bg-glow-2:     rgba(255, 214, 160, 0.035);
    --surface:       #2c261e;
    --surface-hover: #362f26;
    --surface-sunk:  #171310;
    --surface-edge:  rgba(255, 232, 200, 0.10);
    --glass:         rgba(44, 38, 30, 0.7);

    --text:          #f2e9dc;
    --text-soft:     #cabca9;
    --text-muted:    #97897a;
    --accent:        #f0dcbd;

    --light:         rgba(255, 232, 200, 0.06);
    --light-strong:  rgba(255, 236, 210, 0.12);
    --shade:         rgba(0, 0, 0, 0.55);
    --shade-strong:  rgba(0, 0, 0, 0.72);
    --glow:          rgba(255, 232, 200, 0.24);
}

/* Turquoise - deep lagoon */
[data-theme="turquoise"] {
    --bg:            #0b2124;
    --bg-glow-1:     rgba(120, 235, 230, 0.07);
    --bg-glow-2:     rgba(90, 210, 210, 0.04);
    --surface:       #123033;
    --surface-hover: #173b3f;
    --surface-sunk:  #08181a;
    --surface-edge:  rgba(170, 240, 235, 0.10);
    --glass:         rgba(18, 48, 51, 0.7);

    --text:          #dff2f1;
    --text-soft:     #aecfcd;
    --text-muted:    #7b9d9b;
    --accent:        #8fe8e0;

    --light:         rgba(150, 240, 235, 0.07);
    --light-strong:  rgba(170, 245, 240, 0.13);
    --shade:         rgba(0, 0, 0, 0.55);
    --shade-strong:  rgba(0, 0, 0, 0.72);
    --glow:          rgba(150, 240, 235, 0.26);
}

/* Nebula - Galaxy seen in daylight: the same periwinkle, lit instead of lit
   from within. It is the light half of the last pair in the picker. */
[data-theme="nebula"] {
    --bg:            #dfe1f5;
    --bg-glow-1:     rgba(242, 243, 255, 0.58);
    --bg-glow-2:     rgba(232, 234, 255, 0.38);
    --surface:       #edeefb;
    --surface-hover: #f5f6ff;
    --surface-sunk:  #cdd0ec;
    --surface-edge:  rgba(255, 255, 255, 0.85);
    --glass:         rgba(237, 238, 251, 0.7);

    --text:          #23264a;
    --text-soft:     #474b78;
    --text-muted:    #8085ad;
    --accent:        #23264a;

    --light:         rgba(250, 250, 255, 0.92);
    --light-strong:  rgba(255, 255, 255, 1);
    --shade:         rgba(45, 50, 110, 0.17);
    --shade-strong:  rgba(45, 50, 110, 0.27);
    --glow:          rgba(224, 227, 255, 0.95);
}

/* Matte finish on the coloured themes: a phone back diffuses light rather
   than reflecting it. */
[data-theme="pink"] body::after,
[data-theme="nebula"] body::after,
[data-theme="teal"] body::after { opacity: 0.6; mix-blend-mode: multiply; }

[data-theme="raspberry"] body::after,
[data-theme="beige"] body::after,
[data-theme="turquoise"] body::after,
[data-theme="violet"] body::after { opacity: 0.34; mix-blend-mode: screen; }

/* Destructive confirmation: flat rose, white text. No gradient and no lift -
   the button that deletes should look decided, not springy. */
.btn3d--warn {
    color: #ffffff;
    background: var(--warn-2);
    border-color: var(--warn-2);
    box-shadow: none;
}

.btn3d--warn:hover {
    background: var(--warn-1);
    border-color: var(--warn-1);
    transform: none;
    box-shadow: none;
}

.btn3d--warn:active { transform: translateY(1px); box-shadow: none; }

/* Natural titanium - warm light grey, the phone-back finish */
[data-theme="titanium"] {
    --bg:            #dcd7cf;
    --bg-glow-1:     rgba(255, 252, 245, 0.58);
    --bg-glow-2:     rgba(255, 249, 238, 0.38);
    --surface:       #eae6df;
    --surface-hover: #f0ede8;
    --surface-sunk:  #d1cbc1;
    --surface-edge:  rgba(255, 255, 255, 0.85);
    --glass:         rgba(234, 230, 223, 0.66);

    --text:          #2b2823;
    --text-soft:     #55504a;
    --text-muted:    #8a8279;
    --accent:        #2b2823;

    --light:         rgba(255, 252, 245, 0.92);
    --light-strong:  rgba(255, 254, 250, 1);
    --shade:         rgba(90, 78, 62, 0.16);
    --shade-strong:  rgba(90, 78, 62, 0.26);
    --glow:          rgba(252, 243, 226, 0.95);
}

[data-theme="titanium"] body::after { opacity: 0.6; mix-blend-mode: multiply; }
