/* Peak Docs — Scanner Guide design system
   Light field-ops: paper + emerald signal, Funnel Sans. */

@import url('https://fonts.googleapis.com/css2?family=Funnel+Display:wght@500;600;700&family=Funnel+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Brand / signal */
    --peak-emerald: #059669;
    --peak-emerald-bright: #10b981;
    --peak-emerald-deep: #047857;
    --peak-mint: #d1fae5;

    /* Atmosphere (light) */
    --ink: #f4f7f5;
    --ink-elevated: #ffffff;
    --ink-panel: #ffffff;
    --mist: rgba(5, 150, 105, 0.06);
    --fog: rgba(15, 23, 42, 0.04);
    --line: rgba(15, 23, 42, 0.1);
    --line-strong: rgba(5, 150, 105, 0.35);
    --header-ink: #0b1411;

    /* Text */
    --text: #14201b;
    --text-muted: #5b6b63;
    --text-soft: #7a8a82;
    --text-on-signal: #ffffff;

    /* Semantic */
    --ok: #059669;
    --warn: #d97706;
    --danger: #dc2626;
    --info: #0891b2;

    /* Roles */
    --role-organiser: #0f766e;
    --role-leader: #15803d;
    --role-scanner: #1d4ed8;
    --role-first-aid: #be123c;

    /* Type */
    --font-display: 'Funnel Display', 'Funnel Sans', system-ui, sans-serif;
    --font-body: 'Funnel Sans', system-ui, sans-serif;

    /* Space */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --shadow-phone: 0 18px 40px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.06);
    --max: 42rem;
    --wide: 68rem;
    --site-header-h: 4rem;

    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--site-header-h) + 0.75rem);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(1000px 480px at 90% -8%, rgba(16, 185, 129, 0.14), transparent 55%),
        radial-gradient(800px 420px at -8% 12%, rgba(5, 150, 105, 0.08), transparent 50%),
        linear-gradient(180deg, #f7faf8 0%, var(--ink) 45%, #eef3f0 100%);
    background-attachment: fixed;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover {
    color: var(--peak-emerald);
}

/* —— Layout —— */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: linear-gradient(180deg, #101a16 0%, var(--header-ink) 100%);
    border-bottom: 1px solid rgba(16, 185, 129, 0.22);
    box-shadow: 0 8px 24px rgba(11, 20, 17, 0.18);
}

.site-header-inner {
    max-width: var(--wide);
    margin: 0 auto;
    min-height: var(--site-header-h);
    padding: 0.55rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #f4f7f5;
    text-decoration: none;
    min-width: 0;
}

/* Wordmark has white text — keep it on a near-black badge */
.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.35rem 0.55rem;
    border-radius: 10px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.brand-wordmark {
    width: auto;
    height: 28px;
    object-fit: contain;
}

.brand-mark {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
    color: #f4f7f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 0.72rem;
    color: rgba(244, 247, 245, 0.62);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-meta {
    font-size: 0.8rem;
    color: rgba(244, 247, 245, 0.55);
    text-align: right;
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .brand-name {
        font-size: 0.92rem;
        white-space: normal;
    }

    .header-meta {
        display: none;
    }
}

.wrap {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 960px) {
    .wrap {
        grid-template-columns: 15rem 1fr;
        gap: 2.5rem;
        padding-top: 1.5rem;
    }
}

/* —— Hero —— */
.hero {
    max-width: var(--max);
    padding: 1.25rem 0 0.5rem;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--peak-emerald-deep);
    margin-bottom: 0.45rem;
}

.hero-kicker::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--peak-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3.2vw, 1.75rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
    font-weight: 700;
}

.hero-lead {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 1rem;
    max-width: 32rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.hero-actions .btn {
    min-height: 2.35rem;
    padding: 0.5rem 0.95rem;
    font-size: 0.875rem;
}

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.65rem 1.15rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(180deg, var(--peak-emerald-bright), var(--peak-emerald));
    color: var(--text-on-signal);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28);
}

.btn-primary:hover {
    color: var(--text-on-signal);
    filter: brightness(1.05);
}

.btn-ghost {
    background: var(--fog);
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

/* —— Nav / TOC —— */
.toc {
    position: sticky;
    top: calc(var(--site-header-h) + 0.75rem);
    align-self: start;
    z-index: 30;
    display: none;
    max-height: calc(100vh - var(--site-header-h) - 1.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 0.5rem;
}

@media (min-width: 960px) {
    .toc {
        display: block;
    }
}

.toc-label {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin: 0 0 0.75rem;
}

.toc nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.toc a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
}

.toc a:hover,
.toc a.is-active {
    color: var(--text);
    background: var(--mist);
    border-left-color: var(--peak-emerald);
}

.mobile-toc {
    margin: 0 0 1.5rem;
}

@media (min-width: 960px) {
    .mobile-toc {
        display: none;
    }
}

.mobile-toc details {
    background: var(--ink-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
}

.mobile-toc summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.mobile-toc summary::-webkit-details-marker {
    display: none;
}

.mobile-toc nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

.mobile-toc a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

/* —— Content —— */
.content {
    max-width: var(--max);
    min-width: 0;
}

.section {
    padding: 2rem 0 0.5rem;
    scroll-margin-top: calc(var(--site-header-h) + 0.75rem);
}

.section + .section {
    border-top: 1px solid var(--line);
    margin-top: 1.5rem;
}

.section h2 {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 4vw, 1.9rem);
    letter-spacing: -0.02em;
    margin: 0 0 0.65rem;
}

.section h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin: 1.75rem 0 0.5rem;
    letter-spacing: -0.01em;
}

.section p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.section p strong,
.section li strong {
    color: var(--text);
    font-weight: 600;
}

.lede {
    font-size: 1.05rem;
    color: var(--text);
}

/* —— Role chips —— */
.role-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.25rem;
}

.role {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--line);
    background: var(--ink-elevated);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.role::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

.role-organiser { color: var(--role-organiser); }
.role-leader { color: var(--role-leader); }
.role-scanner { color: var(--role-scanner); }
.role-first-aid { color: var(--role-first-aid); }

.role-note {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin: -0.35rem 0 1rem;
}

/* —— Steps —— */
.steps {
    list-style: none;
    margin: 1.25rem 0;
    padding: 0;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.step {
    counter-increment: step;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.85rem 1rem;
    padding: 1rem 1.1rem;
    background: var(--ink-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.step::before {
    content: counter(step);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-on-signal);
    background: var(--peak-emerald);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.step-body h4 {
    margin: 0 0 0.35rem;
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text);
}

.step-body p {
    margin: 0;
    font-size: 0.95rem;
}

/* —— Callouts —— */
.callout {
    margin: 1.25rem 0;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--ink-panel);
    display: grid;
    gap: 0.35rem;
}

.callout-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.callout p {
    margin: 0;
    font-size: 0.95rem;
}

.callout-tip {
    border-color: rgba(5, 150, 105, 0.28);
    background: rgba(16, 185, 129, 0.08);
}

.callout-tip .callout-label { color: var(--ok); }

.callout-warn {
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(251, 191, 36, 0.12);
}

.callout-warn .callout-label { color: var(--warn); }

.callout-danger {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(248, 113, 113, 0.1);
}

.callout-danger .callout-label { color: var(--danger); }

.callout-info {
    border-color: rgba(8, 145, 178, 0.3);
    background: rgba(8, 145, 178, 0.08);
}

.callout-info .callout-label { color: var(--info); }

/* —— Mode grid —— */
.mode-grid {
    display: grid;
    gap: 0.85rem;
    margin: 1.25rem 0;
}

@media (min-width: 560px) {
    .mode-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.mode-card {
    padding: 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--ink-elevated);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mode-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
}

.mode-card p {
    margin: 0;
    font-size: 0.92rem;
}

.mode-card .roles {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.mode-card .roles span {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    background: var(--mist);
    color: var(--text-muted);
    border: 1px solid var(--line);
}

/* —— Screenshot frames —— */
.shot {
    margin: 1.5rem 0;
}

.shot-media {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
}

/* Phone chrome stays dark so product screenshots read as a device */
.shot-frame {
    width: min(100%, 320px);
    margin: 0;
    padding: 0.65rem;
    border-radius: 28px;
    background: linear-gradient(160deg, #1a2c24, #0d1612);
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: var(--shadow-phone);
    flex: 0 1 auto;
    min-width: 0;
}

.shot-frame img,
.shot-frame video {
    width: 100%;
    border-radius: 20px;
    background: #000;
    display: block;
}

.shot-frame video {
    aspect-ratio: 9 / 19.5;
    object-fit: cover;
}

/* Small playback pie to the right of each clip */
.video-progress {
    --p: 0;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background:
        conic-gradient(
            from -90deg,
            var(--peak-emerald) calc(var(--p) * 1%),
            rgba(15, 23, 42, 0.08) 0
        );
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.04);
    position: relative;
}

.video-progress::after {
    content: '';
    position: absolute;
    inset: 0.32rem;
    border-radius: 50%;
    background: var(--ink-elevated);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.shot-caption {
    max-width: 22rem;
    margin: 0.85rem auto 0;
    text-align: center;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.shot-caption strong {
    display: block;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.shot-pair {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .shot-pair {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    .shot-pair .shot-frame {
        width: 100%;
        max-width: 260px;
    }

    .shot-pair .video-progress {
        width: 1.75rem;
        height: 1.75rem;
    }

    .shot-pair .video-progress::after {
        inset: 0.28rem;
    }
}

@media (max-width: 380px) {
    .shot-media {
        gap: 0.45rem;
    }

    .video-progress {
        width: 1.65rem;
        height: 1.65rem;
    }

    .video-progress::after {
        inset: 0.26rem;
    }
}

/* —— Disclosure —— */
.disclosure {
    margin: 1rem 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--ink-elevated);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.disclosure + .disclosure {
    margin-top: 0.65rem;
}

.disclosure summary {
    cursor: pointer;
    padding: 0.95rem 1.1rem;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.disclosure summary::-webkit-details-marker {
    display: none;
}

.disclosure summary::after {
    content: '+';
    color: var(--peak-emerald);
    font-size: 1.25rem;
    font-weight: 500;
}

.disclosure[open] summary::after {
    content: '−';
}

.disclosure-body {
    padding: 0 1.1rem 1.1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.disclosure-body p:last-child {
    margin-bottom: 0;
}

/* —— Checklist / troubleshooting —— */
.check-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.check-list li {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--ink-elevated);
    color: var(--text-muted);
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.check-list strong {
    color: var(--text);
}

/* —— Inline code / footnotes —— */
code,
kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.12em 0.4em;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid var(--line);
    color: var(--text);
}

pre {
    margin: 1.25rem 0;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    background: #f1f5f3;
    border: 1px solid var(--line);
    overflow-x: auto;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.5;
}

pre code {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: inherit;
}

.footnote,
.footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--text-soft);
}

.footnote a,
.footnotes a {
    color: var(--peak-emerald-deep);
}

/* —— Footer —— */
.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 3rem;
    padding: 1.5rem 1.25rem 2.5rem;
    color: var(--text-soft);
    font-size: 0.85rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.45);
}

.site-footer a {
    color: var(--peak-emerald-deep);
}

.site-footer a:hover {
    color: var(--peak-emerald);
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn { transition: none; }
}
