/* =============================================================
   iOS system-style UI
   Tokens follow Apple's Human Interface colour and type ramps so
   the funnel reads as a native screen rather than a web page.
   ============================================================= */

:root {
    --bg-grouped:      #f2f2f7;
    --bg-elevated:     #ffffff;
    --bg-nav:          rgba(249, 249, 249, 0.82);
    --fill-quaternary: rgba(116, 116, 128, 0.08);
    --fill-tertiary:   rgba(118, 118, 128, 0.12);

    --label:           #000000;
    --label-secondary: rgba(60, 60, 67, 0.60);
    --label-tertiary:  rgba(60, 60, 67, 0.30);
    --separator:       rgba(60, 60, 67, 0.22);

    --blue:            #007aff;
    --green:           #34c759;
    --orange:          #ff9500;

    --radius-card:     12px;
    --radius-control:  12px;
    --radius-large:    18px;

    --pad:             16px;
    --measure:         38rem;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
            "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --nav-h: 44px;
    --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-grouped:      #000000;
        --bg-elevated:     #1c1c1e;
        --bg-nav:          rgba(28, 28, 30, 0.82);
        --fill-quaternary: rgba(118, 118, 128, 0.12);
        --fill-tertiary:   rgba(118, 118, 128, 0.24);

        --label:           #ffffff;
        --label-secondary: rgba(235, 235, 245, 0.60);
        --label-tertiary:  rgba(235, 235, 245, 0.30);
        --separator:       rgba(84, 84, 88, 0.60);

        --blue:            #0a84ff;
        --green:           #30d158;
        --orange:          #ff9f0a;
    }
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.45;
    color: var(--label);
    background: var(--bg-grouped);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

a { color: var(--blue); text-decoration: none; }

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
    border-radius: 6px;
}

/* -------------------------------------------------------------
   Boot overlay — held until ads and images settle
   ------------------------------------------------------------- */

.boot {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--bg-grouped);
    transition: opacity 0.32s var(--ease-ios);
}

.boot[hidden] { display: none; }

.boot.is-done {
    opacity: 0;
    pointer-events: none;
}

.boot__text {
    font-size: 15px;
    color: var(--label-secondary);
    letter-spacing: -0.01em;
}

/* Twelve-blade activity indicator, as used system-wide on iOS. */
.spinner {
    position: relative;
    width: 28px;
    height: 28px;
}

.spinner i {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2.5px;
    height: 7.5px;
    margin-left: -1.25px;
    border-radius: 1.25px;
    background: var(--label-tertiary);
    transform-origin: 1.25px 14px;
    animation: blade 1s linear infinite;
}

@keyframes blade {
    0%   { opacity: 1; }
    100% { opacity: 0.18; }
}

@media (prefers-reduced-motion: reduce) {
    .spinner i { animation-duration: 2.4s; }
    * { scroll-behavior: auto !important; }
}

.app { opacity: 0; }
.app.is-ready { opacity: 1; transition: opacity 0.3s var(--ease-ios); }
.no-js .app { opacity: 1; }
.no-js .boot { display: none; }

/* -------------------------------------------------------------
   Navigation bar
   ------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(var(--nav-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: var(--bg-nav);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--separator);
}

.nav__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
}

.nav__back {
    position: absolute;
    left: 8px;
    top: calc(env(safe-area-inset-top) + 2px);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 40px;
    padding: 0 8px;
    font-size: 17px;
    color: var(--blue);
}

.nav__back svg { width: 12px; height: 20px; }

/* -------------------------------------------------------------
   Layout
   ------------------------------------------------------------- */

.wrap {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--pad);
}

.screen {
    padding-top: 22px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.large-title {
    font-size: 32px;
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.028em;
    margin: 0 0 8px;
}

.sub {
    margin: 0 0 22px;
    font-size: 15px;
    color: var(--label-secondary);
}

/* -------------------------------------------------------------
   Progress
   ------------------------------------------------------------- */

.progress {
    display: flex;
    gap: 4px;
    margin: 14px 0 20px;
}

.progress span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--fill-tertiary);
}

.progress span.is-done { background: var(--blue); }

.progress__label {
    font-size: 13px;
    color: var(--label-secondary);
    margin: 0 0 2px;
}

/* -------------------------------------------------------------
   Inset grouped list — the answer options
   ------------------------------------------------------------- */

.list {
    background: var(--bg-elevated);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin: 0 0 22px;
}

.row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 12px 14px 12px 16px;
    background: transparent;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s linear;
}

.row + .row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 0.5px;
    background: var(--separator);
}

.row:active,
.row.is-picked { background: var(--fill-quaternary); }

.row__text { flex: 1; min-width: 0; }

.row__label {
    font-size: 17px;
    letter-spacing: -0.022em;
}

.row__hint {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--label-secondary);
}

.row__chev {
    flex: none;
    width: 8px;
    height: 13px;
    color: var(--label-tertiary);
}

.row.is-picked .row__chev { color: var(--blue); }

/* -------------------------------------------------------------
   Buttons
   ------------------------------------------------------------- */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 13px 20px;
    border: 0;
    border-radius: var(--radius-control);
    font: inherit;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s var(--ease-ios), opacity 0.1s linear;
}

.btn:active { transform: scale(0.975); opacity: 0.85; }

.btn--filled { background: var(--blue); color: #fff; }

.btn--tinted {
    background: color-mix(in srgb, var(--blue) 14%, transparent);
    color: var(--blue);
}

.btn--plain {
    background: transparent;
    color: var(--blue);
    font-weight: 400;
    min-height: 44px;
}

.btn-stack { display: grid; gap: 10px; margin-top: 6px; }

/* -------------------------------------------------------------
   Ad slots
   ------------------------------------------------------------- */

.ad {
    margin: 24px 0;
}

.ad__label {
    display: block;
    margin: 0 0 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--label-tertiary);
}

.ad__frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border-radius: var(--radius-card);
    overflow: hidden;
}

/* Space is reserved from the start so a late fill cannot shift the
   article under someone's thumb, but the placeholder only becomes
   visible once the slot actually starts loading. */
.ad.is-loading .ad__frame,
.ad[data-status="filled"] .ad__frame {
    background: var(--fill-quaternary);
}

.ad:not(.is-loading) .ad__label { visibility: hidden; }

/* A slot that returned nothing collapses instead of leaving a hole. */
.ad.is-empty { display: none; }

.ad--house .ad__frame {
    flex-direction: column;
    gap: 4px;
    min-height: 160px;
    background: var(--bg-elevated);
    border: 0.5px dashed var(--separator);
    color: var(--label-tertiary);
    font-size: 13px;
}

/* -------------------------------------------------------------
   Article
   ------------------------------------------------------------- */

.hero__kicker {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 10px;
    border-radius: 100px;
    background: color-mix(in srgb, var(--green) 16%, transparent);
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
}

.dek {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--label-secondary);
}

.prose h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.024em;
    line-height: 1.2;
    margin: 30px 0 10px;
}

.prose p {
    margin: 0 0 14px;
    font-size: 17px;
    line-height: 1.52;
}

.prose ul {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    background: var(--bg-elevated);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.prose li {
    position: relative;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.4;
}

.prose li + li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 0;
    height: 0.5px;
    background: var(--separator);
}

.note {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    margin: 20px 0;
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--orange) 12%, transparent);
    font-size: 15px;
    line-height: 1.42;
}

.note svg { flex: none; width: 20px; height: 20px; color: var(--orange); }

/* CTA card — deliberately styled as an offer, not as body content.
   Blending these into the article is what gets a site removed from
   an ad network. */
.cta {
    margin: 24px 0;
    padding: 18px;
    border-radius: var(--radius-large);
    background: var(--bg-elevated);
    border: 0.5px solid var(--separator);
}

.cta__eyebrow {
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--label-tertiary);
    margin: 0 0 8px;
}

.cta__label {
    margin: 0 0 4px;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.022em;
}

.cta__sub {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--label-secondary);
}

.cta__note {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--label-tertiary);
    text-align: center;
}

/* -------------------------------------------------------------
   Footer
   ------------------------------------------------------------- */

.foot {
    margin-top: 40px;
    padding: 24px var(--pad) calc(34px + env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--separator);
    font-size: 12px;
    line-height: 1.5;
    color: var(--label-secondary);
}

.foot h3 {
    margin: 18px 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label);
}

.foot__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-bottom: 16px;
}

.foot__legal { margin-top: 18px; color: var(--label-tertiary); }

/* -------------------------------------------------------------
   Admin
   ------------------------------------------------------------- */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.metric {
    padding: 14px 16px;
    border-radius: var(--radius-card);
    background: var(--bg-elevated);
}

.metric b {
    display: block;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.metric span { font-size: 13px; color: var(--label-secondary); }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border-radius: var(--radius-card);
    overflow: hidden;
    font-size: 15px;
}

.table th,
.table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 0.5px solid var(--separator);
}

.table th {
    font-size: 13px;
    font-weight: 600;
    color: var(--label-secondary);
}

.table tr:last-child td { border-bottom: 0; }

.bar {
    height: 6px;
    border-radius: 3px;
    background: var(--blue);
    min-width: 2px;
}
