/* imbrada signup
   One loud thing: the brand mark doubles as the progress indicator. Everything
   else stays quiet - one typeface, cool paper, teal for structure, orange only
   for the center of the mark and the primary action. */

:root {
    --paper: #f3f7f6;
    --surface: #ffffff;
    --ink: #17302f;
    --muted: #4f6c6a;
    --line: #d2dfdd;
    --teal: #168a86;
    --teal-strong: #0f6e6b;
    --teal-soft: #d6ecea;
    --orange: #ee7623;
    --orange-strong: #c95c10;
    --orange-soft: #fbe3d0;
    --error: #b42318;
    --error-soft: #fdecea;
    --warning-soft: #fdf3dc;
    --warning-ink: #6b4a00;
    --focus: #168a86;

    --font: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* Modular scale, ratio 1.25 from 16px */
    --step--1: 0.8rem;
    --step-0: 1rem;
    --step-1: 1.25rem;
    --step-2: 1.5625rem;
    --step-3: 1.953rem;
    --step-4: 2.441rem;

    --radius-control: 10px;
    --radius-panel: 18px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0e1c1b;
        --surface: #142624;
        --ink: #e5efed;
        --muted: #9cb4b1;
        --line: #284240;
        --teal: #3fbdb6;
        --teal-strong: #6fd3cd;
        --teal-soft: #1b3735;
        --orange: #f48a3e;
        --orange-strong: #f7a266;
        --orange-soft: #3a2616;
        --error: #ff8a80;
        --error-soft: #3a1714;
        --warning-soft: #33290f;
        --warning-ink: #f3d58b;
        --focus: #6fd3cd;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #0e1c1b;
    --surface: #142624;
    --ink: #e5efed;
    --muted: #9cb4b1;
    --line: #284240;
    --teal: #3fbdb6;
    --teal-strong: #6fd3cd;
    --teal-soft: #1b3735;
    --orange: #f48a3e;
    --orange-strong: #f7a266;
    --orange-soft: #3a2616;
    --error: #ff8a80;
    --error-soft: #3a1714;
    --warning-soft: #33290f;
    --warning-ink: #f3d58b;
    --focus: #6fd3cd;
    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--step-0);
    font-weight: 300;
    line-height: 1.55;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: var(--step-3);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

h1:focus {
    outline: none;
}

p {
    margin: 0 0 1rem;
    max-width: 62ch;
}

strong {
    font-weight: 500;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    overflow-wrap: anywhere;
}

a {
    color: var(--teal-strong);
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Shell ---------- */

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
}

.masthead,
.stage,
.colophon {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
}

.masthead {
    padding: 1.25rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    text-decoration: none;
}

.wordmark {
    font-size: var(--step-1);
    font-weight: 500;
    letter-spacing: -0.02em;
}

.stage {
    flex: 1;
    padding: 1.5rem 0 3rem;
}

.colophon {
    padding: 1.5rem 0 2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: var(--step--1);
}

/* ---------- Brand mark ---------- */

.brand-mark-lines line {
    stroke: var(--teal);
    stroke-width: 6;
    stroke-linecap: round;
}

.brand-mark-node {
    fill: var(--teal);
}

.brand-mark-center {
    fill: var(--orange);
}

/* ---------- Signup layout ---------- */

.signup {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 4rem;
    align-items: start;
}

.signup-rail {
    position: sticky;
    top: 2rem;
}

.panel {
    max-width: 34rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 2.25rem 2.25rem 2rem;
}

.lede {
    color: var(--muted);
    font-size: var(--step-1);
    line-height: 1.45;
    margin-bottom: 1.75rem;
}

.signed-in {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--muted);
    font-size: var(--step--1);
}

/* ---------- Progress mark ---------- */

.progress {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.progress-mark {
    width: 100%;
    max-width: 200px;
    height: auto;
    overflow: visible;
}

.progress-track {
    stroke: var(--line);
    stroke-width: 4;
    stroke-linecap: round;
}

.progress-line {
    stroke: var(--teal);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 700ms cubic-bezier(0.65, 0, 0.35, 1);
}

.progress-line.is-drawn {
    stroke-dashoffset: 0;
}

.progress-node,
.progress-center {
    stroke-width: 4;
    transition: fill 300ms ease, stroke 300ms ease;
}

.progress-node.is-upcoming {
    fill: var(--surface);
    stroke: var(--line);
}

.progress-node.is-current {
    fill: var(--surface);
    stroke: var(--teal);
    animation: node-pulse 2.4s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.progress-node.is-done {
    fill: var(--teal);
    stroke: var(--teal);
}

.progress-center.is-upcoming {
    fill: var(--surface);
    stroke: var(--orange-soft);
}

.progress-center.is-current,
.progress-center.is-done {
    fill: var(--orange);
    stroke: var(--orange);
}

@keyframes node-pulse {
    0%, 100% { stroke-width: 4; }
    50% { stroke-width: 7; }
}

.progress-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
    font-size: var(--step-0);
}

.progress-steps li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted);
}

.progress-steps li::before {
    content: "";
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--line);
}

.progress-steps li.is-current {
    color: var(--ink);
    font-weight: 500;
}

.progress-steps li.is-current::before {
    border-color: var(--teal);
}

.progress-steps li.is-done::before {
    background: var(--teal);
    border-color: var(--teal);
}

.progress-steps li:last-child.is-current::before,
.progress-steps li:last-child.is-done::before {
    background: var(--orange);
    border-color: var(--orange);
}

/* ---------- Forms ---------- */

.form {
    display: grid;
    gap: 1.25rem;
}

.field {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label,
legend {
    font-weight: 500;
    font-size: var(--step--1);
}

.optional {
    color: var(--muted);
    font-weight: 300;
    margin-left: 0.35rem;
}

.hint {
    color: var(--muted);
    font-size: var(--step--1);
    margin: 0 0 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    font: inherit;
    font-weight: 400;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    padding: 0.7rem 0.85rem;
}

input:focus-visible {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-soft);
}

input:disabled {
    opacity: 0.6;
}

.code-input {
    font-family: var(--mono);
    font-size: var(--step-2);
    letter-spacing: 0.4em;
    max-width: 12ch;
}

fieldset {
    border: 0;
    padding: 0;
    margin: 0;
}

.choice-group {
    gap: 0.5rem;
}

.choice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    cursor: pointer;
    font-size: var(--step-0);
    font-weight: 400;
}

.choice.is-selected {
    border-color: var(--teal);
    background: var(--teal-soft);
}

.choice input {
    accent-color: var(--teal);
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.confirm {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--step-0);
    font-weight: 400;
    cursor: pointer;
}

.confirm input {
    accent-color: var(--teal);
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0 1.4rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 150ms ease;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-primary {
    background: var(--orange);
    color: #1f1206;
    justify-self: start;
}

.button-primary:hover:not(:disabled) {
    background: var(--orange-strong);
    color: #fff;
}

.button-secondary {
    background: transparent;
    color: var(--teal-strong);
    border-color: var(--teal);
}

.button-secondary:hover:not(:disabled) {
    background: var(--teal-soft);
}

.button-apple {
    width: 100%;
    max-width: 400px;
    background: #000;
    color: #fff;
}

.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: var(--step--1);
    color: var(--teal-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.link-button:disabled {
    color: var(--muted);
    text-decoration: none;
    cursor: default;
}

.aside-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 1.5rem;
}

/* ---------- Providers ---------- */

.providers {
    display: grid;
    gap: 0.75rem;
    justify-items: start;
}

.google-slot {
    width: 100%;
    max-width: 400px;
    min-height: 44px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.75rem 0 1.25rem;
    color: var(--muted);
    font-size: var(--step--1);
    max-width: none;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--line);
}

/* ---------- Notices ---------- */

.notice {
    margin: 0 0 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-control);
    border-left: 4px solid;
    font-size: var(--step--1);
    font-weight: 400;
}

.notice-info {
    background: var(--teal-soft);
    border-color: var(--teal);
}

.notice-warning {
    background: var(--warning-soft);
    border-color: var(--orange);
    color: var(--warning-ink);
}

.notice-error {
    background: var(--error-soft);
    border-color: var(--error);
    color: var(--error);
}

/* ---------- API key ---------- */

.key-box {
    display: grid;
    gap: 0.6rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--orange);
    border-radius: var(--radius-control);
    background: var(--orange-soft);
}

.key-value {
    display: block;
    font-family: var(--mono);
    font-size: var(--step--1);
    line-height: 1.6;
    overflow-wrap: anywhere;
    user-select: all;
}

.key-box .button {
    justify-self: start;
}

.facts {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1.75rem;
}

.facts div {
    display: grid;
    gap: 0.1rem;
}

.facts dt {
    color: var(--muted);
    font-size: var(--step--1);
}

.facts dd {
    margin: 0;
}

/* ---------- Boot + error ---------- */

.boot {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.boot-mark {
    animation: boot-breathe 1.6s ease-in-out infinite;
}

@keyframes boot-breathe {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    padding: 0.9rem 16px;
    background: var(--error-soft);
    color: var(--error);
    border-top: 1px solid var(--error);
    z-index: 10;
}

#blazor-error-ui .dismiss {
    float: right;
    background: none;
    border: 0;
    font-size: 1.25rem;
    color: inherit;
    cursor: pointer;
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
    .signup {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .signup-rail {
        position: static;
    }

    .progress {
        flex-direction: row;
        align-items: center;
        gap: 1.25rem;
    }

    .progress-mark {
        width: 76px;
        flex: none;
    }

    .progress-steps {
        gap: 0.25rem;
        font-size: var(--step--1);
    }

    .progress-steps li:not(.is-current) {
        display: none;
    }

    .panel {
        padding: 1.5rem 1.25rem;
    }

    h1 {
        font-size: var(--step-2);
    }

    .lede {
        font-size: var(--step-0);
    }

    .field-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .progress-line,
    .progress-node,
    .progress-center,
    .button {
        transition: none;
    }

    .progress-node.is-current,
    .boot-mark {
        animation: none;
    }
}
