/* The recipient surface's whole stylesheet — IDN-048, RFT-5, INF-ARCH-VMA-001 VMA-6.

   DELIBERATELY SMALL AND SELF-HOSTED. The CSP is default-src 'self' with no remote origin, and a
   recipient on a pre-authorization network may have very little bandwidth. No framework, no font
   download, no icon set — everything below is a few hundred bytes over the wire.

   MOBILE FIRST, BECAUSE THE MEASURED RECIPIENT IS ON A PHONE. Every real UAT of this flow has run
   on an iPhone arriving from a mail client. The card is full-width with generous touch targets at
   small sizes and simply stops growing on a desktop. */

/* THE CAPTIVE APPEARANCE PRESETS — signed INF-ARCH-GST-001-A2. Imported here so a captive page's markup differs from
   before only by its two body classes (GSTA2-18 item 1). Every rule in it is selected by a theme-* or bg-* class that
   only a captive page's <body> carries, so the recipient pages render exactly as before. */
@import url("captive-appearance.css");

:root {
    color-scheme: light dark;

    /* ONE ACCENT, DERIVED FROM NOTHING. InfinityNMS has no shipped brand token for this host, so
       the accent is stated here once and used for the primary action and the success mark only. */
    --nms-accent: #1f6feb;
    --nms-accent-contrast: #ffffff;
    --nms-ok: #1a7f37;
    --nms-line: color-mix(in srgb, CanvasText 18%, Canvas);
    --nms-muted: color-mix(in srgb, CanvasText 62%, Canvas);
    --nms-card: Canvas;
}

@media (prefers-color-scheme: dark) {
    :root {
        --nms-accent: #4493f8;
        --nms-accent-contrast: #0b1220;
        --nms-ok: #3fb950;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: color-mix(in srgb, CanvasText 4%, Canvas);
    color: CanvasText;
    -webkit-text-size-adjust: 100%;
}

main {
    max-width: 30rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* THE BRAND LINE IS TEXT, visually hidden when the serving group has a logo (GSTA2-11). A logo is served from this
   same origin under the captive cookie, so no CSP origin is added; without one, the line is shown as before. */
.brand {
    font-weight: 650;
    letter-spacing: 0.01em;
    padding: 0.25rem 0 1rem;
    color: var(--nms-muted);
}

.card {
    background: var(--nms-card);
    border: 1px solid var(--nms-line);
    border-radius: 14px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 4%);
}

h1 {
    font-size: 1.45rem;
    line-height: 1.25;
    margin: 0 0 0.6rem;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.05rem;
    line-height: 1.3;
    margin: 1.75rem 0 0.6rem;
}

p { margin: 0 0 1rem; }

.lead { color: var(--nms-muted); }

.quiet {
    color: var(--nms-muted);
    font-size: 0.925rem;
}

/* THE SECONDARY WAY OUT, AND IT IS DELIBERATELY NOT A BUTTON.
   Both success states progress on their own; these links exist only for the case where that does
   not happen. A `.btn` here would read as the required next action — which is precisely what the
   first UX UAT reported about the completed step — so it stays a plain link, muted, with enough
   padding to be tappable if it is ever actually needed. */
.quiet a {
    display: inline-block;
    padding: 0.5rem 0;
    color: var(--nms-muted);
}

/* ── The one primary action ───────────────────────────────────────────────
   FULL WIDTH ON A PHONE AND AT LEAST 44px TALL — the touch target Apple's own
   guidance asks for, and the size the first UAT's recipient could not find when
   the button was a 1px outline. */
.btn {
    display: block;
    width: 100%;
    min-height: 2.85rem;
    font: inherit;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--nms-accent);
    color: var(--nms-accent-contrast);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn:hover { filter: brightness(1.06); }

.btn:focus-visible { outline: 3px solid var(--nms-focus, var(--nms-accent)); outline-offset: 2px; }

/* A DISABLED CONTROL MUST STILL READ AS A CONTROL. This was `background: transparent` at
   `opacity: 0.5` over a 1px currentColor border — on a phone that is a barely-there outline, and
   the first real recipient reported it as no button at all. */
.btn[disabled] {
    background: color-mix(in srgb, CanvasText 12%, Canvas);
    color: var(--nms-muted);
    border-style: dashed;
    border-color: var(--nms-line);
    cursor: not-allowed;
    filter: none;
}

/* ── The code field ───────────────────────────────────────────────────────
   inputmode + a wide letter-spacing make an eight-character code readable on a phone, and the
   16px minimum stops iOS Safari zooming the viewport on focus — a zoom the recipient then has to
   undo by hand. */
.code-field {
    width: 100%;
    font: 600 1.35rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.22em;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--nms-line);
    border-radius: 10px;
    background: Canvas;
    color: CanvasText;
}

.code-field:focus-visible { outline: 3px solid var(--nms-focus, var(--nms-accent)); outline-offset: 1px; }

/* ── The show-once Wi-Fi key ──────────────────────────────────────────────
   MEASURED ON A REAL IPHONE IN P6: the twenty-character key, drawn with .code-field, ran past the
   card. A generated passphrase has no break opportunity, so the browser could not wrap it.
   Smaller type and tight spacing make it fit a 320px screen on one line; overflow-wrap is the
   guarantee for larger text settings — it breaks the LINE, never the value, and inserts nothing.
   user-select: all makes a tap select the whole key, which is what copying by hand needs. */
.passphrase-field {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 1rem;
    padding: 0.75rem;
    font: 600 1.15rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.04em;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-all;
    -webkit-user-select: all;
    user-select: all;
    border: 1px solid var(--nms-line);
    border-radius: 10px;
    background: Canvas;
    color: CanvasText;
}

/* ── The ordinary text field ──────────────────────────────────────────────
   THE SAME MOBILE FORM AS .btn. Measured in P6 on a real iPhone: the device-registration
   fields had no class, so Safari drew them at its desktop default — about half the card wide and
   too short to hit — beside a full-width button. Full width, a 48px touch target, and 16px text,
   which is the size below which iOS Safari zooms the viewport on focus. border-box, so the padding
   can never push the field past the card. */
.text-field {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 3rem;
    margin: 0 0 1.1rem;
    padding: 0.7rem 0.9rem;
    font: inherit;
    font-size: 1rem;
    line-height: 1.4;
    border: 1px solid var(--nms-line);
    border-radius: 10px;
    background: Canvas;
    color: CanvasText;
}

.text-field:focus-visible { outline: 3px solid var(--nms-focus, var(--nms-accent)); outline-offset: 1px; }

label { display: block; font-weight: 600; margin: 0 0 0.4rem; }

/* ── States ───────────────────────────────────────────────────────────────── */

.notice {
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--nms-line);
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, CanvasText 4%, Canvas);
}

.notice.error { border-left-color: #d1242f; }

/* THE SUCCESS STATE IS A STATE, NOT A TOAST. VMA-6's flow shows a short confirmation and then
   continues; it has to read as a completed step even if the automatic progression never fires. */
.done { text-align: center; padding: 1rem 0 0.5rem; }

.done .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--nms-ok) 15%, Canvas);
    color: var(--nms-ok);
    font-size: 1.6rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.done h1 { margin-bottom: 0.35rem; }

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

ul.devices li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--nms-line);
}

ul.devices li:last-child { border-bottom: 0; }

.pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--nms-line);
    color: var(--nms-muted);
}

/* ── The member's own device — INF-ARCH-MDL-001 MDL-1, MDL-2, MDL-5 ──────────────
   A device row on Dina enheter is a link to its page; the page states its facts and offers the two
   acts as links to their confirmations. Both acts stay full-width touch targets at 320px. */
ul.devices a.device-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

dl.facts { margin: 0 0 1rem; }

dl.facts dt { font-weight: 600; }

dl.facts dd { margin: 0 0 0.6rem; color: var(--nms-muted); }

.actions { margin-top: 1.5rem; }

/* THE SECONDARY ACTION READS AS AN ACTION BUT NOT AS THE NEXT STEP. A solid card fill and a full
   accent border — never a transparent background, which is how the first recipient failed to see a
   button at all (see .btn[disabled]). */
.btn.secondary {
    background: var(--nms-card);
    color: var(--nms-accent);
    border-color: var(--nms-accent);
    margin-top: 0.6rem;
}

/* THE DESTRUCTIVE ACTION IS NEVER THE ACCENT COLOUR. */
.btn.danger {
    background: #d1242f;
    color: #ffffff;
}

.copy-status { min-height: 1.5em; margin: 0.5rem 0 1rem; }

/* INF-ARCH-GST-001-A3 GSTA3-10 ITEM 1 — THE SELF-SERVICE SECTION IS BELOW THE CODE FORM AND SECONDARY TO IT: a rule above it,
   the h2 scale and the secondary button. No new colour; the error is a .notice.error, legible on every theme. */
.self-service {
    margin-top: 1.75rem;
    border-top: 1px solid var(--nms-line);
}

.self-service h2 { margin-top: 1.25rem; }

/* INF-ARCH-GST-001-A4 GSTA4-11 — THE DIRECT-ACCESS VIEW AND THE TERMS PAGE. No script: the terms open in a native <details>, whose
   region scrolls on its own and takes keyboard focus without trapping it; long words and addresses wrap so nothing overflows at
   320px. The consent row keeps a 44px touch target and a visible focus ring; its error is a .notice.error (text, not colour). */
details.terms {
    margin: 0 0 0.5rem;
    border: 1px solid var(--nms-line);
    border-radius: 10px;
    background: var(--nms-card);
}

details.terms summary {
    cursor: pointer;
    font-weight: 600;
    min-height: 2.75rem;
    padding: 0.65rem 0.9rem;
    overflow-wrap: anywhere;
}

details.terms summary:focus-visible,
.terms-text:focus-visible,
.consent input:focus-visible {
    outline: 3px solid var(--nms-focus, var(--nms-accent));
    outline-offset: 2px;
}

.terms-text {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.25rem 0.9rem 0.5rem;
    border-top: 1px solid var(--nms-line);
    overflow-wrap: anywhere;
}

.terms-page { overflow-wrap: anywhere; }

.consent {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: 2.75rem;
    margin: 0 0 1rem;
}

.consent input {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.1rem 0 0;
    accent-color: var(--nms-accent);
}

.consent label {
    font-weight: 400;
    margin: 0;
    overflow-wrap: anywhere;
}

/* `hidden` must win over anything else that would give the element a display. Every progressive
   transition on this host depends on it, and an element that cannot be hidden would contradict the
   page it sits on. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
    .step { animation: nms-in 220ms ease-out; }
}

@keyframes nms-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
