/* ==========================================================================
   CrakBounty site-wide theme: the blog cover design applied to every page.
   Dark base (#0c0d10), red / green / blue corner glows, 32px grid, chevrons.
   Loaded AFTER style.css and blog.css. To go back to the light look,
   remove the theme.css <link> from the pages.
   ========================================================================== */

:root {
    --bg: #0c0d10;
    --bg-alt: rgba(255, 255, 255, .025);
    --card: #12141a;
    --line: rgba(255, 255, 255, .09);
    --green: #2be063;
    --red: #ff3b55;
    --blue: #0aa0d8;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, .64);
    --body-text: rgba(255, 255, 255, .8);
    --glow-red: rgba(229, 33, 58, .5);
    --glow-green: rgba(18, 177, 58, .42);
    --glow-blue: rgba(10, 160, 216, .45);
    --chevron-green: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20420%20520%27%3E%3Cg%20fill=%27none%27%20stroke=%27%232be063%27%20stroke-width=%2746%27%3E%3Cpath%20d=%27M40%20300%20L210%20130%20L380%20300%27/%3E%3Cpath%20d=%27M40%20470%20L210%20300%20L380%20470%27%20opacity=%27.5%27/%3E%3C/g%3E%3C/svg%3E");
    --chevron-red: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%20420%20520%27%3E%3Cg%20fill=%27none%27%20stroke=%27%23ff3b55%27%20stroke-width=%2746%27%3E%3Cpath%20d=%27M40%20300%20L210%20130%20L380%20300%27/%3E%3Cpath%20d=%27M40%20470%20L210%20300%20L380%20470%27%20opacity=%27.5%27/%3E%3C/g%3E%3C/svg%3E");
    color-scheme: dark;
}

/* ---------- Page background: deep base + aurora glow + fine grain ---------- */
html {
    background: #0c0d10;
}

body {
    background: transparent;
    color: var(--text);
}

/* Layer 1: deep base + soft vignette + ultra-fine film grain (no grid lines) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"),
        radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%),
        #0b0c10;
}

/* Layer 2: aurora - large soft colour clouds that drift very slowly */
body::after {
    content: "";
    position: fixed;
    inset: -15%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(38% 34% at 88% 8%, rgba(229, 33, 58, .30), transparent 70%),
        radial-gradient(42% 38% at 6% 92%, rgba(18, 177, 58, .26), transparent 70%),
        radial-gradient(36% 32% at 12% 14%, rgba(10, 160, 216, .20), transparent 70%),
        radial-gradient(34% 30% at 92% 88%, rgba(10, 160, 216, .16), transparent 70%),
        radial-gradient(30% 26% at 50% 52%, rgba(229, 33, 58, .07), transparent 70%);
    animation: aurora-drift 36s ease-in-out infinite alternate;
    will-change: transform;
}

@keyframes aurora-drift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(2.5%, -2%, 0) scale(1.06);
    }

    100% {
        transform: translate3d(-2.5%, 2%, 0) scale(1.02);
    }
}

::selection {
    background: var(--red);
    color: #fff;
}

/* ---------- Header / logo (logo-white.svg: white text, transparent background) ---------- */
header {
    background: rgba(12, 13, 16, .86);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.menu a:hover,
.menu a.active {
    color: #fff;
    border-bottom-color: var(--red);
}

/* ---------- Highlight words: blue -> green gradient like the cover art ---------- */
.display .red,
h1 .red,
h2 .red {
    background: linear-gradient(90deg, #0aa0d8 0%, #2be063 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ---------- Buttons ---------- */
.btn.ghost {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

.btn.ghost::before {
    background: #0c0d10;
}

.btn.ghost:hover::before {
    background: #171a21;
}

/* ---------- Hero / CTA / page heads: cover-style glow + chevrons ---------- */
.hero,
.cta,
.blog-hero,
.post-head,
.legal {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: transparent;
}

.hero {
    background:
        radial-gradient(60% 70% at 100% 0%, var(--glow-red), transparent 70%),
        radial-gradient(60% 70% at 0% 100%, var(--glow-green), transparent 70%);
}

.cta {
    background:
        radial-gradient(60% 80% at 0% 0%, var(--glow-blue), transparent 70%),
        radial-gradient(60% 80% at 100% 100%, var(--glow-red), transparent 70%);
}

.blog-hero {
    background:
        radial-gradient(60% 90% at 100% 0%, var(--glow-blue), transparent 70%),
        radial-gradient(50% 80% at 0% 100%, var(--glow-green), transparent 70%);
}

.post-head {
    background:
        radial-gradient(60% 90% at 100% 0%, var(--glow-red), transparent 70%),
        radial-gradient(50% 80% at 0% 100%, var(--glow-green), transparent 70%);
}

.hero::after,
.cta::after,
.blog-hero::after,
.post-head::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
    opacity: .45;
    right: -2%;
    bottom: -8%;
    width: 30%;
    max-width: 420px;
    height: 85%;
    background: var(--chevron-green) no-repeat right bottom / contain;
}

.cta::after {
    right: auto;
    left: -2%;
    background-image: var(--chevron-red);
    background-position: left bottom;
}

.post-head::after {
    opacity: .3;
}

/* ---------- Tag / eyebrow ---------- */
.tag {
    color: var(--green);
    border-color: rgba(43, 224, 99, .3);
    background: rgba(43, 224, 99, .08);
}

.tag b {
    background: var(--green);
    animation-name: pulse-dark;
}

@keyframes pulse-dark {
    0% {
        box-shadow: 0 0 0 0 rgba(43, 224, 99, .45);
    }

    100% {
        box-shadow: 0 0 0 10px rgba(43, 224, 99, 0);
    }
}

/* ---------- Cards, stats, ticker, alt sections ---------- */
.stat {
    background: var(--card);
    box-shadow: none;
}

.ticker {
    background: rgba(12, 13, 16, .7);
}

.steps,
.quality,
.blog-list,
.related {
    background: var(--bg-alt);
}

.feature,
.step,
.geo-item,
.post-card,
.featured,
.post-nav-item {
    background: var(--card);
}

.feature:hover,
.step:hover,
.geo-item:hover {
    background: #171a21;
}

.feature .ico {
    color: var(--green);
}

.step .num,
.geo-item .code {
    color: var(--green);
}

.post-card:hover,
.featured:hover {
    background: #171a21;
}

.read-link svg {
    color: var(--green);
}

/* ---------- Footer ---------- */
footer {
    background:
        radial-gradient(50% 90% at 0% 100%, var(--glow-green), transparent 70%),
        radial-gradient(40% 80% at 100% 100%, var(--glow-blue), transparent 70%),
        rgba(12, 13, 16, .9);
    border-top: 1px solid var(--line);
}

.socials a:hover {
    color: #fff;
}

/* ---------- Mobile menu, modal, forms ---------- */
.mobile-menu {
    background:
        radial-gradient(60% 50% at 100% 0%, var(--glow-red), transparent 70%),
        radial-gradient(60% 50% at 0% 100%, var(--glow-green), transparent 70%),
        #0c0d10;
}

.modal-overlay {
    background: rgba(5, 6, 8, .8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-container {
    background:
        radial-gradient(70% 40% at 100% 0%, rgba(229, 33, 58, .22), transparent 70%),
        #12141a;
    border-color: rgba(255, 255, 255, .14);
}

.modal-close {
    background: rgba(255, 255, 255, .06);
}

.form-input,
.form-select,
.form-textarea {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: rgba(255, 255, 255, .08);
    border-color: var(--green);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(255, 255, 255, .38);
}

.form-select option {
    background: #12141a;
    color: #fff;
}

.custom-checkbox {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .25);
}

.custom-checkbox:checked {
    background: var(--green);
    border-color: var(--green);
}

.custom-checkbox:checked::after {
    border-color: #0c0d10;
}

.checkbox-label a {
    color: #fff;
}

/* ---------- Blog: filters, pager, post body, sidebar ---------- */
.pager a,
.chip,
.blog-search-input,
.toc {
    background: var(--card);
    color: #fff;
}

.blog-search-input:focus {
    border-color: var(--green);
}

.pager a:hover,
.chip:hover {
    border-color: var(--green);
    color: var(--green);
}

.pager a.current,
.chip.on {
    background: var(--gradient-primary);
    border-color: transparent;
    color: #fff;
}

.side-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(70% 60% at 100% 0%, var(--glow-red), transparent 70%),
        radial-gradient(70% 60% at 0% 100%, var(--glow-green), transparent 70%),
        #0c0d10;
    border: 1px solid var(--line);
}

.post-body p,
.post-body li {
    color: var(--body-text);
}

.post-body strong,
.post-body>p:first-child {
    color: #fff;
}

.post-body a,
.legal-body a,
.filter-note a,
.blog-empty a {
    color: var(--green);
}

.post-body li::marker {
    color: var(--green);
}

.callout {
    background: rgba(43, 224, 99, .06);
    border-left-color: var(--green);
}

.post-table th {
    background: rgba(255, 255, 255, .05);
    color: #fff;
}

.post-table td {
    color: var(--body-text);
}

.toc a:hover,
.crumbs a:hover,
.featured:hover h2,
.post-card:hover h3,
.post-nav-item:not(.empty):hover strong {
    color: var(--green);
}

.post-byline svg,
.post-nav-label svg {
    color: var(--green);
}

/* ---------- Legal pages ---------- */
.legal-body h2 {
    color: #fff;
}

.legal-body p,
.legal-body li {
    color: var(--muted);
}

/* ---------- Mobile: lighter chevrons so text stays readable ---------- */
@media (max-width: 800px) {

    .hero::after,
    .cta::after,
    .blog-hero::after,
    .post-head::after {
        opacity: .22;
        width: 45%;
    }
}


/* ==========================================================================
   Arrow focus effect: the arrows stay exactly where they are; a light wave
   runs bottom -> top through them. No movement, only the highlight.
   ========================================================================== */
.hero::after,
.cta::after,
.blog-hero::after,
.post-head::after,
.cover::after {
    -webkit-mask-image: linear-gradient(0deg, rgba(0, 0, 0, .42) 0%, #000 14%, rgba(0, 0, 0, .42) 36%, rgba(0, 0, 0, .42) 100%);
    mask-image: linear-gradient(0deg, rgba(0, 0, 0, .42) 0%, #000 14%, rgba(0, 0, 0, .42) 36%, rgba(0, 0, 0, .42) 100%);
    -webkit-mask-size: 100% 200%;
    mask-size: 100% 200%;
    -webkit-mask-repeat: repeat-y;
    mask-repeat: repeat-y;
    will-change: mask-position;
    animation: chevron-wave 3.6s linear infinite;
}

.cover::after {
    animation-duration: 3.2s;
}

/* stagger so neighbouring cards do not pulse in lockstep */
.blog-grid .post-card:nth-child(2) .cover::after {
    animation-delay: -1.1s;
}

.blog-grid .post-card:nth-child(3) .cover::after {
    animation-delay: -2.2s;
}

@keyframes chevron-wave {
    from {
        -webkit-mask-position: 0 0;
        mask-position: 0 0;
    }

    to {
        -webkit-mask-position: 0 200%;
        mask-position: 0 200%;
    }
}

/* ---------- Back-to-top button: new colour, arrow fixed, light wave inside ---------- */
#toTop {
    background: var(--gradient-primary);
    color: #fff;
}

#toTop svg {
    -webkit-mask-image: linear-gradient(0deg, rgba(0, 0, 0, .4) 0%, #000 20%, rgba(0, 0, 0, .4) 50%, rgba(0, 0, 0, .4) 100%);
    mask-image: linear-gradient(0deg, rgba(0, 0, 0, .4) 0%, #000 20%, rgba(0, 0, 0, .4) 50%, rgba(0, 0, 0, .4) 100%);
    -webkit-mask-size: 100% 200%;
    mask-size: 100% 200%;
    -webkit-mask-repeat: repeat-y;
    mask-repeat: repeat-y;
    animation: chevron-wave 1.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {

    .hero::after,
    .cta::after,
    .blog-hero::after,
    .post-head::after,
    .cover::after,
    #toTop svg,
    body::after {
        animation: none;
    }
}

/* ---------- Registration modal colours (dark theme) ---------- */
/* Title accent: brand gradient instead of red, so it stays readable on the red glow */
.modal-title span {
    background: linear-gradient(90deg, #0aa0d8 0%, #2be063 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--green);
}

/* Success state of the submit button */
.modal-btn.is-success {
    background: var(--green);
    color: #0c0d10;
}

/* Status line under the button */
#formStatus.is-success {
    color: var(--green);
}

#formStatus.is-error {
    color: var(--red);
}

/* ---------- Speed: lighter effects so menu, form and clicks respond instantly ---------- */
/* The full-screen background glow stays, but no longer moves (it forced a repaint every frame) */
body::after {
    animation: none;
    will-change: auto;
}

/* Blur filters over a large page are expensive: solid, slightly darker colours instead */
header {
    background: rgba(12, 13, 16, .96);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.modal-overlay {
    background: rgba(5, 6, 8, .88);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* Blog cover lights: static (many of them animate at once on the blog page) */
.cover::after,
#toTop svg {
    animation: none;
    will-change: auto;
}

/* While the menu or the form is open, everything behind it stands still */
html.ui-open *,
html.ui-open *::before,
html.ui-open *::after {
    animation-play-state: paused !important;
}

/* ---------- Menu: 7 items fit on every page and every screen width ---------- */
.nav {
    grid-template-columns: auto 1fr auto;
}

.menu {
    gap: clamp(14px, 1.8vw, 40px);
}

/* Too narrow for all 7 items next to the buttons: use the burger menu (it has every item) */
@media (max-width: 1260px) {
    .menu {
        display: none;
    }

    .burger {
        display: block;
    }

    .nav {
        grid-template-columns: auto 1fr;
    }
}
