/* ==========================================================================
   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; }

/* The ring belongs to keyboard navigation and has to stay for it - without
   it there is no way to see where you are while tabbing. What it must not do
   is linger on a button after a mouse click, which is what was happening:
   some browsers keep a plain :focus ring there. This says so explicitly
   rather than trusting every engine to agree about :focus-visible. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

:focus:not(:focus-visible) { outline: none; }

/* ------------------------------------------------------------- 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; }
}

/* ==========================================================================
   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 {
    mix-blend-mode: screen;
    opacity: 0.28;
}


/* ==========================================================================
   Site footer - plain text, no bar, no border
   ========================================================================== */
.sitefooter {
    position: relative;
    z-index: 10;
    width: 100%;
    /* The extra bottom room is the phone's own navigation bar, which sits on
       top of the page rather than beside it. */
    padding: 22px 20px calc(26px + env(safe-area-inset-bottom, 0px));
    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 {
    /* dvh, not vh: on Android with gesture navigation 100vh is taller than
       what is actually on screen, and the footer ends up underneath the
       system bar. The vh line stays as a fallback for older browsers. */
    min-height: 100vh;
    min-height: 100dvh;
    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;
    /* flex:1 makes this a full-height column, and it sits above the bubble
       layer - so the empty space above and below the card was swallowing
       every click meant for a bubble drifting through it. Same treatment as
       .page__wrapper: the column passes clicks through, its children take
       them. */
    pointer-events: none;
}

.shell__wrapper > * { pointer-events: auto; }

.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; }

/* Four digits, set like the code fields everywhere else. */
.dialog__input--pin {
    text-align: center;
    font: 700 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 8px;
    text-indent: 8px;
}

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

/* A window with more to read than one sentence: the catalog rules. It can
   outgrow a small phone, so it scrolls inside rather than off the screen. */
.dialog__panel--wide {
    max-width: 460px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
}

.dialog__title {
    margin-bottom: 14px;
    font-size: var(--fs-lg);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

/* Two classes: .agree further down sets its own margin and would win. */
.dialog .dialog__agree { margin: 18px 0 22px; }

/* The premium themes live in themes.css, loaded by the public pages. */

/* 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%);
}


/* 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; }



/* The answer already given, marked inside the bar so reopening it shows where
   things stand rather than asking the same question again. */
.cookiebar [data-consent].is-chosen {
    box-shadow: var(--sh-raised), 0 0 0 2px var(--ok-2);
}

.cookiebar [data-consent].is-chosen::after {
    content: " ✓";
    font-weight: 700;
}

/* ==========================================================================
   What is not allowed - the folded list under an agreement box, on the
   invitation form and in the catalogue block alike.
   ========================================================================== */
.rules { width: 100%; font-size: var(--fs-sm); color: var(--text-soft); }

.rules__summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.rules__summary::-webkit-details-marker { display: none; }

.rules__summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    font-size: 13px;
    line-height: 1;
    color: var(--text-muted);
    background: var(--surface-sunk);
    border-radius: 50%;
    box-shadow: var(--sh-sunk);
}

.rules[open] .rules__summary::before { content: "–"; }

.rules__list { display: grid; gap: 4px; margin: 10px 0 0 20px; line-height: 1.5; }
.rules__note { margin-top: 8px; font-size: var(--fs-xs); color: var(--text-muted); }

/* The same list unfolded, where reading it is the point. */
.rules__title { font-weight: 600; color: var(--text); }
.rules--open .rules__list { margin-top: 8px; }

/* ==========================================================================
   Agreement box. A real checkbox with a drawn box on top: the native control
   is the one thing on these surfaces that never matches them. Turquoise when
   ticked, like every other "on" here; the delete page adds .agree--warn for
   a rose tick, because there the box is agreeing to lose everything.
   ========================================================================== */
.agree {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 18px 0 4px;
    cursor: pointer;
    text-align: left;
}

.agree input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.agree__box {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: var(--r-xs);
    background: var(--surface-sunk);
    box-shadow: var(--sh-sunk);
    position: relative;
    transition: background var(--dur) var(--ease);
}

.agree__box::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform var(--dur-press) var(--ease);
}

.agree input:checked + .agree__box { background: var(--ok-2); box-shadow: none; }
.agree--warn input:checked + .agree__box { background: var(--warn-2); }
.agree input:checked + .agree__box::after { transform: rotate(45deg) scale(1); }
.agree input:focus-visible + .agree__box { box-shadow: 0 0 0 2px var(--accent); }
.agree input:disabled + .agree__box { opacity: 0.5; }

.agree__text {
    font-size: var(--fs-xs);
    line-height: 1.55;
    color: var(--text-soft);
}
