/* ============================================
   Review Atlas — main stylesheet
   Editorial cream + ink + acid green
   ============================================ */

:root {
    --cream: #f5f1e8;
    --cream-2: #ebe5d5;
    --ink: #0a0a0a;
    --ink-2: #1a1a1a;
    --ink-soft: #4a4a4a;
    --ink-faint: #8a8a8a;
    --line: #d4cdb8;
    --line-soft: #e0dac8;
    --accent: #ef4444;
    --accent-dark: #b91c1c;
    --accent-bg: rgba(239, 68, 68, 0.18);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --gutter: 24px;
    --t-fast: 0.18s ease;
    --t: 0.32s cubic-bezier(0.65, 0, 0.35, 1);
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    cursor: none; /* custom cursor */
}

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

.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    background: var(--ink);
    color: var(--cream);
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 9999;
}
.skip-link:focus { top: 8px; }

button {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font-body);
    color: inherit;
    cursor: none;
}
input, textarea, select { font: inherit; color: inherit; cursor: none; }

::selection { background: var(--accent); color: var(--ink); }

@media (pointer: coarse) {
    body, button, a, input, textarea, select { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none; }
}

/* ============================================
   Custom cursor (dot + ring + magnetic)
   ============================================ */
.cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    will-change: transform;
}
.cursor-dot {
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    margin: -3px 0 0 -3px;
    transition: width .2s, height .2s, margin .2s, background .2s;
}
.cursor-ring {
    width: 32px; height: 32px;
    border: 1.5px solid var(--cream);
    border-radius: 50%;
    margin: -16px 0 0 -16px;
    transition: width .25s, height .25s, margin .25s, border-color .2s;
}
body.is-hovering .cursor-dot { width: 0; height: 0; }
body.is-hovering .cursor-ring {
    width: 56px; height: 56px;
    margin: -28px 0 0 -28px;
    border-color: var(--accent);
    background: rgba(197, 249, 0, 0.08);
}
body.is-magnetic .cursor-ring { border-color: var(--accent); }

.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent);
    z-index: 999;
    transition: width 0.05s linear;
}

/* ============================================
   Slim sticky top nav
   ============================================ */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px var(--gutter);
    background: rgba(245, 241, 232, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 600;
}
.nav-mark {
    display: inline-grid;
    place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}
.nav-word { font-size: 16px; letter-spacing: -0.01em; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-links a {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    transition: background var(--t-fast), color var(--t-fast);
}
.nav-links a:hover { background: var(--cream-2); color: var(--ink); }
.nav-links .nav-github {
    background: var(--ink);
    color: var(--cream);
    padding: 8px 14px;
    font-weight: 600;
    margin-left: 4px;
}
.nav-links .nav-github:hover { background: var(--accent); color: var(--ink); }

@media (max-width: 720px) {
    .top-nav { padding: 12px var(--gutter); }
    .nav-word { display: none; }
    .nav-links a:not(.nav-github) { display: none; }
}

/* ============================================
   Hero / Try-it — focal CTA of the page
   ============================================ */
.hero {
    padding: 60px var(--gutter) 40px;
    max-width: 1280px;
    margin: 0 auto;
}
.hero-inner { max-width: 720px; margin: 0 auto; text-align: center; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    font-weight: 600;
    margin: 0 0 24px;
}
.eyebrow-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-bg);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(56px, 9vw, 96px);
    font-weight: 600;
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin: 0 0 18px;
    color: var(--ink);
}
.hero-title em { font-style: italic; }

.hero-lead {
    font-family: var(--font-display);
    font-size: 19px;
    line-height: 1.45;
    color: var(--ink-soft);
    margin: 0 auto 36px;
    max-width: 540px;
}

/* ----- THE BIG INPUT ----- */
.try-form {
    display: flex;
    gap: 8px;
    margin: 0 auto 24px;
    max-width: 640px;
    align-items: stretch;
}
.try-form input {
    flex: 1;
    min-width: 0;
    padding: 18px 20px;
    border: 2px solid var(--ink);
    background: var(--cream);
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ink);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.try-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-bg);
}
.try-form input::placeholder { color: var(--ink-faint); }

.try-form button {
    flex-shrink: 0;
    background: var(--ink);
    color: var(--cream);
    padding: 0 36px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.try-form button:hover { background: var(--accent); color: var(--ink); transform: translateY(-1px); }

/* ----- DEMO CHIPS ----- */
.demo-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 16px;
    max-width: 720px;
}
.chips-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    font-weight: 600;
    align-self: center;
    margin-right: 4px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: var(--cream);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.chip:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--accent);
    transform: translateY(-1px);
}
.chip-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.try-hint {
    min-height: 22px;
    font-size: 13px;
    color: var(--ink-soft);
    margin: 8px auto 0;
    max-width: 640px;
    line-height: 1.4;
}
.try-hint code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--cream-2);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ============================================
   Globe — directly below input
   ============================================ */
.hero-globe {
    position: relative;
    width: min(520px, 78vw);
    aspect-ratio: 1;
    margin: 48px auto 0;
}
.hero-3d-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.hero-3d canvas {
    display: block;
    cursor: grab;
    width: 100% !important;
    height: 100% !important;
}
.hero-3d canvas:active { cursor: grabbing; }

@media (max-width: 720px) {
    .hero { padding: 36px var(--gutter) 24px; }
    .hero-lead { font-size: 16px; }
    .try-form { flex-direction: column; }
    .try-form button { padding: 16px 36px; }
    .hero-globe { margin-top: 36px; }
}

/* ============================================
   Section heads
   ============================================ */
.section-head {
    text-align: center;
    margin-bottom: 56px;
}
.section-num {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--ink);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 18px;
    letter-spacing: 0.05em;
}
.section-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 6vw, 56px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1;
    margin: 0 0 10px;
    color: var(--ink);
}
.section-sub {
    font-size: 16px;
    color: var(--ink-soft);
    margin: 0;
}

/* ============================================
   How it works — bento
   ============================================ */
.how-section {
    padding: 100px var(--gutter);
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid var(--line);
}
.bento {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.tile {
    background: var(--cream);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1), border-color 0.2s;
}
.tile:hover { border-color: var(--ink); }
.tile-lg { grid-column: 1 / -1; }
.tile-md { grid-column: span 1; }
.tile-sm { grid-column: span 1; }
.tile-num {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--accent);
    background: var(--ink);
    padding: 2px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.tile h3 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}
.tile p {
    font-size: 14px;
    color: var(--ink-soft);
    margin: 0 0 14px;
    line-height: 1.5;
}

.code-snippet {
    background: var(--ink);
    color: var(--cream);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
    margin: 0 0 14px;
}

.tile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip-mini {
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
}

@media (max-width: 720px) {
    .bento { grid-template-columns: 1fr; }
}

/* ============================================
   CLI section
   ============================================ */
.cli-section {
    padding: 100px var(--gutter);
    max-width: 880px;
    margin: 0 auto;
    border-top: 1px solid var(--line);
}
.cli-card {
    background: var(--ink);
    color: var(--cream);
    border-radius: var(--radius);
    padding: 32px;
    position: relative;
    overflow: hidden;
}
.cli-block {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.9;
    color: var(--cream);
    margin: 0 0 24px;
    white-space: pre;
}
.muted { color: rgba(245, 241, 232, 0.5); }
.cli-card code span:not(.muted) { color: var(--accent); }

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: border-color var(--t-fast);
}
.btn-link:hover { border-bottom-color: var(--accent); }

@media (max-width: 720px) {
    .cli-card { padding: 20px; }
    .cli-block { font-size: 12px; }
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px var(--gutter);
    margin-top: 60px;
}
.footer-row {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--ink-soft);
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.footer-meta a {
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

/* ============================================
   Popup — anchored to active pin on the globe
   ============================================ */
.reatlas-popup-wrap {
    position: fixed;
    top: 0; left: 0;
    width: 340px;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.2s ease;
    will-change: transform, opacity;
}
.reatlas-popup-wrap[hidden] { display: none; }
.reatlas-popup-wrap > .reatlas-popup,
.reatlas-popup-wrap > .popup-empty-card { pointer-events: auto; }

.reatlas-popup {
    width: 100%;
    background: var(--cream);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.30);
    font-family: var(--font-body);
    text-align: left;
    opacity: 0;
    transform: translateY(6px);
    animation: reatlas-popup-in 0.3s 0.05s ease-out forwards;
}
@keyframes reatlas-popup-in {
    to { opacity: 1; transform: translateY(0); }
}

.reatlas-popup-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.reatlas-popup-emoji {
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.reatlas-popup-titles { flex: 1; min-width: 0; }
.reatlas-popup-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 2px;
    line-height: 1.15;
    word-break: break-word;
}
.reatlas-popup-loc {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
    margin: 0;
}
.reatlas-popup-close {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 26px; height: 26px;
    font-size: 17px;
    line-height: 1;
    color: var(--ink);
    flex-shrink: 0;
    transition: background var(--t-fast), color var(--t-fast);
}
.reatlas-popup-close:hover {
    background: var(--ink);
    color: var(--cream);
}

.reatlas-popup-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.reatlas-popup-rating { color: var(--ink); font-weight: 600; }
.reatlas-popup-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-dark);
    background: var(--cream-2);
    padding: 3px 8px;
    border-radius: 999px;
}

.reatlas-popup-summary { margin-bottom: 14px; }
.reatlas-popup-bar {
    display: flex;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--line);
    margin-bottom: 6px;
}
.reatlas-popup-bar-pos { background: var(--accent); }
.reatlas-popup-bar-neu { background: var(--ink); }
.reatlas-popup-bar-neg { background: #c2410c; }
.reatlas-popup-bar-legend {
    display: flex;
    gap: 12px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
}
.reatlas-popup-bar-legend i {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 2px;
    margin-right: 3px;
    vertical-align: middle;
}
.reatlas-popup-bar-legend span:nth-child(1) i { background: var(--accent); }
.reatlas-popup-bar-legend span:nth-child(2) i { background: var(--ink); }
.reatlas-popup-bar-legend span:nth-child(3) i { background: #c2410c; }

.reatlas-popup-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ink);
    color: var(--cream);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: background var(--t-fast), color var(--t-fast);
}
.reatlas-popup-cta:hover { background: var(--accent); color: var(--ink); }

.reatlas-popup-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--ink-soft);
    font-size: 13px;
}
.reatlas-popup-spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.reatlas-popup-empty-text {
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 0 0 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Reveal animations
   ============================================ */
[data-reveal] {
    opacity: 1;
    transform: translateY(0);
}
html.js-reveal [data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
