/* ==========================================================================
    LiveHack: AutoHotKey Viewer — Stylesheet
    Follows the same blueprint as Melder (green) and Injector (blue),
    adapted with the red accent palette.
    ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #030305;
    --surface: rgba(255,255,255,0.025);
    --surface-border: rgba(255,255,255,0.06);
    --surface-hover: rgba(255,255,255,0.045);
    --text: #f4f4f5;
    --text-2: #b4b4bd;
    --text-3: #71717a;
    --pitch-text: #dc2626;
    --accent: #ef4444;
    --accent-2: #fca5a5;
    --accent-glow: rgba(239,68,68,0.3);
    --cyan: #2dd4bf;
    --cyan-2: #5eead4;
    --page-glow-top: 239, 68, 68;
    --page-glow-bottom: 167, 139, 250;
    --success: #34d399;
    --error: #f87171;
    --error-bg: rgba(248,113,113,0.06);
    --radius: 14px;
    --radius-lg: 20px;
    --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: 'Clash Display', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ease: cubic-bezier(.4,0,.2,1);
}

html { font-size: 16px; }

::selection { background: #ef4444; color: #fff; }
::-moz-selection { background: #ef4444; color: #fff; }

body {
    font-family: var(--font-body) !important;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Stars background --- */
.stars {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    overflow: hidden;
}
.stars canvas {
    display: block;
    width: 100%; height: 100%;
}

/* --- Ambient glows --- */
.glow {
    position: fixed; pointer-events: none; z-index: 3;
    border-radius: 50%;
    filter: blur(145px);
    mix-blend-mode: screen;
}
.glow-1 {
    width: 620px; height: 620px;
    top: -18%; left: -2%;
    background:
        radial-gradient(circle, rgba(var(--page-glow-top), 0.38) 0%, rgba(var(--page-glow-top), 0.20) 30%, transparent 72%),
        radial-gradient(circle, rgba(var(--page-glow-top), 0.22) 0%, transparent 62%);
    animation: drift1 22s ease-in-out infinite alternate;
}
.glow-2 {
    width: 580px; height: 580px;
    bottom: -8%; right: -4%;
    background:
        radial-gradient(circle, rgba(var(--page-glow-bottom), 0.34) 0%, rgba(var(--page-glow-bottom), 0.18) 28%, transparent 72%),
        radial-gradient(circle, rgba(var(--page-glow-bottom), 0.20) 0%, transparent 60%);
    animation: drift2 28s ease-in-out infinite alternate;
}
@keyframes drift1 { 0% { transform: translate(0,0); } 100% { transform: translate(50px,30px); } }
@keyframes drift2 { 0% { transform: translate(0,0); } 100% { transform: translate(-35px,-25px); } }

/* --- Nav --- */
nav {
    position: relative; z-index: 2;
    width: 100%; max-width: 820px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 0;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-brand {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-family: var(--font-display);
    font-size: 1.07rem; font-weight: 600; letter-spacing: 0.06em;
    color: var(--text-2);
    text-decoration: none;
    transition: color .2s;
}
.nav-brand:hover { color: var(--text); }
.nav-pills {
    display: flex; gap: 0.35rem;
}
.nav-pill {
    font-family: var(--font-display);
    font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em;
    text-transform: uppercase; text-decoration: none;
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    color: var(--text-3);
    transition: color .2s, background .2s;
}
.nav-pill:hover { color: var(--text-2); background: rgba(255,255,255,0.04); }
.nav-pill.active {
    color: var(--accent);
    background: rgba(239,68,68,0.08);
}
.beta-badge {
    font-size: 0.52rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    background: rgba(234,179,8,0.15);
    color: #eab308;
    margin-left: 0.3rem;
    vertical-align: super;
    line-height: 1;
}

/* --- Hamburger menu --- */
.nav-hamburger {
    display: none; background: none; border: none; cursor: pointer;
    padding: 0.4rem; margin-right: -0.4rem;
    flex-direction: column; gap: 4px;
}
.nav-hamburger span {
    display: block; width: 20px; height: 2px;
    background: var(--text-2); border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- Main --- */
main {
    position: relative; z-index: 1;
    width: 100%; max-width: 820px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
    flex: 1;
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(3.64rem, 9.1vw, 5.85rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 40%, var(--cyan) 70%, #fff 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: hue-flow 10s ease-in-out infinite alternate;
}
@keyframes hue-flow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.pitch {
    font-family: var(--font-display);
    margin-top: 0.75rem;
    font-size: 1.21rem;
    line-height: 1.6;
    letter-spacing: .15em;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
}

.hero-description {
    max-width: 42rem;
    margin: 1rem auto 0;
    font-size: 1.01rem;
    color: var(--text-2);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* --- Flow container --- */
.flow {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- Step headers --- */
.step-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.25rem;
}
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    font-size: 0.88rem; font-weight: 700;
    color: var(--accent-2);
    border: 1.5px solid rgba(239,68,68,0.25);
    border-radius: 50%;
    flex-shrink: 0;
}
.step-title {
    font-family: var(--font-display);
    font-size: 1.01rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

/* ===================================================================
   Editor Shell
   =================================================================== */

.editor-shell {
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #0d0d0f;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(239,68,68,0.06);
}

/* --- Category selector --- */
.editor-categories {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.015);
    border-bottom: 1px solid var(--surface-border);
}

.editor-categories-list {
    display: flex;
    gap: 0.35rem;
    min-width: 0;
    flex-wrap: wrap;
}

.editor-category {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.85rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    background: transparent;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-3);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}

.editor-category:hover {
    color: var(--text-2);
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.03);
}

.editor-category.active {
    color: var(--accent);
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.08);
}

.editor-category__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0;
    color: inherit;
}

.editor-category.active .editor-category__count {
    background: rgba(239,68,68,0.18);
}

.editor-download-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-left: auto;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    color: var(--text-2);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}

.editor-download-all-btn:hover {
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.06);
    color: var(--text);
}

.editor-download-all-btn svg {
    flex-shrink: 0;
}

/* --- Tab bar --- */
.editor-tabs {
    display: none;
    gap: 0;
    overflow-x: auto;
    align-items: center;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--surface-border);
    padding: 0 0.5rem;
    scrollbar-width: none;
}
.editor-tabs.active { display: flex; }
.editor-tabs::-webkit-scrollbar { display: none; }

.editor-tab {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.65rem 1rem; border: none; background: transparent;
    font-family: var(--font-body); font-size: 0.8rem;
    color: var(--text-3); cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color .15s var(--ease), border-color .15s var(--ease);
    margin-bottom: -1px;
}
.editor-tab svg { opacity: 0.6; flex-shrink: 0; }
.editor-tab:hover { color: var(--text-2); }
.editor-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.editor-tab.active svg { opacity: 1; stroke: var(--accent); }

/* --- Editor panel --- */
.editor-panel { display: none; }
.editor-panel.active { display: block; }

/* --- Toolbar --- */
.editor-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.55rem 1rem;
    background: rgba(255,255,255,0.015);
    border-bottom: 1px solid var(--surface-border);
}
.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.editor-lang-badge {
    display: inline-flex;
    align-items: center;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--accent); opacity: 0.8;
}

.editor-lang-badge__short {
    display: none;
}
.editor-file-path {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.74rem;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.editor-toolbar-right { display: flex; gap: 0.5rem; align-items: center; }

.editor-action-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-2); font-family: var(--font-body);
    font-size: 0.77rem; cursor: pointer; text-decoration: none;
    transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease);
}
.editor-action-btn:hover {
    border-color: rgba(239,68,68,0.35);
    color: var(--accent); background: rgba(239,68,68,0.06);
}
.editor-action-btn.copied {
    border-color: rgba(52,211,153,0.4);
    color: #34d399; background: rgba(52,211,153,0.06);
}

/* --- Code wrap --- */
.editor-code-wrap {
    max-height: 540px; overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(239,68,68,0.25) transparent;
}
.editor-code-wrap::-webkit-scrollbar { width: 6px; }
.editor-code-wrap::-webkit-scrollbar-thumb {
    background: rgba(239,68,68,0.25); border-radius: 999px;
}

/* Override highlight.js container */
.editor-code-wrap pre.editor-pre {
    margin: 0 !important; border-radius: 0 !important;
    background: transparent !important;
    padding: 1.2rem 1.4rem 1.2rem 0 !important;
    display: flex;
    gap: 0;
}
.editor-code-wrap pre code {
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Fira Code', monospace !important;
    font-size: 0.82rem !important; line-height: 1.65 !important;
    background: transparent !important;
    tab-size: 4;
    flex: 1;
    min-width: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.editor-code-wrap .line-content {
    display: block;
}

/* Line number gutter */
.line-gutter {
    display: flex;
    flex-direction: column;
    padding: 0 0.9rem 0 1.2rem;
    text-align: right;
    user-select: none;
    flex-shrink: 0;
    border-right: 1px solid var(--surface-border);
    margin-right: 1rem;
}
.line-gutter .line-number {
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-3);
    opacity: 0.45;
}

/* Slightly tint the atom-one-dark background to match our shell */
.hljs { background: transparent !important; }

/* --- Footer --- */
footer {
    position: relative; z-index: 1;
    padding: 2rem 1.5rem 7rem;
    text-align: center;
    color: var(--text-3);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    line-height: 1.7;
}
.footer-content a {
    color: var(--text-3);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-content a:hover { color: var(--cyan); }
.footer-music {
    display: flex; align-items: center; justify-content: center;
    gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap;
}
.footer-music span { color: var(--text-3); font-size: 0.82rem; letter-spacing: 0.02em; }
.footer-socials { display: flex; gap: 0.6rem; }
.footer-socials a {
    color: var(--text-3); transition: color 0.2s, transform 0.2s;
    display: inline-flex; align-items: center;
}
.footer-socials svg {
    display: block;
    overflow: visible;
}
.footer-socials a[aria-label="SoundCloud"] {
    padding-right: 2px;
}
.footer-socials a:hover { color: var(--cyan); transform: scale(1.15); }

/* --- How-to Card --- */
.how-to-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}
.how-to-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.how-to-step {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.65rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s var(--ease);
}
.how-to-step:hover { background: rgba(255,255,255,0.02); }
.how-to-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; flex-shrink: 0;
    border: 1.5px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    color: var(--accent-2);
    background: rgba(239,68,68,0.04);
}
.how-to-text { display: flex; flex-direction: column; gap: 0.1rem; }
.how-to-name {
    font-family: var(--font-display);
    font-size: 1.01rem; font-weight: 600; color: var(--text);
}
.how-to-desc {
    font-size: 0.92rem; color: var(--text-3); line-height: 1.5;
}
.how-to-desc a {
    color: var(--cyan); text-decoration: none;
}
.how-to-desc a:hover { text-decoration: underline; }

.download-callout {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(239,68,68,0.16);
    border-radius: var(--radius);
    background: rgba(239,68,68,0.05);
}
.download-callout-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.download-callout-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.download-callout-desc {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-2);
}

.download-callout-desc a {
    color: var(--cyan);
    text-decoration: none;
}

.download-callout-desc a:hover {
    color: var(--cyan-2);
    text-decoration: underline;
}

.download-callout-desc code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.88em;
    color: var(--accent-2);
}
.download-callout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.12);
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.download-callout-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.45);
    color: #fff;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

nav                          { animation: fadeInUp .8s ease-out 0s both; }
.hero h1                     { animation: fadeInUp .8s ease-out .1s both, hue-flow 10s ease-in-out infinite alternate; }
.pitch                       { animation: fadeInUp .8s ease-out .2s both; }
.hero-description            { animation: fadeInUp .8s ease-out .3s both; }
.flow > .step-header:nth-child(1) { animation: fadeInUp .8s ease-out .3s both; }
.editor-shell                { animation: fadeInUp .8s ease-out .4s both; }

/* Below-fold: hidden until IntersectionObserver reveals */
@media (prefers-reduced-motion: no-preference) {
    [data-reveal]:not(.is-visible) { opacity: 0; transform: translateY(20px); }
    [data-reveal].is-visible        { animation: fadeInUp var(--reveal-dur, .6s) ease-out both; }
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Mobile --- */
@media (max-width: 640px) {
    .nav-hamburger { display: flex; }
    .nav-pills {
        display: none; flex-direction: column; width: 100%;
        padding: 0.5rem 0 0; gap: 0.25rem;
    }
    .nav-pills.open { display: flex; }
    .nav-pill { font-size: 0.78rem; text-align: center; padding: 0.5rem 0.8rem; }
    nav { padding: 1rem 1rem 0; flex-wrap: wrap; }

    main { padding: 0 0.75rem 2rem; }

    .hero { padding: 1.5rem 0 1.2rem; }
    .hero h1 { font-size: 2.2rem; }
    .pitch { font-size: 0.85rem; letter-spacing: 0.08em; }
    .hero-description { font-size: 0.88rem; }

    .editor-categories {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.5rem 0.6rem;
        align-items: stretch;
    }
    .editor-categories-list {
        flex-direction: column;
        gap: 0.3rem;
        width: 100%;
    }
    .editor-category {
        font-size: 0.7rem;
        padding: 0.3rem 0.65rem;
        width: 100%;
        justify-content: center;
    }
    .editor-category__count {
        min-width: 1rem; height: 1rem;
        font-size: 0.6rem;
    }
    .editor-download-all-btn {
        width: 100%;
        margin-left: 0;
        padding: 0.5rem 0.75rem;
    }

    .editor-tabs { padding: 0 0.35rem; }
    .editor-tab { padding: 0.5rem 0.65rem; font-size: 0.72rem; }

    .editor-toolbar { flex-wrap: wrap; gap: 0.4rem; }
    .editor-toolbar-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        flex: 1 1 100%;
        min-width: 0;
    }
    .editor-toolbar-right { flex-shrink: 0; margin-left: auto; }
    .editor-action-btn .btn-label { display: none; }
    .editor-action-btn { padding: 0.35rem 0.5rem; }
    .editor-lang-badge__full { display: none; }
    .editor-lang-badge__short { display: inline; }

    .editor-code-wrap { max-height: 400px; }
    .editor-code-wrap pre.editor-pre { padding: 0.8rem 0.8rem 0.8rem 0 !important; }
    .editor-code-wrap pre code { font-size: 0.72rem !important; }
    .line-gutter { padding: 0.8rem 0.4rem 0.8rem 0.5rem; font-size: 0.72rem; }

    .how-to-card { padding: 0.75rem; }
    .step-header { gap: 0.4rem; }
    .step-title { font-size: 0.88rem; }

    .download-callout {
        flex-direction: column;
        align-items: flex-start;
    }
    .download-callout-btn { width: 100%; }

    footer { padding: 1.5rem 0.75rem 5rem; }
}
