/* File Convert — sign in, sign up and the account page.

   This sheet layers over theme.css and never redeclares its tokens. Every
   surface, border and text colour resolves through the --t-* scale so both
   themes are covered by one rule; the only literal colours left are (a) the
   green/amber accents that have no token in the scale, each of which carries
   an explicit dark-theme override, and (b) white foreground on a filled brand
   chip, which is correct in either theme.

   Namespacing: .authpage / .authcard / .authform / .authaside own the two auth
   screens, .account / .panel / .keytable own the signed-in page. The password
   field, the toggle button and the strength meter are styled entirely by
   interactions.css — nothing below restates, duplicates or overrides those
   rules.

   Note on load order: auth.css is linked before theme.css, so where a class
   from theme.css (.band__*, .banlist, .termcard, .minilabel) is reused here the
   local tweak is scoped under .account to out-specify it deliberately. */

/* ------------------------------------------------------------- Messages */

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--alert-ink, var(--t-default));
    background: var(--alert-wash, var(--t-elevated));
    border: 1px solid var(--t-border);
    border-left: 3px solid var(--alert-edge, var(--t-border-strong));
    border-radius: var(--radius-xl);
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 6px;
}

.alert strong {
    color: var(--alert-ink, var(--t-highlighted));
}

.alert--error {
    --alert-ink: var(--primary-700);
    --alert-wash: var(--primary-100);
    --alert-edge: var(--primary-500);
    border-color: var(--primary-200);
}

.alert--success {
    /* No green exists in the shared scale, so the pair is declared here and
       flipped for dark mode a few rules down. */
    --alert-ink: #14532d;
    --alert-wash: #eef8f1;
    --alert-edge: #16a34a;
    border-color: #cbe8d5;
}

.alert--notice {
    --alert-ink: var(--t-highlighted);
    --alert-wash: var(--t-elevated);
    --alert-edge: var(--t-border-strong);
}

:root[data-theme="dark"] .alert--error {
    --alert-ink: var(--primary-200);
    --alert-wash: rgba(229, 50, 45, 0.12);
    border-color: rgba(229, 50, 45, 0.32);
}

:root[data-theme="dark"] .alert--success {
    --alert-ink: #86e0ab;
    --alert-wash: rgba(22, 163, 74, 0.14);
    border-color: rgba(22, 163, 74, 0.34);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .alert--error {
        --alert-ink: var(--primary-200);
        --alert-wash: rgba(229, 50, 45, 0.12);
        border-color: rgba(229, 50, 45, 0.32);
    }

    :root:not([data-theme="light"]) .alert--success {
        --alert-ink: #86e0ab;
        --alert-wash: rgba(22, 163, 74, 0.14);
        border-color: rgba(22, 163, 74, 0.34);
    }
}

/* ------------------------------------------------- Auth split layout */

.authpage {
    /* No horizontal padding: the benefits column is full-bleed to the right
       edge, and the card column carries its own gutter. */
    padding: 0;
    overflow-x: hidden;
}

.authpage__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: calc(100vh - var(--header-h));
}

.authpage__main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 48px 20px 72px;
    background:
        radial-gradient(70% 46% at 12% 0%, var(--brand-tint), transparent 70%),
        var(--t-surface);
}

/* ------------------------------------------------------------- The card */

.authcard {
    width: 100%;
    max-width: 440px;
    padding: 34px 32px 30px;
    color: var(--t-default);
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
}

.authcard__brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 22px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--t-highlighted);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.authcard__brand:hover {
    color: var(--primary-500);
}

.authcard__brand:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

.authcard__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 0.8125rem;
    /* White on filled brand red: correct in both themes. */
    color: #fff;
    background: linear-gradient(140deg, var(--primary-400), var(--primary-600));
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(229, 50, 45, 0.28);
}

.authcard__word strong {
    font-weight: 700;
}

.authcard__title {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--t-highlighted);
}

.authcard__lede {
    margin: 8px 0 22px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--t-muted);
}

.authcard__alt {
    margin: 20px 0 0;
    padding-top: 18px;
    font-size: 0.9375rem;
    color: var(--t-muted);
    text-align: center;
    border-top: 1px solid var(--t-border);
}

.authcard__alt a {
    font-weight: 600;
    color: var(--primary-500);
}

.authcard__alt a:hover {
    text-decoration: underline;
}

:root[data-theme="dark"] .authcard__alt a,
:root[data-theme="dark"] .authform .field__help a {
    color: var(--primary-300);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .authcard__alt a,
    :root:not([data-theme="light"]) .authform .field__help a {
        color: var(--primary-300);
    }
}

/* ------------------------------------------------------------- The form */

.authform .field {
    margin-bottom: 16px;
}

.authform .field__help {
    color: var(--t-muted);
}

.authform .field__help a {
    color: var(--primary-500);
    font-weight: 500;
}

.authform .field__help a:hover {
    text-decoration: underline;
}

.authform__note {
    display: flex;
    gap: 10px;
    margin: 4px 0 18px;
    padding: 12px 14px;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--t-muted);
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-xl);
}

.authform__note i {
    margin-top: 2px;
    color: var(--primary-500);
}

.authform__submit {
    width: 100%;
    margin-top: 8px;
}

/* Registration closed: the form has no fields at all, so the button should
   not float against the lede with a field's worth of gap above it. */
.authform--bare .authform__submit {
    margin-top: 0;
}

.field__optional {
    font-weight: 400;
    color: var(--t-dimmed);
    text-transform: none;
    letter-spacing: 0;
}

/* ------------------------------------------------ Benefits column */

/* The aside wears the same dark gradient as .vhero, in both themes, so the
   auth screens read as part of the new site rather than a leftover page. */
.authaside {
    position: relative;
    display: none;
    isolation: isolate;
    overflow: hidden;
    align-items: center;
    min-width: 0;
    padding: 56px 44px;
    background: linear-gradient(135deg, var(--hero-from), var(--hero-via) 50%, var(--hero-to));
}

.authaside::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: radial-gradient(ellipse 80% 55% at 78% -8%, var(--hero-glow), transparent);
}

.authaside::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cpath d='M60 0H0v60' fill='none' stroke='%23fff' stroke-width='.5'/%3E%3C/svg%3E");
}

.authaside__inner {
    position: relative;
    z-index: 1;
    max-width: 420px;
    margin: 0 auto;
}

.authaside__eyebrow {
    margin: 0 0 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-300);
}

.authaside__title {
    margin: 0 0 26px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--hero-ink);
}

.authaside__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.authaside__item {
    display: flex;
    gap: 14px;
    padding: 0;
}

.authaside__item + .authaside__item {
    margin-top: 22px;
}

.authaside__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
    color: var(--primary-300);
    background: rgba(229, 50, 45, 0.16);
    border: 1px solid rgba(229, 50, 45, 0.34);
    border-radius: 9px;
}

.authaside__body {
    display: block;
    min-width: 0;
}

.authaside__head {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--hero-ink);
}

.authaside__text {
    display: block;
    margin-top: 4px;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--hero-body);
}

.authaside__trust {
    display: flex;
    gap: 10px;
    margin: 30px 0 0;
    padding-top: 20px;
    font-size: 0.8125rem;
    line-height: 1.65;
    color: var(--hero-faint);
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.authaside__trust i {
    margin-top: 3px;
    color: var(--primary-400);
}

/* ---------------------------------------------------- Auth breakpoints */

@media (min-width: 900px) {
    .authpage__inner {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .authpage--solo .authpage__inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .authpage__main {
        padding: 64px 32px;
    }

    .authaside {
        display: flex;
    }
}

@media (min-width: 1200px) {
    .authpage__inner {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    }
}

/* Full-bleed card on small screens: the border and shadow only get in the
   way once the card is as wide as the viewport. */
@media (max-width: 560px) {
    .authpage__main {
        padding: 0 0 48px;
    }

    .authcard {
        max-width: none;
        padding: 30px 18px 26px;
        border-width: 0 0 1px;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ------------------------------------------------------------- Account */

.account {
    padding: 48px 0 80px;
    overflow-x: hidden;
}

.account__header {
    margin-bottom: 28px;
}

.account .account__header .minilabel {
    justify-content: flex-start;
    margin-bottom: 8px;
    color: var(--primary-500);
}

.account__title {
    margin: 0;
    font-size: clamp(1.625rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--t-highlighted);
}

.account__lede {
    margin-top: 8px;
    font-size: 0.9375rem;
    color: var(--t-muted);
}

.account__lede strong {
    font-weight: 600;
    color: var(--t-highlighted);
}

.account__grid {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.panel {
    padding: 24px;
    margin-bottom: 24px;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.3s ease;
}

.panel:hover {
    border-color: var(--t-border-strong);
}

.account__grid .panel {
    margin-bottom: 0;
}

.panel__title {
    margin: 0 0 4px;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--t-highlighted);
}

/* .band__title arrives from theme.css; only the spacing needs a nudge here. */
.account .panel__title.band__title {
    margin-bottom: 4px;
}

.panel__lede,
.panel__empty {
    margin-bottom: 18px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--t-muted);
}

.account .panel__lede.band__lede {
    margin-top: 8px;
}

.panel__empty {
    padding: 16px 18px;
    background: var(--t-elevated);
    border: 1px dashed var(--t-border-strong);
    border-radius: var(--radius-xl);
}

.panel code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    color: var(--t-highlighted);
    background: var(--t-elevated);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
}

/* Facts list inside a panel — .banlist comes from theme.css, this only tunes
   the rhythm for the narrower panel column. */
.account .panel .banlist {
    margin-top: 16px;
}

.account .panel .banlist li {
    font-size: 0.8125rem;
    color: var(--t-muted);
}

.account .panel .minilabel {
    margin-top: 4px;
}

/* One-time key display, in the terminal card from theme.css. */
.account .termcard {
    margin-top: 14px;
}

.tokenbox {
    display: block;
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--t-highlighted);
    background: var(--surface-tint);
    border: 0;
    border-radius: 0;
    white-space: pre;
    -webkit-user-select: all;
    user-select: all;
}

/* ---------------------------------------------------------- Key table */

.keytable__wrap {
    margin-bottom: 24px;
    overflow-x: auto;
    border: 1px solid var(--t-border);
    border-radius: var(--radius-xl);
}

.keytable {
    width: 100%;
    min-width: 0;
    font-size: 0.9375rem;
    border-collapse: collapse;
}

.keytable th {
    padding: 10px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--t-dimmed);
    background: var(--t-elevated);
    border-bottom: 1px solid var(--t-border);
}

.keytable td {
    padding: 13px 14px;
    color: var(--t-default);
    border-bottom: 1px solid var(--t-border);
}

.keytable tbody tr:last-child td {
    border-bottom: 0;
}

.keytable tbody tr:hover td {
    background: var(--t-elevated);
}

.keytable__label {
    font-weight: 600;
    color: var(--t-highlighted);
}

.keytable__when {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--t-muted);
}

.keytable__scopes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.keytable__scope {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    color: var(--t-muted);
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: 999px;
}

.keytable__act {
    text-align: right;
}

.keytable form {
    margin: 0;
}

.keytable code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--t-highlighted);
}

.btn--danger {
    color: var(--primary-500);
}

.btn--danger:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

:root[data-theme="dark"] .btn--danger:hover {
    color: var(--primary-300);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn--danger:hover {
        color: var(--primary-300);
    }
}

.keyform {
    padding-top: 20px;
    border-top: 1px solid var(--t-border);
}

.keyform .field {
    margin-bottom: 16px;
}

.keyform fieldset {
    padding: 0;
    margin: 0 0 16px;
    border: 0;
}

.keyform .checkbox {
    margin-right: 18px;
    color: var(--t-default);
}

.keyform__scopes {
    display: flex;
    flex-wrap: wrap;
    gap: 0 4px;
}

.nav-auth__signout {
    margin: 0;
}

@media (min-width: 760px) {
    .account__grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .keytable__wrap {
        border: 0;
        border-radius: 0;
        overflow-x: visible;
    }

    .keytable thead {
        display: none;
    }

    .keytable tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--t-border);
    }

    .keytable tbody tr:last-child {
        border-bottom: 0;
    }

    .keytable td,
    .keytable tbody tr:hover td {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        padding: 4px 0;
        background: none;
        border: 0;
    }

    .keytable__scopes,
    .keytable__act {
        justify-content: flex-end;
    }
}

@media (prefers-reduced-motion: reduce) {
    .panel {
        transition: none;
    }
}

/* ------------------------------------------------------------------ *
 * Clerk widget mount
 *
 * Only rendered when the Clerk driver is active (lib/auth_driver.php). Clerk
 * ships its own styling for the component it injects here, so this is limited
 * to giving it room, a sensible minimum height so the card does not jump when
 * the widget swaps in, and a loading line that matches our own type.
 * ------------------------------------------------------------------ */

.clerkmount {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    margin-top: 18px;
}

.clerkmount__loading {
    font-size: 14px;
    color: var(--t-muted);
}

/* Clerk renders into a nested element; let it use the full card width. */
.clerkmount > div {
    width: 100%;
}

.clerkmount .alert {
    width: 100%;
}

/* ------------------------------------------------------------------ *
 * Dashboard section nav
 *
 * The chips themselves are theme.css's .catchip, including the
 * [aria-current="page"] active state — only the row layout and a hit-area
 * large enough to tap belong here.
 * ------------------------------------------------------------------ */

.account__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin: 18px 0 26px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--t-border);
}

.account__nav .catchip {
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--t-elevated);
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.account__nav .catchip:hover {
    background: var(--t-accented);
}

.account__nav .catchip[aria-current="page"] {
    border-color: var(--brand-ring);
    background: var(--brand-tint);
}

@media (max-width: 480px) {
    .account__nav {
        gap: 6px;
    }

    .account__nav .catchip {
        padding: 6px 10px;
    }
}

/* ------------------------------------------------------------------ *
 * Clerk widget heading
 *
 * The card already provides the page <h1> ("Sign in" / "Create an account").
 * Clerk's component injects its own <h1> as well, so auth pages shipped two
 * competing top-level headings and screen-reader heading navigation landed on
 * a near-duplicate. clerk-auth.js asks Clerk to hide its header via the
 * appearance API, but the element keys are versioned and hashed, so this is
 * the belt-and-braces that does not depend on them holding.
 *
 * Safe because our own heading sits outside .clerkmount.
 * ------------------------------------------------------------------ */

.clerkmount h1 {
    display: none;
}
