﻿:root {
    --ink: #1a1714;
    --paper: #faf6f0;
    --line: #e0d7ca;
    --muted: #6b6259;
    --accent: #e2563c;
    --accent-press: #c4452e;
    /* Default near-black; a theme with an accent replaces it with the accent's darkest shade (ThemeColors). */
    --header: #212529;
    --page: var(--paper);
    --field-bg: #fff;
    --radius: 10px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

.site-header {
    background: var(--header);
}

.site-header__inner {
    /* No max-width or auto margins, so the logo stays left-aligned instead
       of being centred in a content column. Padding insets it from the top
       and left edges rather than sitting hard against them. */
    padding: .75rem 1.25rem;
}

.site-header__brand {
    display: inline-flex;
    text-decoration: none;
}

.site-header__logo {
    height: 34px;
    display: block;
}

/* Text brand, used when the host has no logo. Same height as the logo. */
.site-header__name {
    color: #fff;
    font: 600 1.25rem/34px var(--font);
    letter-spacing: .01em;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent) 12%, var(--page)) 0, transparent 45%),
        var(--page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
}

.card {
    width: 100%;
    max-width: 380px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
    box-shadow: 0 1px 0 #fff inset, 0 18px 40px -28px rgba(40, 30, 20, .5);
}

.card__head { margin-bottom: 1.75rem; }

.eyebrow {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
}

.card__head h1 {
    font-size: 1.7rem;
    margin: .55rem 0 .25rem;
    letter-spacing: -.02em;
}

.sub { margin: 0; color: var(--muted); font-size: .92rem; }

.form { display: grid; gap: 8px; }

.field { display: grid; gap: .4rem; }

.field > span:first-child {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink);
}

.field input,
.field textarea {
    font: inherit;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--field-bg);
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    color: var(--muted);
}

.btn {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 6px;
    margin-top: .25rem;
    border: none;
    border-radius: 8px;
    color: #fff;
    background: var(--accent);
    transition: background .15s, box-shadow .15s, transform .05s;
}

/* Hover: the darker shade plus a soft ring, so it's obvious beyond the cursor. */
.btn:hover { background: var(--accent-press); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

/* Submitted and waiting for the server (js/forms.js): spinner before the busy text. */
.btn.is-busy, .link.is-busy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    cursor: progress;
}
.btn.is-busy::before, .link.is-busy::before {
    content: "";
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin .7s linear infinite;
    flex: none;
}
.btn:disabled { cursor: progress; opacity: .85; }
.btn:disabled:hover { background: var(--accent); box-shadow: none; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .btn.is-busy::before, .link.is-busy::before { animation-duration: 2s; }
}

.card__foot {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: .88rem;
}

.card__foot a { color: var(--accent); text-decoration: none; font-weight: 500; }
.card__foot a:hover { text-decoration: underline; }

/* A form button that reads like the footer links (for POST actions such as resending a code). */
.card__foot form { margin: 0; }
.card__foot .link, .plan__actions .link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 500; cursor: pointer; }
.card__foot .link:hover, .plan__actions .link:hover { text-decoration: underline; }

.form__errors, .field__error { color: var(--accent-press); font-size: .82rem; }
.form__errors:empty { display: none; }

/* Requirements stated before submission, not after a rejection. */
.field textarea { resize: vertical; min-height: 5.5rem; }

.field__optional { color: var(--muted); font-style: normal; font-weight: 400; }

.field__hint { color: var(--muted); font-size: .78rem; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* The footer can now hold more than one link (reset password, and in Open mode
   "create an account"). Flex with a gap so they don't run together, and wrap on a
   narrow viewport rather than overflowing the card. */
.card__foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem 1.25rem;
}

/* Confirmation shown on the login page after a completed password reset. */
.status {
    margin: 0 0 1.25rem;
    padding: .75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .03);
    font-size: .88rem;
}

/* Wider card for longer forms (registration). */
.card--wide { max-width: 580px; }

/* Label beside its input, labels in one column so the inputs line up. Hints, errors and the
   CAPTCHA sit under the input. Stacks again on a narrow screen. */
.form--aligned .field {
    grid-template-columns: 11rem 1fr;
    column-gap: 1rem;
    align-items: center;
}
.form--aligned .field > :not(:first-child) { grid-column: 2; }
.form--aligned .field--top { align-items: start; }
.form--aligned .field--top > span:first-child { padding-top: 4px; }
.form--aligned .field__optional { display: block; }
.form--aligned .cf-turnstile { margin-left: 12rem; }

/* ---------------------------------------------------------------------------
   Profile page: who's signed in, their plan, their details, then what to do next.
   State colours: --ok for active access, the accent for a trial and for an ended one,
   --warn for the badge of access that ends soon.
   --------------------------------------------------------------------------- */
.profile { --ok: #2b7a4b; --warn: #9a5b00; padding-top: 2rem; }

.profile__head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.profile__who { min-width: 0; }
.profile__who .eyebrow { margin: 0; }
.profile__name { margin: .2rem 0 .15rem; font-size: 1.55rem; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.profile__who .sub { overflow-wrap: anywhere; }

/* Initials in a circle; the accent's tint so it follows the product's theme. */
.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 14%, var(--field-bg));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
    color: var(--accent-press);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .02em;
}

.section-title {
    margin: 0 0 .6rem;
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* The plan: a panel with a coloured edge that says at a glance where access stands. */
.plan {
    --state: var(--accent);
    margin: 0 0 1.75rem;
    padding: 1.1rem 1.2rem 1.2rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--state);
    border-radius: 8px;
    background: var(--field-bg);
    box-shadow: 0 10px 24px -20px rgba(40, 30, 20, .45);
}
.plan--active { --state: var(--ok); }
.plan--expired {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    border-left-color: var(--state);
    background: color-mix(in srgb, var(--accent) 6%, var(--field-bg));
}
.plan__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.plan__label { margin: 0; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.plan__name { margin: .15rem 0 0; font-size: 1.2rem; letter-spacing: -.01em; }
.plan__detail { margin: .45rem 0 0; color: var(--muted); font-size: .88rem; }
.plan__note { margin: .9rem 0 0; font-size: .92rem; line-height: 1.45; }
.plan__note a { color: var(--accent); }

/* Days left in the trial. Native <progress>: its value is an attribute, which the CSP allows. */
.plan__progress {
    appearance: none;
    display: block;
    width: 100%;
    height: 6px;
    margin-top: .8rem;
    border: 0;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
.plan__progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.plan__progress::-webkit-progress-value { background: var(--state); border-radius: 999px; }
.plan__progress::-moz-progress-bar { background: var(--state); border-radius: 999px; }

.plan__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.1rem; }
.plan__actions form { margin: 0; }

.badge {
    flex: none;
    font-family: var(--mono);
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
}
.badge--active { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge--expiring { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge--expired { color: var(--accent-press); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Details: label/value rows in one bordered list, like a settings page. */
.summary {
    display: grid;
    grid-template-columns: 9rem 1fr;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--field-bg);
    font-size: .92rem;
    overflow: hidden;
}
/* One line height for both, so a smaller label sits level with its value. */
.summary dt, .summary dd { margin: 0; padding: .7rem .95rem; line-height: 1.45rem; border-top: 1px solid var(--line); }
.summary dt:first-of-type, .summary dd:first-of-type { border-top: 0; }
.summary dt { color: var(--muted); font-size: .82rem; font-weight: 600; }
.summary dd { overflow-wrap: anywhere; }

/* What to do next: the application (while there's access), then sign out. */
.profile__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.profile__actions form { margin: 0 0 0 auto; }

/* Buttons sized to their text here, rather than the forms' full width; links can look like them too. */
.profile .btn { margin-top: 0; padding: 8px 18px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn--secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--secondary:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); box-shadow: none; }
.btn--secondary:disabled:hover { background: transparent; }

@media (max-width: 560px) {
    .profile { padding: 1.75rem 1.25rem; }
    .profile__head { gap: .8rem; }
    .avatar { width: 3rem; height: 3rem; font-size: 1rem; }
    .profile__name { font-size: 1.35rem; }
    .summary { grid-template-columns: 1fr; }
    .summary dt { padding-bottom: 0; }
    .summary dd { border-top: 0; padding-top: 0; }
    .profile__actions { flex-direction: column; align-items: stretch; }
    .profile__actions form { margin: 0; }
    .profile__actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 560px) {
    .form--aligned .field { grid-template-columns: 1fr; }
    .form--aligned .field > :not(:first-child) { grid-column: 1; }
    .form--aligned .field--top > span:first-child { padding-top: 0; }
    .form--aligned .field__optional { display: inline; }
    .form--aligned .cf-turnstile { margin-left: 0; }
}
