/*
 * TrapGod sign in and sign up. Builds on the V3 tokens in includes/v3_marketing_surface_style.php
 * (--bg, --surface, --text, --muted, --primary, --border, per theme: dark, light, metal).
 *
 * Design read: account pages for music creators, in the TrapGod V3 green-on-ink brand,
 * ENERGY 2 / RHYTHM 1 / MOTION 1.
 * Focal point on sign up: the trapgod.net/handle field, set larger than every other field,
 * because claiming the handle is what the page is for.
 */

.tg-auth {
    /* Status colors picked per theme to clear 4.5:1 on the card surface. */
    --ok: #74c98f;
    --bad: #f4a5a5;
    --field-line: color-mix(in srgb, var(--text) 26%, transparent);
    --field-bg: color-mix(in srgb, var(--bg) 70%, var(--surface));
    --card-bg: var(--surface);
}
html[data-theme="light"] .tg-auth {
    --ok: #2b7350;
    --bad: #b42318;
    --field-line: color-mix(in srgb, var(--text) 30%, transparent);
    --field-bg: #fff;
}
html[data-theme="metal"] .tg-auth {
    --ok: #8fd3a1;
    --bad: #f4a5a5;
    --card-bg: #121216;
    --field-bg: #0b0b0e;
}

.tg-auth a,
.tg-auth button,
.tg-auth summary,
.tg-auth label[for],
.tg-auth input[type="checkbox"] { cursor: pointer; }
.tg-auth button:disabled { cursor: not-allowed; }

.auth-shell {
    padding: clamp(1.25rem, 5vw, 3.5rem) 1rem clamp(2rem, 6vw, 4rem);
}
.auth-wrap {
    width: 100%;
    max-width: 452px;
    margin: 0 auto;
}
.page-register .auth-wrap { max-width: 480px; }

.tg-auth .auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.25rem, 4.5vw, 2rem);
}

.auth-head { margin: 0 0 1.5rem; }
.tg-auth .auth-card h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.035em;
    line-height: 1.1;
}
.tg-auth .auth-sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Alerts: one region at the top of the form, filled by the server or by the page script. */
.tg-auth .auth-alert { margin: 0 0 1.25rem; line-height: 1.45; }
.tg-auth .auth-alert[hidden] { display: none; }
html[data-theme="metal"] .tg-auth .auth-alert { color: #f5b5b5; }

/* Sign-in buttons. They come from the EE button library at mixed widths and radii;
   here they share one width, height and corner so the stack reads as one group.
   Provider colors stay, since people find their provider by color. */
.tg-auth .tg-ee-sso { gap: 0.6rem; margin: 0; }
.tg-auth .tg-ee-sso .ee-btn-id-link,
.tg-auth .tg-ee-sso__form { width: 100%; }
.tg-auth .tg-ee-sso .ee-btn-id,
.tg-auth .tg-ee-sso .ogbase-sso {
    width: 100% !important;
    max-width: none;
    height: 48px;
    min-height: 48px;
    border-radius: 12px !important;
    font-size: 0.95rem;
}
.tg-auth .tg-ee-sso .ee-btn-id-link:focus-visible,
.tg-auth .tg-ee-sso .ogbase-sso:focus-visible,
.tg-auth .tg-ee-sso button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 12px;
}
.tg-auth .tg-ee-sso__msg { color: var(--bad); text-align: left; margin: 0.1rem 0 0; }

.tg-auth .auth-divider { margin: 1.5rem 0 1.25rem; font-size: 0.82rem; }

/* Fields */
.field { margin: 0 0 1.1rem; }
.field-label-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    margin: 0 0 0.4rem;
}
.field label,
.field-label {
    display: block;
    font-size: 0.875rem; font-weight: 600; color: var(--text);
}
.field-label-row label { margin: 0; }
.field-label-row a { font-size: 0.85rem; }
.field-hint { margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }

.field-input,
.tg-auth .field input[type="text"],
.tg-auth .field input[type="email"],
.tg-auth .field input[type="password"],
.tg-auth .field input[type="date"] {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 0.9rem;
    border: 1px solid var(--field-line);
    border-radius: var(--radius-sm);
    background: var(--field-bg);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    color-scheme: dark;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
html[data-theme="light"] .tg-auth .field input { color-scheme: light; }
.tg-auth .field input:hover { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
.tg-auth .field input:focus,
.tg-auth .field input:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}
.tg-auth .field input[aria-invalid="true"] { border-color: var(--bad); }

/* Password with a Show button inside the field */
.pw-wrap { position: relative; }
.tg-auth .pw-wrap input { padding-right: 4.75rem; }
.pw-toggle {
    position: absolute; top: 2px; right: 2px; bottom: 2px;
    min-width: 44px; padding: 0 0.85rem;
    border: 0; border-radius: 10px;
    background: transparent; color: var(--muted);
    font: inherit; font-size: 0.85rem; font-weight: 600;
}
.pw-toggle:hover { color: var(--text); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pw-toggle:active { background: color-mix(in srgb, var(--primary) 22%, transparent); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* The handle field: the page's one big element. "trapgod.net/" sits inside the box so the
   person reads the address they're claiming as they type. */
.handle-field .field-label { font-size: 0.95rem; }
.handle-box {
    display: flex; align-items: center;
    min-height: 60px;
    border: 1px solid var(--field-line);
    border-radius: 14px;
    background: var(--field-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.handle-box:hover { border-color: color-mix(in srgb, var(--text) 45%, transparent); }
.handle-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
}
.handle-box[data-state="ok"] { border-color: var(--ok); }
.handle-box[data-state="bad"] { border-color: var(--bad); }
.handle-prefix {
    flex: none;
    padding-left: 1rem;
    color: var(--muted);
    font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em;
    user-select: none;
}
.tg-auth .field .handle-box input[type="text"] {
    flex: 1; min-width: 0; width: 100%;
    height: 58px; padding: 0 1rem 0 0.05rem;
    border: 0; background: transparent; color: var(--text);
    font: inherit; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em;
}
.tg-auth .field .handle-box input[type="text"]:focus,
.tg-auth .field .handle-box input[type="text"]:hover { outline: none; box-shadow: none; border: 0; }
.tg-auth .handle-box input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); font-weight: 600; }

.handle-status {
    display: flex; align-items: flex-start; gap: 0.45rem;
    min-height: 1.4rem;
    margin: 0.5rem 0 0;
    font-size: 0.875rem; line-height: 1.4; color: var(--muted);
}
.handle-status[data-kind="ok"] { color: var(--ok); }
.handle-status[data-kind="bad"] { color: var(--bad); }
.handle-status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.handle-status__icon { flex: none; width: 1rem; height: 1rem; margin-top: 0.12rem; }
.handle-status button {
    margin-left: 0.25rem; padding: 0.1rem 0.5rem; min-height: 28px;
    border: 1px solid currentColor; border-radius: 8px;
    background: transparent; color: inherit; font: inherit; font-size: 0.82rem; font-weight: 600;
}
.handle-status button:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.handle-status button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.handle-spinner {
    flex: none; width: 0.9rem; height: 0.9rem; margin-top: 0.2rem;
    border: 2px solid color-mix(in srgb, var(--muted) 40%, transparent);
    border-top-color: var(--muted);
    border-radius: 50%;
    animation: tg-auth-spin 0.7s linear infinite;
}
@keyframes tg-auth-spin { to { transform: rotate(360deg); } }

/* Two short fields side by side once there's room */
.field-pair { display: grid; gap: 0 1rem; }
@media (min-width: 520px) {
    .page-register .field-pair { grid-template-columns: 1fr 1fr; }
}

/* Referral code: tucked away unless the link carried one */
.referral { margin: 0 0 1.1rem; }
.referral summary {
    display: inline-flex; align-items: center; min-height: 44px;
    color: var(--primary); font-size: 0.9rem; font-weight: 600;
    list-style: none;
}
.referral summary::-webkit-details-marker { display: none; }
.referral summary::after { content: "+"; margin-left: 0.4rem; font-weight: 700; }
.referral[open] summary::after { content: "\2212"; }
.referral summary:hover { text-decoration: underline; }
.referral summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.referral .field { margin: 0.25rem 0 0; }
.tg-auth .referral input { text-transform: uppercase; letter-spacing: 0.08em; }
.referral-applied { color: var(--ok); }

/* Checkboxes: the whole row is the label, so the tap target is the full line */
.check-row {
    display: flex; align-items: flex-start; gap: 0.65rem;
    margin: 0 0 0.5rem; padding: 0.45rem 0;
    font-size: 0.875rem; line-height: 1.45; color: var(--muted);
}
.check-row input {
    flex: none; width: 1.15rem; height: 1.15rem; margin: 0.1rem 0 0;
    accent-color: var(--primary);
}
.check-row input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.check-row a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

.tg-auth button.auth-submit {
    width: 100%; height: 50px; margin-top: 0.75rem;
    font-size: 1rem; font-weight: 700; border-radius: 12px;
}
.tg-auth button.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.tg-auth button.auth-submit:disabled { opacity: 0.6; }
html[data-theme="metal"] .tg-auth button.auth-submit:hover { background: #c8c8cc; }

.auth-foot {
    margin: 1.5rem 0 0; padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--muted); font-size: 0.92rem;
}
.auth-foot p { margin: 0; }
.auth-foot a { font-weight: 600; }

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

@media (max-width: 420px) {
    .auth-shell { padding-left: 0.75rem; padding-right: 0.75rem; }
    .handle-prefix, .tg-auth .field .handle-box input[type="text"] { font-size: 1.02rem; }
    .handle-prefix { padding-left: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    .handle-spinner { animation-duration: 2.4s; }
    .tg-auth *, .tg-auth *::before, .tg-auth *::after { transition: none !important; }
    .tg-auth button.auth-submit:active:not(:disabled) { transform: none; }
}

/* Light theme: the brand green (#589F6F) is 3.3:1 on white, under the 4.5:1 small text needs.
   Links, the referral toggle and filled buttons use the darker brand green (#307858, 5.6:1). */
html[data-theme="light"] .tg-auth .auth-card a,
html[data-theme="light"] .tg-auth .referral summary { color: var(--primary-dark); }
html[data-theme="light"] .tg-auth a.btn-primary,
html[data-theme="light"] .tg-auth button.btn-primary { background: var(--primary-dark); color: #fff; }
html[data-theme="light"] .tg-auth a.btn-primary:hover,
html[data-theme="light"] .tg-auth button.btn-primary:hover { background: #255f45; color: #fff; }

/* Forgot password and two-step sign in */
.auth-note {
    margin: 0 0 1.25rem; padding: 0.75rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--ok) 10%, transparent);
    color: var(--text); font-size: 0.9rem; line-height: 1.45;
}
/* Codes are read digit by digit, so they get room and spacing. */
.tg-auth .field input.code-input {
    height: 56px;
    font-size: 1.35rem; font-weight: 700;
    letter-spacing: 0.3em;
    font-variant-numeric: tabular-nums;
}
.tg-auth a.btn.auth-submit { display: flex; width: 100%; height: 50px; margin-top: 0.5rem; font-size: 1rem; font-weight: 700; }
.auth-foot p + p { margin-top: 0.5rem; }

/* Sign up from a profile's join button: who invited them, and a create button that stays above the keyboard */
.tg-auth .auth-invite { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.95rem; }
.tg-auth .auth-invite a { color: var(--text); font-weight: 700; text-decoration: none; }
.tg-auth .auth-invite a:hover, .tg-auth .auth-invite a:focus-visible { text-decoration: underline; }
.tg-auth .auth-go { position: sticky; bottom: calc(var(--kb, 0px) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 3; }
.tg-auth .auth-go button.auth-submit { box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.9); }

/* Redo (Nov 15 2026): the logo's voice on sign in and sign up. Wide heavy display for the heading,
   mono for the trapgod.net/ handle (it reads as an address), pill controls like the logo's round caps,
   and a trace-and-pad rule on top of the card. Tokens only (v3-marketing-surface.css, tg-site.css). */
.tg-auth .auth-card h1 { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; letter-spacing: -0.02em; }
.tg-auth .auth-card { position: relative; overflow: hidden; }
.tg-auth .auth-card::before {
    content: ""; position: absolute; left: clamp(1.25rem, 4.5vw, 2rem); top: 0; width: 72px; height: 3px;
    border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--tgs-deep), var(--tgs-mint));
}
.handle-prefix { font-family: var(--font-mono); font-weight: 500; }
.tg-auth .field .handle-box input[type="text"] { font-family: var(--font-mono); }
.tg-auth button.auth-submit { border-radius: 999px; min-height: 48px; }
.tg-auth .auth-shell { padding-top: clamp(1.5rem, 6vw, 4rem); }
@media (min-width: 768px) and (max-width: 1179px) {
    /* Tablet: the card sits a little lower and wider instead of a stretched phone column. */
    .auth-wrap { max-width: 500px; }
    .page-register .auth-wrap { max-width: 540px; }
}
