:root {
    --bg: #0d0d0d;
    --card-bg: #161616;
    --card-hover: #1e1e1e;
    --primary: #00e887;
    --secondary: #ff3366;
    --text: #ffffff;
    --text-dim: #777;
    --border: #222;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-y: scroll; }

/* ── Accessibility ────────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: #000;
    padding: .5rem 1rem;
    font-weight: 700;
    font-size: .875rem;
    z-index: 9999;
    text-decoration: none;
    border-radius: 0 0 6px 0;
    transition: top .2s;
}
.skip-link:focus { top: 0; }

body {
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
}

/* Grain texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.032;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2.5rem;
    width: 100%;
}

/* ── Header ──────────────────────────────────── */
header {
    padding: 1.25rem 0;
    border-bottom: 1px solid transparent;
    position: sticky;
    top: 0;
    background: transparent;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 100;
    transition: background 0.4s ease, border-color 0.4s ease, backdrop-filter 0.4s ease;
}
header.scrolled {
    background: rgba(13,13,13,0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    text-decoration: none;
    user-select: none;
}
.logo span { color: var(--primary); }

/* ── Hero ────────────────────────────────────── */
.hero {
    position: relative;
    min-height: calc(100vh - 62px);
    display: flex;
    align-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background-image:
        linear-gradient(rgba(0,255,157,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,157,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
}

.hero-layout {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    align-items: center;
    gap: 1.5rem;
    padding: 5rem 0 6rem;
    width: 100%;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 3px;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 1rem;
    opacity: 0;
    animation: slideUp 0.5s ease 0.2s forwards;
}
.hero-eyebrow::before {
    content: '';
    width: 22px;
    height: 1px;
    background: var(--primary);
    flex-shrink: 0;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.4rem);
    font-weight: 800;
    letter-spacing: -3px;
    line-height: 1.03;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: slideUp 0.7s ease 0.4s forwards;
}

.hero-sub {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.8;
    max-width: 440px;
    margin-bottom: 1.75rem;
    opacity: 0;
    animation: slideUp 0.6s ease 0.6s forwards;
}

.hero-pills {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.25rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: slideUp 0.5s ease 0.75s forwards;
}
.pill {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 0.28rem 0.75rem;
    border-radius: 100px;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, #00e887 0%, #00cc77 100%);
    color: #000;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 1rem 2.1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    animation: slideUp 0.5s ease 0.9s forwards;
}
.hero-cta:hover {
    filter: brightness(1.1);
    transform: translateY(-3px);
    box-shadow: 0 10px 36px rgba(0,232,135,0.32);
}

.cta-arrow {
    display: inline-block;
    transition: transform 0.35s ease;
    line-height: 1;
}
.hero-cta:hover .cta-arrow { transform: translateY(5px); }

/* ── Hero Visual ──────────────────────────────── */
.hero-visual {
    position: relative;
    height: 528px;
    z-index: 10;
    user-select: none;
    overflow: visible;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 22%, black 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 22%, black 100%);
}
.hero-visual::before {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,157,0.07) 0%, rgba(0,255,157,0.02) 45%, transparent 70%);
    pointer-events: none;
}

#hvCanvas {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: -260px;
    width: calc(100% + 260px);
    height: 100%;
}

/* Ambient orbs */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.hero-orb-a {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(0,255,157,0.07) 0%, transparent 65%);
    top: -250px; right: -150px;
}
.hero-orb-b {
    width: 450px; height: 450px;
    background: radial-gradient(circle, rgba(255,51,102,0.045) 0%, transparent 60%);
    bottom: -100px; left: -80px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Tests Section ───────────────────────────── */
.tests-section {
    padding: 4rem 0 6rem;
    flex: 1;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.section-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: var(--text-dim);
    text-transform: uppercase;
    white-space: nowrap;
}
.section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Tests Grid ──────────────────────────────── */
.tests-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    perspective: 900px;
}

.test-card {
    aspect-ratio: 1;
    background:
        radial-gradient(circle at var(--spot-x, 50%) var(--spot-y, -20%), rgba(0,232,135,0.06) 0%, transparent 55%) padding-box,
        linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(145deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.01) 55%, rgba(0,232,135,0.05) 100%) border-box;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s ease-out, border-color 0.2s ease-out, transform 0.2s ease-out, box-shadow 0.2s ease-out;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: cardIn 0.5s ease both;
}

/* HUD corner brackets */
.test-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    background:
        linear-gradient(var(--primary), var(--primary)) top 7px left 7px,
        linear-gradient(var(--primary), var(--primary)) top 7px left 7px,
        linear-gradient(var(--primary), var(--primary)) top 7px right 7px,
        linear-gradient(var(--primary), var(--primary)) top 7px right 7px,
        linear-gradient(var(--primary), var(--primary)) bottom 7px left 7px,
        linear-gradient(var(--primary), var(--primary)) bottom 7px left 7px,
        linear-gradient(var(--primary), var(--primary)) bottom 7px right 7px,
        linear-gradient(var(--primary), var(--primary)) bottom 7px right 7px;
    background-size:
        1.5px 11px, 11px 1.5px,
        1.5px 11px, 11px 1.5px,
        1.5px 11px, 11px 1.5px,
        1.5px 11px, 11px 1.5px;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.22s ease;
    z-index: 2;
}

.test-card:nth-child(1)  { animation-delay: 0.05s; }
.test-card:nth-child(2)  { animation-delay: 0.1s; }
.test-card:nth-child(3)  { animation-delay: 0.15s; }
.test-card:nth-child(4)  { animation-delay: 0.2s; }
.test-card:nth-child(5)  { animation-delay: 0.25s; }
.test-card:nth-child(6)  { animation-delay: 0.3s; }
.test-card:nth-child(7)  { animation-delay: 0.35s; }
.test-card:nth-child(8)  { animation-delay: 0.4s; }
.test-card:nth-child(9)  { animation-delay: 0.45s; }
.test-card:nth-child(10) { animation-delay: 0.5s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scan line sweep */
.test-card::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 70px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0,255,157,0.05) 25%,
        rgba(0,255,157,0.16) 50%,
        rgba(0,255,157,0.05) 75%,
        transparent 100%
    );
    pointer-events: none;
    top: -70px;
    z-index: 1;
}
.test-card:hover::before {
    animation: cardScan 0.7s cubic-bezier(0.4, 0, 0.55, 1) forwards;
}
@keyframes cardScan {
    from { top: -70px; }
    to   { top: calc(100% + 10px); }
}

.test-card:hover {
    background:
        radial-gradient(circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(0,232,135,0.1) 0%, transparent 55%) padding-box,
        linear-gradient(var(--card-hover), var(--card-hover)) padding-box,
        linear-gradient(145deg, rgba(0,232,135,0.5) 0%, rgba(0,232,135,0.12) 50%, rgba(0,232,135,0.28) 100%) border-box;
    border-color: transparent;
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 30px rgba(0,232,135,0.08);
}
.test-card:hover::after { opacity: 1; }

.test-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--primary);
    margin-bottom: auto;
    transition: filter 0.2s ease-out;
}
.test-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
.test-card:hover .test-icon {
    filter: drop-shadow(0 0 6px rgba(0,255,157,0.65));
}
.test-info { margin-top: auto; }

.test-name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.2px;
    color: var(--text);
}

.test-best {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--primary);
    opacity: 0.7;
    margin-top: 0.3rem;
    letter-spacing: 0.3px;
}

.test-card.done::after { opacity: 0.3; }

/* ── Footer ──────────────────────────────────── */
footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.82rem;
    letter-spacing: 0.3px;
}

/* ── Reduced motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .test-card { transition: background 0.2s ease, border-color 0.2s ease; }
    .test-card:hover { transform: none; }
    .test-card:hover::before { animation: none; }
    .hero-cta:hover { transform: none; }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 920px) {
    .tests-grid { grid-template-columns: repeat(4, 1fr); }
    .hero-layout { grid-template-columns: 1fr; }
    .hero-visual { display: none; }
    .hero-layout { padding: 4.5rem 0 5.5rem; }
}
@media (max-width: 700px) {
    .container { padding: 0 1.5rem; }
    .tests-grid { grid-template-columns: repeat(3, 1fr); }
    .hero-title { letter-spacing: -1.5px; }
}
@media (max-width: 460px) {
    .tests-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-title { letter-spacing: -1px; }
    .test-card { aspect-ratio: auto; min-height: 110px; }
}
