:root {
    --ink: #0a0a0a;
    --ink-2: #404040;
    --ink-3: #737373;
    --ink-4: #a3a3a3;
    --line: #e7e7eb;
    --line-2: #f1f1f4;
    --bg: #fcfcfd;
    --surface: #ffffff;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.02);
    --shadow: 0 4px 16px -4px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 24px 48px -12px rgba(99, 102, 241, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(900px 500px at 15% -100px, rgba(99, 102, 241, 0.10), transparent 65%),
        radial-gradient(700px 400px at 90% 5%, rgba(139, 92, 246, 0.08), transparent 60%),
        radial-gradient(600px 400px at 50% 90%, rgba(99, 102, 241, 0.05), transparent 70%);
    background-attachment: fixed;
}
a { color: var(--ink); }
button { font-family: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.narrow { max-width: 680px; }

/* --- Nav --- */
nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 0; font-size: 14px;
}
nav a { text-decoration: none; color: var(--ink-2); transition: color 120ms; }
nav a:hover { color: var(--ink); }
nav .brand {
    font-weight: 700; color: var(--ink);
    display: inline-flex; align-items: center; gap: 10px;
}
nav .brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border-radius: 7px;
    background: var(--grad);
    color: white;
    font-weight: 800; font-size: 13px;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 6px -1px rgba(99, 102, 241, 0.4);
}

/* --- Hero --- */
header { padding: 48px 0 28px; text-align: center; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500;
    color: var(--ink-2);
    background: var(--surface); border: 1px solid var(--line);
    padding: 6px 12px; border-radius: 999px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.eyebrow::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
h1 {
    font-size: 48px; font-weight: 800; letter-spacing: -0.03em;
    margin: 0 auto 14px; line-height: 1.05;
    max-width: 780px;
}
h1 .grad {
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.lede {
    color: var(--ink-2); font-size: 17px; margin: 0 auto;
    max-width: 560px; line-height: 1.55;
}

/* --- Drop zone --- */
.drop-section { margin-top: 32px; }
.drop {
    position: relative;
    border: 1.5px dashed var(--line);
    border-radius: 20px;
    padding: 52px 32px; text-align: center;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 160ms, background 160ms, transform 160ms, box-shadow 160ms;
    box-shadow: var(--shadow-sm);
}
.drop:hover, .drop.is-drag {
    border-color: var(--accent);
    background: linear-gradient(180deg, #fafaff 0%, #ffffff 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}
.drop__icon {
    width: 56px; height: 56px; margin: 0 auto 20px;
    border-radius: 14px;
    background: var(--grad);
    display: flex; align-items: center; justify-content: center;
    color: white;
    box-shadow: 0 10px 24px -4px rgba(99, 102, 241, 0.4);
}
.drop__icon svg { width: 28px; height: 28px; }
.drop__title { font-weight: 600; font-size: 19px; color: var(--ink); }
.drop__sub { color: var(--ink-3); font-size: 14px; margin-top: 8px; }

/* --- Status --- */
.status {
    margin-top: 16px; padding: 12px 16px; border-radius: 10px;
    font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.status--loading {
    background: var(--surface); color: var(--ink-2);
    border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.status--error {
    background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
}
.spinner {
    width: 16px; height: 16px; border: 2px solid var(--line);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Section divider --- */
.section-label {
    display: flex; align-items: center; gap: 16px;
    margin: 56px 0 20px;
    color: var(--ink-3); font-size: 13px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.section-label::before, .section-label::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}

/* --- Hover reveal --- */
.reveal {
    position: relative; width: 100%;
    max-width: 720px; margin: 0 auto;
    border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
    background: var(--surface);
    cursor: crosshair;
    box-shadow: var(--shadow);
}
.reveal--compact { max-width: 460px; }

/* --- Examples carousel --- */
.carousel { position: relative; }
.carousel-btn {
    position: absolute;
    top: calc(50% - 14px); /* center on image area, ignoring scrollbar */
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.12), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--ink); font-size: 18px; font-weight: 500;
    z-index: 3;
    transition: opacity 180ms, background 120ms, transform 120ms, box-shadow 120ms;
}
.carousel-btn:hover {
    background: var(--bg-2);
    box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.16), 0 2px 4px -1px rgba(15, 23, 42, 0.08);
}
.carousel-btn:active { transform: translateY(-50%) scale(0.95); }
.carousel-btn:disabled, .carousel-btn.is-end {
    opacity: 0; pointer-events: none;
}
.carousel-btn svg { width: 16px; height: 16px; }
.carousel-btn--prev { left: -8px; }
.carousel-btn--next { right: -8px; }
@media (hover: none) {
    .carousel-btn { display: none; }
}

.examples {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 14px;
    scrollbar-width: thin;
    scrollbar-color: var(--ink-4) transparent;
    /* Bleed slightly past wrap padding so last item can scroll fully into view */
    scroll-padding-inline: 0;
    mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
}
.examples::-webkit-scrollbar { height: 6px; }
.examples::-webkit-scrollbar-track { background: transparent; }
.examples::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.examples::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
.examples .reveal {
    flex: 0 0 280px;
    max-width: none; margin: 0;
    scroll-snap-align: start;
}
@media (max-width: 560px) {
    .examples .reveal { flex: 0 0 240px; }
}

/* Zoom inset: magnifies the bottom-right corner so the tiny watermark is visible */
.zoom-inset {
    position: absolute; top: 12px; right: 12px;
    width: 88px; height: 88px;
    border-radius: 10px; overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.06);
    background: var(--bg-2);
    z-index: 2;
}
.zoom-inset__under, .zoom-inset__over {
    position: absolute; inset: 0;
    background-size: 500%;
    background-position: 100% 100%;
    background-repeat: no-repeat;
}
.zoom-inset__over { transition: opacity 180ms ease; }
.reveal.is-revealed .zoom-inset__over,
.reveal:hover .zoom-inset__over { opacity: 0; }
.zoom-inset__caption {
    position: absolute; bottom: 4px; left: 0; right: 0;
    text-align: center;
    font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}
/* Marker on main image showing what's being zoomed (centered on watermark) */
.zoom-marker {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 26px; height: 26px;
    border: 1.5px dashed rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1;
    transition: opacity 180ms ease;
}
.reveal.is-revealed .zoom-marker,
.reveal:hover .zoom-marker { opacity: 0.4; }
/* In the examples carousel, move the corner labels to the bottom-left to free the top corners */
.examples .reveal__label { top: auto; bottom: 12px; left: 12px; }
.reveal img, .reveal canvas { display: block; width: 100%; height: auto; }
.reveal__under { position: absolute; inset: 0; }
.reveal__over { position: relative; transition: opacity 180ms ease; }
.reveal.is-revealed .reveal__over,
.reveal:hover .reveal__over { opacity: 0; }
.reveal__label {
    position: absolute; top: 14px; left: 14px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; padding: 5px 10px; border-radius: 6px;
    pointer-events: none; transition: opacity 180ms ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.reveal__label--over {
    background: rgba(10, 10, 10, 0.85); color: white;
}
.reveal__label--under {
    background: rgba(255, 255, 255, 0.85); color: var(--ink);
    border: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0;
}
.reveal.is-revealed .reveal__label--over,
.reveal:hover .reveal__label--over { opacity: 0; }
.reveal.is-revealed .reveal__label--under,
.reveal:hover .reveal__label--under { opacity: 1; }
.reveal__hint {
    text-align: center; color: var(--ink-3); font-size: 13px;
    margin: 12px 0 0;
}

/* --- User result --- */
.result { margin-top: 32px; }
/* User-result reveal: let the canvas drive size, shrink container to fit */
#userReveal {
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}
/* Cap canvas to a sensible display size — preserves aspect via width/height auto */
#userResultCanvas {
    width: auto;
    height: auto;
    max-width: min(720px, calc(100vw - 48px));
    max-height: 75vh;
}

.result__actions {
    display: flex; gap: 10px; margin-top: 20px; justify-content: center;
}
.btn {
    font-size: 14px; font-weight: 500; padding: 10px 18px;
    border-radius: 10px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
    text-decoration: none; cursor: pointer;
    transition: all 120ms;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover {
    background: var(--bg); border-color: var(--ink-4);
    box-shadow: var(--shadow-sm);
}
.btn--primary {
    background: var(--ink); color: white; border-color: var(--ink);
}
.btn--primary:hover {
    background: var(--ink-2); border-color: var(--ink-2);
    box-shadow: var(--shadow);
}
.btn--accent {
    background: var(--grad); color: white; border-color: transparent;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.4);
}
.btn--accent:hover {
    background: var(--grad); color: white; border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.5);
}

/* --- Hermex callout --- */
.hermex {
    margin-top: 112px; padding: 56px;
    border: 1px solid var(--line); border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px;
    align-items: center;
}
.hermex::before {
    content: ''; position: absolute; top: -120px; right: -120px;
    width: 360px; height: 360px; border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.14), transparent 70%);
    pointer-events: none;
}
.hermex::after {
    content: ''; position: absolute; bottom: -100px; left: -100px;
    width: 280px; height: 280px; border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.10), transparent 70%);
    pointer-events: none;
}
.hermex__col { position: relative; z-index: 1; }
.hermex__eyebrow {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--accent); font-weight: 600;
    margin-bottom: 12px;
}
.hermex__title {
    font-size: 36px; font-weight: 800; margin: 0 0 14px;
    letter-spacing: -0.025em;
}
.hermex__desc {
    color: var(--ink-2); margin: 0 0 20px;
    font-size: 17px; line-height: 1.5;
}
.hermex__perks {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 28px;
}
.perk {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    font-size: 13px; font-weight: 500;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.18);
}
.perk::before {
    content: '';
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-size: 10px 10px;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
}
.hermex__code {
    font-family: 'JetBrains Mono', monospace; font-size: 13px;
    background: #0f0f14; color: #e4e4e7;
    padding: 24px; border-radius: 14px;
    overflow-x: auto; line-height: 1.7;
    border: 1px solid #1f1f28;
    box-shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.15);
    margin: 0;
}
.hermex__code .c-keyword { color: #c4b5fd; }
.hermex__code .c-string { color: #86efac; }
.hermex__code .c-comment { color: #71717a; }
@media (max-width: 880px) {
    .hermex { grid-template-columns: 1fr; gap: 32px; }
}

/* --- Footer --- */
footer {
    margin-top: 80px; padding: 32px 0 48px;
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
    font-size: 14px; color: var(--ink-3);
}
footer .links { display: flex; gap: 24px; }
footer a {
    text-decoration: none; color: var(--ink-2);
    transition: color 120ms;
}
footer a:hover { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 960px) {
    .wrap { padding: 0 24px; }
    .hermex { padding: 40px; }
}
@media (max-width: 640px) {
    h1 { font-size: 34px; }
    header { padding: 32px 0 24px; }
    .hermex { padding: 28px; margin-top: 56px; border-radius: 16px; }
    .section-label { margin: 48px 0 16px; }
    .drop { padding: 40px 20px; }
    .hermex__title { font-size: 28px; }
    .reveal--compact { max-width: 100%; }
}
