:root {
    --bg: #07070a;
    --text: #f5f5f7;
    --muted: #8e8e95;
    --line: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.045);
    --indigo: #7e8bf2;
    --ember: #e6885b;
    --ok: #3fcf86;
    --warn: #f2b33d;
    --low: #f25b52;
    --font: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* The popover's own ambient light: indigo from the top right, ember from the bottom left. */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(60vw 50vw at 88% 4%, rgba(126, 139, 242, 0.20), transparent 70%),
        radial-gradient(55vw 45vw at 6% 96%, rgba(230, 136, 91, 0.14), transparent 70%);
    pointer-events: none;
}

/* ── Nav ── */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px max(22px, calc((100vw - 1080px) / 2));
    background: rgba(7, 7, 10, 0.6);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; display: block; }
.nav-cta {
    font-size: 13px; font-weight: 600;
    padding: 6px 14px; border-radius: 999px;
    background: var(--text); color: var(--bg);
}

/* ── Hero ── */
.hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
    gap: 56px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 96px 22px 120px;
}

h1 {
    font-size: clamp(46px, 6.4vw, 78px);
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: -0.04em;
}
h1 span {
    background: linear-gradient(95deg, var(--ok), #7fe0b0 45%, var(--indigo));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lede {
    max-width: 30ch;
    margin-top: 26px;
    color: var(--muted);
    font-size: clamp(19px, 1.9vw, 22px);
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 38px; }
.btn {
    padding: 14px 28px; border-radius: 999px;
    background: var(--text); color: var(--bg);
    font-weight: 600; letter-spacing: -0.01em;
    box-shadow: 0 10px 30px rgba(126, 139, 242, 0.25);
    transition: transform 0.12s ease-out, box-shadow 0.2s ease;
}
.btn:hover { box-shadow: 0 14px 40px rgba(126, 139, 242, 0.4); }
.btn:active { transform: scale(0.97); }
.link { color: #9aa6ff; font-weight: 500; }
.link:hover { text-decoration: underline; }
.fine { margin-top: 18px; color: var(--muted); font-size: 13px; letter-spacing: 0.01em; }

/* ── The Mimir panel, drawn in CSS ── */
.popover {
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 26px;
    background: rgba(22, 22, 28, 0.55);
    border: 1px solid var(--line);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: perspective(1400px) rotateY(-9deg) rotateX(3deg);
}

.panel {
    --tone: var(--ok);
    position: relative;
    overflow: hidden;
    padding: 14px 16px 12px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--line);
}
.panel[data-tone="warn"] { --tone: var(--warn); }
.panel[data-tone="low"] { --tone: var(--low); }

/* What's left of the five-hour window tints that share of the face, from the left. */
.face {
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p) * 1%);
    background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 22%, transparent), color-mix(in srgb, var(--tone) 12%, transparent));
    transform-origin: left;
    animation: fill 1.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.row { position: relative; display: flex; align-items: flex-start; gap: 10px; }
.name { flex: 1; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.when {
    display: grid; text-align: right;
    font-size: 11px; font-weight: 500; line-height: 1.35;
    color: rgba(245, 245, 247, 0.45);
    font-variant-numeric: tabular-nums;
}
.pct {
    font-size: 32px; font-weight: 700; line-height: 0.95; letter-spacing: -0.03em;
    color: var(--tone);
    font-variant-numeric: tabular-nums;
}
.pct small { font-size: 16px; margin-left: 1px; }

.week {
    position: relative;
    height: 18px;
    margin-top: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.week-fill {
    height: 100%;
    width: calc(max(var(--w), 16) * 1%);
    border-radius: 999px;
    background: var(--tone);
    display: flex; align-items: center;
    padding-left: 8px;
    font-size: 10.5px; font-weight: 700; color: rgba(0, 0, 0, 0.75);
    transform-origin: left;
    animation: fill 1.3s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.week-when { position: relative; margin-top: 6px; font-size: 11px; color: rgba(245, 245, 247, 0.4); }

@keyframes fill { from { transform: scaleX(0); } }

.popover .panel:nth-child(2) .face, .popover .panel:nth-child(2) .week-fill { animation-delay: 0.1s; }
.popover .panel:nth-child(3) .face, .popover .panel:nth-child(3) .week-fill { animation-delay: 0.2s; }

/* ── Story ── */
.story { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

.beat {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 64px;
    padding: 96px 0;
    border-top: 1px solid var(--line);
}
.beat.flip .beat-copy { order: 2; }

h2 {
    font-size: clamp(34px, 4.4vw, 54px);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.035em;
}
h2 em { font-style: normal; color: var(--muted); }
.beat-copy p { margin-top: 18px; max-width: 34ch; color: var(--muted); font-size: 19px; line-height: 1.45; }

.beat-art { display: flex; justify-content: center; }
.panel.lg { width: min(100%, 380px); padding: 20px 22px 16px; border-radius: 20px; }
.panel.lg .name { font-size: 17px; }
.panel.lg .when { font-size: 12.5px; }
.panel.lg .pct { font-size: 46px; }
.panel.lg .pct small { font-size: 22px; }
.panel.lg .week { height: 22px; margin-top: 22px; }
.panel.lg .week-fill { font-size: 12px; }

.toast {
    display: flex; gap: 14px; align-items: flex-start;
    width: min(100%, 380px);
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(40, 40, 48, 0.7);
    border: 1px solid var(--line);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
.toast img { border-radius: 9px; flex: none; }
.toast > div { flex: 1; }
.toast-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.toast-top b { font-weight: 600; color: rgba(245, 245, 247, 0.7); }
.toast-title { margin-top: 2px; font-size: 15px; font-weight: 600; }
.toast-body { font-size: 14px; color: rgba(245, 245, 247, 0.75); }

.sources { list-style: none; width: min(100%, 380px); display: grid; gap: 10px; }
.sources li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--line);
    font-size: 15px; font-weight: 500;
}
.sources b { font-size: 12px; font-weight: 600; color: var(--ok); letter-spacing: 0.02em; }

/* ── End ── */
.end {
    text-align: center;
    padding: 120px 22px 140px;
    border-top: 1px solid var(--line);
    max-width: 1080px;
    margin: 0 auto;
}
.end .actions { justify-content: center; }

/* ── Footer ── */
.footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
    max-width: 1080px; margin: 0 auto;
    padding: 22px;
    border-top: 1px solid var(--line);
    color: var(--muted); font-size: 12px;
}
.footer nav { display: flex; gap: 20px; }
.footer a:hover { color: var(--text); }

/* ── Small screens ── */
@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 56px; padding: 56px 22px 88px; text-align: left; }
    .popover { transform: none; }
    h1 br { display: none; }
    .beat, .beat.flip { grid-template-columns: 1fr; gap: 36px; padding: 72px 0; }
    .beat.flip .beat-copy { order: 0; }
    .end { padding: 88px 22px 104px; }
}

@media (prefers-reduced-motion: reduce) {
    .face, .week-fill { animation: none; }
    .btn { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
    .nav, .popover, .toast { backdrop-filter: none; -webkit-backdrop-filter: none; background: #15151b; }
}
