/*
 * store-account.thresholdx.net — B2C account page (#985, spec #833)
 *
 * Design doctrine: threshold-documents/doctrine/design/
 *   - No borders (2026-07-03 ruling): tone separates, not lines.
 *   - Radii ladder: 8px buttons/cards, 10px large panels, 12px modals, 4px tags.
 *   - Lapis is the CTA/interactive accent; Threshold Blue is the canvas.
 *   - Basier Circle self-hosted (customer-facing web surface).
 *   - Focus rings stay (accessibility floor). Reduced motion respected.
 */

@font-face {
    font-family: 'Basier Circle';
    src: url('../fonts/basier-circle-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Basier Circle';
    src: url('../fonts/basier-circle-medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Basier Circle';
    src: url('../fonts/basier-circle-semibold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Basier Circle';
    src: url('../fonts/basier-circle-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: var(--thx-color-threshold-blue);
    --surface: #06203d;          /* card tint against the canvas — tone, not line */
    --surface-raised: #0a2b4e;   /* hover / raised tone */
    --fg: var(--thx-color-white);
    --fg-dim: #9db4cc;
    --fg-faint: #6d86a0;
    --accent: var(--thx-color-lapis);
    --accent-soft: rgba(0, 116, 255, 0.14);
    --ok: var(--thx-color-green-500);
    --warn: var(--thx-color-yellow-500);
    --danger: var(--thx-color-crimson);
    --radius-button: 8px;
    --radius-card: 8px;
    --radius-panel: 10px;
    --radius-modal: 12px;
    --radius-tag: 4px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Basier Circle', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-button);
    z-index: 10;
}
.skip-link:focus { left: 12px; top: 12px; }

.hidden { display: none !important; }
.dim { color: var(--fg-dim); }

/* ─── Header / footer ──────────────────────────────────────────── */

.site-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px clamp(20px, 5vw, 48px);
}

.brand { display: flex; align-items: baseline; gap: 10px; flex: 1; }

/* Piano keys — the runway-threshold brand mark, drawn with tone */
.brand-keys {
    display: inline-flex;
    gap: 3px;
    align-self: center;
}
.brand-keys i {
    width: 5px;
    height: 18px;
    background: var(--fg);
    border-radius: 1px;
    display: inline-block;
}
.brand-keys i:nth-child(even) { background: var(--accent); }

.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.brand-sub  { color: var(--fg-dim); font-size: 14px; }

.site-footer {
    margin-top: auto;
    padding: 40px clamp(20px, 5vw, 48px) 28px;
    color: var(--fg-faint);
    font-size: 13px;
}
.site-footer a { color: var(--fg-dim); }

/* ─── Layout ───────────────────────────────────────────────────── */

main {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: clamp(12px, 4vh, 40px) 20px 20px;
    flex: 1;
}

.center-card {
    background: var(--surface);
    border-radius: var(--radius-panel);
    padding: clamp(28px, 5vw, 44px);
    max-width: 560px;
    margin: 6vh auto 0;
}

h1 { font-size: clamp(24px, 4vw, 30px); font-weight: 700; margin: 0 0 10px; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.lede { color: var(--fg-dim); margin: 0 0 22px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Form ─────────────────────────────────────────────────────── */

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-dim);
    margin-bottom: 6px;
}

.field-row { display: flex; gap: 10px; flex-wrap: wrap; }

input[type="email"] {
    flex: 1;
    min-width: 220px;
    background: var(--bg);
    color: var(--fg);
    border: none;                     /* tone separates — no outline */
    border-radius: var(--radius-button);
    padding: 12px 14px;
    font: inherit;
}
input[type="email"]::placeholder { color: var(--fg-faint); }

.field-hint { min-height: 1.2em; font-size: 13px; color: var(--warn); margin: 10px 0 0; }

/* ─── Buttons (fill + radius carry the affordance; no borders) ─── */

.btn {
    border: none;
    border-radius: var(--radius-button);
    font: inherit;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    background: var(--surface-raised);
    color: var(--fg);
    transition: background-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: #123a63; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #1a83ff; }
.btn.ghost { background: transparent; color: var(--fg-dim); }
.btn.ghost:hover { background: var(--surface); color: var(--fg); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

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

/* ─── Purchases list ───────────────────────────────────────────── */

.page-head { margin: 0 0 18px; }
.page-head .lede { margin-bottom: 0; }

.purchase-list { display: flex; flex-direction: column; gap: 12px; }

.purchase {
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 18px 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
}

.purchase-main { flex: 1; min-width: 220px; }
.purchase-name { font-weight: 600; font-size: 17px; }
.purchase-meta { color: var(--fg-dim); font-size: 13px; margin-top: 2px; }

.purchase-qty {
    background: var(--accent-soft);
    color: var(--thx-color-sky);
    border-radius: var(--radius-tag);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    margin-left: 8px;
}

.purchase-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Revealed key row */
.key-row {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: var(--radius-button);
    padding: 10px 14px;
}
.key-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0.04em;
    word-break: break-all;
    flex: 1;
}

/* ─── Themed dialog + toast (doctrine: never native) ───────────── */

.thx-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 8, 17, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.thx-dialog {
    background: var(--surface);
    border-radius: var(--radius-modal);
    padding: 26px 28px;
    max-width: 420px;
    width: 100%;
}
.thx-dialog h2 { margin-bottom: 10px; }
.thx-dialog p { color: var(--fg-dim); margin: 0 0 20px; }
.thx-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.thx-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-raised);
    color: var(--fg);
    border-radius: var(--radius-button);
    padding: 12px 20px;
    font-size: 14px;
    z-index: 110;
    animation: thx-toast-in 0.18s ease;
}
.thx-toast.ok    { background: #0d4d2b; }
.thx-toast.error { background: #5c1020; }

@keyframes thx-toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Reduced motion (doctrine) ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
