/* Account UI. One local stylesheet and no JavaScript preserve the account
   origin's default-src 'self'; script-src 'none' content security policy. */

:root {
    color-scheme: light;
    --night: #17181d;
    --night-soft: #25262d;
    --paper: #f7f2e8;
    --paper-deep: #eee5d5;
    --panel: #fffcf7;
    --ink: #26231e;
    --ink-soft: #686158;
    --line: #d7cbb9;
    --accent: #704717;
    --accent-hover: #57340f;
    --accent-ink: #ffffff;
    --danger: #8b332b;
    --danger-bg: #f7e9e6;
    --ok: #316746;
    --ok-bg: #e7f0e8;
    --warn: #765614;
    --warn-bg: #f5edd7;
    --info: #315c7d;
    --info-bg: #e8f0f6;
    --focus: #1769aa;
    --shadow: 0 22px 60px rgba(10, 11, 14, 0.2);
}

* { box-sizing: border-box; }

html {
    min-width: 20rem;
    background: var(--night);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 15% 5%, rgba(154, 103, 37, 0.15), transparent 24rem),
        linear-gradient(145deg, #15161b, var(--night-soft) 60%, var(--night));
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system,
                 BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 17px;
    line-height: 1.55;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

button, input { font: inherit; }

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

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    transform: translateY(-200%);
    border-radius: 0.35rem;
    padding: 0.65rem 0.9rem;
    background: #ffffff;
    color: #111111;
    font-weight: 700;
}

.skip-link:focus { transform: none; }

/* --- shell -------------------------------------------------------------- */

.shell {
    width: min(100% - 2rem, 72rem);
    margin: 0 auto;
    padding: 1.5rem 0 2.5rem;
}

.topbar {
    display: flex;
    min-height: 4rem;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    color: #f4efe5;
}

.brand {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid #bd8a42;
    border-radius: 50%;
    color: #e1b872;
    font-family: system-ui, sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    align-items: center;
}

.nav a,
.linkish {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    color: #ddd6ca;
    font-size: 0.9rem;
}

.nav a[aria-current="page"] {
    color: #ffffff;
    font-weight: 750;
    text-decoration-thickness: 2px;
}

.page-frame {
    min-height: 32rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.15rem;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.page-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.72fr);
}

.page-content {
    min-width: 0;
    padding: clamp(2rem, 6vw, 4.75rem);
}

.story-aside {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 32rem;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(2rem, 5vw, 3.5rem);
    border-radius: 0 1.15rem 1.15rem 0;
    background:
        linear-gradient(180deg, transparent, rgba(10, 10, 13, 0.8)),
        radial-gradient(circle at 75% 25%, rgba(202, 147, 64, 0.28), transparent 12rem),
        #292a31;
    color: #f6efe3;
}

.story-aside::before {
    position: absolute;
    inset: 1.25rem;
    border: 1px solid rgba(224, 183, 113, 0.28);
    border-radius: 50% 50% 1rem 1rem;
    content: "";
    pointer-events: none;
}

.aside-copy {
    position: relative;
    z-index: 1;
    max-width: 24rem;
}

.story-aside h2 {
    margin: 0 0 0.75rem;
    color: inherit;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 500;
    line-height: 1.15;
}

.story-aside p { color: #cfc7ba; }

.foot {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 0 0;
    color: #aaa398;
    font-size: 0.82rem;
}

.foot p { margin: 0; }

/* --- type --------------------------------------------------------------- */

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; }

h1 {
    max-width: 18ch;
    margin-bottom: 0.7rem;
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 0.55rem;
    font-size: 1.3rem;
    line-height: 1.25;
}

h3 {
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
}

p { margin-bottom: 0.9rem; }

.eyebrow,
.aside-kicker {
    margin: 0 0 0.55rem;
    color: var(--accent);
    font-family: system-ui, sans-serif;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.aside-kicker { color: #e2b971 !important; }

.lede {
    max-width: 42rem;
    margin-bottom: 1.75rem;
    color: var(--ink-soft);
    font-size: 1.08rem;
}

.fine,
.field-help {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.field-help {
    display: block;
    margin: -0.15rem 0 0.7rem;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}

ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin-bottom: 0.5rem; }

/* --- notices, cards, and progress -------------------------------------- */

.notice {
    margin: 0 0 1.5rem;
    border: 1px solid #b8ccdc;
    border-left: 4px solid var(--info);
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
    background: var(--info-bg);
    color: #244d69;
}

.notice-success {
    border-color: #b8d0bd;
    border-left-color: var(--ok);
    background: var(--ok-bg);
    color: var(--ok);
}

.notice-warning {
    border-color: #d8c897;
    border-left-color: var(--warn);
    background: var(--warn-bg);
    color: var(--warn);
}

.notice-error {
    border-color: #deb7b2;
    border-left-color: var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
}

.card,
.form-card {
    max-width: 46rem;
    margin: 0 0 1.25rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    padding: 1.3rem;
    background: rgba(255, 255, 255, 0.55);
}

.form-card {
    padding: 1.5rem;
    background: var(--panel);
}

.card-accent { border-left: 4px solid var(--accent); }

.card.danger,
.card-danger {
    border-color: #c9968f;
    background: #fff8f6;
}

.status-row,
.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
}

.status-row:first-child,
.summary-row:first-child { padding-top: 0; }

.status-row:last-child,
.summary-row:last-child { border-bottom: 0; }

.status-copy { min-width: 0; }
.status-copy p, .summary-row p { margin-bottom: 0; }

.badge {
    display: inline-flex;
    min-height: 1.75rem;
    flex: 0 0 auto;
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    color: var(--ok);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge-active, .badge-invited, .badge-running,
.badge-verified { color: var(--ok); }
/* Warning rather than danger: an unconfirmed key may well be perfectly good,
   with the provider merely unreachable when we asked. Red would claim more
   than we know. */
.badge-none, .badge-absent, .badge-stopped,
.badge-provisioning, .badge-creating, .badge-past_due,
.badge-unverified,
.badge-pending { color: var(--warn); }
.badge-revoked, .badge-unpaid, .badge-canceled,
.badge-error { color: var(--danger); }

.steps {
    display: flex;
    gap: 0.45rem;
    margin: 0 0 1.75rem;
    padding: 0;
    list-style: none;
}

.steps li {
    width: 100%;
    margin: 0;
    border-top: 3px solid var(--line);
    padding-top: 0.45rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
}

.steps .done,
.steps .current {
    border-color: var(--accent);
    color: var(--ink);
}

.steps .current { font-weight: 800; }

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

.keylist li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    align-items: baseline;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.provider-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.provider-choice a {
    min-height: 5rem;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    padding: 0.9rem;
    background: #ffffff;
    color: var(--ink);
    text-decoration: none;
}

.provider-choice a[aria-current="true"] {
    border: 2px solid var(--accent);
    background: #fffaf1;
}

.provider-choice strong,
.provider-choice span { display: block; }

.provider-choice span {
    margin-top: 0.2rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 1.2rem;
}

.trust-grid div {
    border-top: 1px solid var(--line);
    padding-top: 0.7rem;
}

.trust-grid strong,
.trust-grid span { display: block; }

.trust-grid span {
    margin-top: 0.2rem;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

/* --- signed-in product home -------------------------------------------- */

.product-home .page-content {
    padding: clamp(1rem, 3vw, 2.1rem);
}

.home-hero {
    position: relative;
    display: grid;
    min-height: 27rem;
    overflow: hidden;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.42fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 4rem);
    border-radius: 0.9rem;
    padding: clamp(2rem, 6vw, 4.75rem);
    background:
        radial-gradient(circle at 78% 44%, rgba(214, 159, 76, 0.19), transparent 13rem),
        linear-gradient(145deg, #22232a, #15161a 70%);
    color: #f7f0e4;
}

.home-hero::after {
    position: absolute;
    right: -7rem;
    bottom: -12rem;
    width: 28rem;
    height: 28rem;
    border: 1px solid rgba(221, 176, 102, 0.13);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.home-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 40rem;
}

.home-kicker,
.home-panel-kicker {
    margin: 0 0 0.55rem;
    color: #ddb066;
    font-family: system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.home-hero h1 {
    max-width: 13ch;
    margin-bottom: 1rem;
    color: #fffaf0;
    font-size: clamp(2.5rem, 6vw, 4.8rem);
}

.home-lede {
    max-width: 38rem;
    margin-bottom: 1.75rem;
    color: #d9d0c3;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.home-play-form,
.home-action { margin: 0; }

.home-play-button {
    display: inline-flex;
    min-height: 3.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border: 1px solid #d2a65f;
    border-radius: 0.45rem;
    padding: 0.8rem 1rem 0.8rem 1.25rem;
    background: #c28a35;
    color: #17140f;
    font-weight: 850;
    text-decoration: none;
    box-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.24);
}

.home-play-button:hover {
    border-color: #f0c57e;
    background: #d9a552;
}

.home-button-mark {
    font-size: 1.4rem;
    line-height: 1;
}

.home-hero-note {
    margin: 0.75rem 0 0;
    color: #ada69c;
    font-size: 0.82rem;
}

.home-pending-status {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid rgba(225, 185, 114, 0.38);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    color: #e9dbc4;
    font-weight: 750;
}

.home-status-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #d5a050;
}

.home-sigil {
    position: relative;
    z-index: 1;
    display: grid;
    width: clamp(10rem, 20vw, 15rem);
    aspect-ratio: 1;
    place-items: center;
    justify-self: center;
    border: 1px solid rgba(226, 183, 113, 0.43);
    border-radius: 50%;
    color: #ddb066;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 8vw, 5.5rem);
}

.home-sigil::before,
.home-sigil::after,
.home-sigil-ring {
    position: absolute;
    border: 1px solid rgba(226, 183, 113, 0.22);
    border-radius: 50%;
    content: "";
}

.home-sigil::before { inset: 0.7rem; }
.home-sigil::after { inset: 2rem; }
.home-sigil-ring { inset: -0.65rem; }

.home-sigil-flame {
    position: relative;
    z-index: 1;
}

.home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(16rem, 0.82fr);
    gap: 1rem;
    margin-top: 1rem;
}

.home-panel,
.home-provider,
.home-account {
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.52);
}

.home-panel { padding: clamp(1.25rem, 3vw, 1.8rem); }

.home-panel-kicker { color: var(--accent); }

.home-panel-heading,
.home-section-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.home-panel-heading h2,
.home-section-heading h2,
.home-account h2 {
    margin-bottom: 0.65rem;
    font-size: clamp(1.35rem, 3vw, 1.7rem);
}

.home-account h2 { overflow-wrap: anywhere; }

.home-panel > p:last-child { margin-bottom: 0; }

.home-model {
    background:
        linear-gradient(135deg, rgba(112, 71, 23, 0.045), transparent 65%),
        rgba(255, 255, 255, 0.42);
}

.home-state {
    display: inline-flex;
    min-height: 1.75rem;
    flex: 0 0 auto;
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0.18rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
}

.home-state-ready { color: var(--ok); }
.home-state-waiting,
.home-state-future { color: var(--warn); }
.home-state-attention { color: var(--danger); }

.home-meta,
.home-key-tail {
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.home-provider {
    margin-top: 1rem;
    padding: clamp(1.25rem, 3vw, 1.8rem);
}

.home-section-heading {
    align-items: center;
    margin-bottom: 1rem;
}

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

.home-provider-list li {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    margin: 0;
    border-top: 1px solid var(--line);
    padding: 1rem 0;
}

.home-provider-list strong,
.home-provider-list span { display: block; }

.home-key-state {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-end;
    text-align: right;
}

.home-empty-state {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.home-empty-state p { margin: 0; }

.home-account {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem 2rem;
    align-items: start;
    margin-top: 1rem;
    padding: 1.2rem 1.4rem;
    background: transparent;
}

.home-account-copy p:last-child { margin-bottom: 0; }

.home-account-status { justify-self: end; }

.home-account-actions {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

/* --- forms and controls ------------------------------------------------ */

.field { margin-bottom: 1.15rem; }

label,
.field-label {
    display: block;
    margin: 0 0 0.4rem;
    font-weight: 750;
}

input[type="email"],
input[type="text"],
input[type="password"] {
    display: block;
    width: 100%;
    min-height: 3rem;
    border: 1px solid #aa9f90;
    border-radius: 0.42rem;
    padding: 0.7rem 0.8rem;
    background: #ffffff;
    color: var(--ink);
}

input:hover { border-color: #70675d; }

.code-input {
    max-width: 18rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

button,
.button {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #a69a88;
    border-radius: 0.42rem;
    padding: 0.65rem 1rem;
    background: #fffaf1;
    color: var(--ink);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

button:hover, .button:hover {
    border-color: var(--accent);
    background: #ffffff;
}

.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
}

.primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
}

.destructive {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
}

.linkish {
    border: 0;
    padding: 0;
    background: transparent;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.linkish:hover { background: transparent; }

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.plain-link {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    padding: 0 0.2rem;
    font-weight: 650;
}

.inline { display: inline; }
.mt { margin-top: 0.75rem; }
.mb-0 { margin-bottom: 0; }

/* --- narrow screens and user preferences ------------------------------- */

@media (max-width: 760px) {
    .shell {
        width: min(100% - 1rem, 44rem);
        padding-top: 0.5rem;
    }

    .topbar { align-items: flex-start; }

    .nav { gap: 0.25rem 0.65rem; }

    .page-split { display: block; }

    .page-content { padding: 1.5rem 1rem 2rem; }

    .story-aside {
        min-height: 15rem;
        padding: 2rem 1.25rem;
        border-radius: 0 0 1.15rem 1.15rem;
    }

    .story-aside::before { inset: 0.8rem; }

    .provider-choice,
    .trust-grid { grid-template-columns: 1fr; }

    .home-hero {
        min-height: 0;
        grid-template-columns: 1fr;
        padding: 2.25rem 1.25rem;
    }

    .home-sigil {
        position: absolute;
        right: -2.5rem;
        bottom: -3.5rem;
        width: 10rem;
        opacity: 0.28;
    }

    .home-hero-copy { max-width: calc(100% - 1rem); }

    .home-layout { grid-template-columns: 1fr; }

    .home-provider-list li,
    .home-empty-state {
        align-items: flex-start;
        flex-direction: column;
    }

    .home-key-state {
        align-items: flex-start;
        text-align: left;
    }

    .home-account { grid-template-columns: 1fr; }

    .home-account-status { justify-self: start; }

    .status-row,
    .summary-row { display: block; }

    .status-row .badge { margin-top: 0.55rem; }

    .button-row > button,
    .button-row > .button { width: 100%; }

    .foot { display: block; }
    .foot p + p { margin-top: 0.35rem; }
}

@media (max-width: 380px) {
    .brand-mark { display: none; }
    .nav { width: 100%; justify-content: space-between; }
    .steps { display: block; }
    .steps li { margin-bottom: 0.5rem; }

    .product-home .page-content { padding: 0.5rem; }

    .home-hero { padding: 1.75rem 1rem; }

    .home-panel-heading,
    .home-section-heading { display: block; }

    .home-panel-heading .home-state { margin-bottom: 0.75rem; }

    .home-section-heading > a {
        display: inline-flex;
        min-height: 2.75rem;
        align-items: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (forced-colors: active) {
    .page-frame, .card, .form-card, .notice,
    .provider-choice a { border: 1px solid CanvasText; }
}
