/* ==========================================================================
   FTPasHTTPS — shared site stylesheet
   Loaded on every page AFTER any page-local <style> so the shared chrome
   (nav, footer, breadcrumb) is always identical. Also holds the animation
   layer and the interactive demo styles.
   ========================================================================== */

:root {
    --background: hsl(0 0% 100%);
    --foreground: hsl(0 0% 0%);
    --card: hsl(0 0% 98%);
    --accent: hsl(158 64% 52%);
    --accent-ink: hsl(158 90% 22%);
    --muted: hsl(0 0% 35%);
    --term: hsl(0 0% 7%);
}

/* ---------- Canonical navigation (sticky — never overlaps content) ------- */
nav {
    background: var(--background);
    border-bottom: 4px solid var(--foreground);
    position: sticky;          /* was fixed on some pages → caused overlap */
    width: 100%;
    top: 0;
    z-index: 200;
    transition: box-shadow .2s ease;
}

nav.scrolled { box-shadow: 0 6px 0 0 var(--foreground); }

nav .nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

nav .logo {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--foreground);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    display: flex;
    align-items: center;
    gap: 10px;
}

nav .logo img { height: 32px; width: auto; display: block; }

nav .nav-links { display: flex; gap: 24px; align-items: center; }

nav .nav-links a {
    color: var(--foreground);
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: -0.02em;
    position: relative;
}

nav .nav-links a:not(.btn)::after {
    content: "";
    position: absolute;
    left: 0; bottom: -4px;
    height: 3px; width: 0;
    background: var(--accent);
    transition: width .18s ease;
}
nav .nav-links a:not(.btn):hover::after { width: 100%; }

nav .nav-toggle {
    display: none;
    background: var(--foreground);
    color: var(--background);
    border: none;
    width: 44px; height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    nav .nav-toggle { display: inline-flex; }
    nav .nav-links {
        position: absolute;
        top: 72px; left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--background);
        border-bottom: 4px solid var(--foreground);
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s ease;
    }
    nav .nav-links.open { max-height: 360px; }
    nav .nav-links a { padding: 16px 24px; border-top: 2px solid var(--card); }
    /* beat the stale ".nav-links a:not(.btn){display:none}" rule on old pages */
    nav .nav-links a:not(.btn) { display: block; }
}

/* ---------- Canonical footer ------------------------------------------- */
footer {
    background: var(--foreground);
    color: var(--background);
    padding: 60px 0 30px;
}
footer .footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto; margin-right: auto;
    padding: 0 24px;
}
footer .footer-brand { max-width: 320px; }
footer .footer-brand .logo { color: var(--background); margin-bottom: 16px; display: inline-block; }
footer .footer-brand .logo img { height: 32px; }
footer .footer-brand p { font-size: 0.9rem; color: hsl(0 0% 70%); }
footer .footer-links h3 {
    color: var(--background);
    margin-bottom: 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 900;
}
footer .footer-links ul { list-style: none; }
footer .footer-links a {
    color: hsl(0 0% 70%);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 6px 0;
    transition: color .15s ease;
}
footer .footer-links a:hover { color: var(--accent); }
footer .footer-bottom {
    border-top: 4px solid hsl(0 0% 25%);
    padding: 30px 24px 0;
    font-size: 0.875rem;
    color: hsl(0 0% 50%);
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------- Breadcrumb (both variants normalised; they live in .container) */
.breadcrumb,
nav.breadcrumbs {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 0 0 24px;
}
.breadcrumb a,
nav.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover,
nav.breadcrumbs a:hover { color: var(--foreground); text-decoration: underline; text-decoration-thickness: 3px; }

/* Consistent top breathing room for content pages (sticky nav already
   prevents overlap; this just standardises spacing across guide/alt pages). */
.article-hero,
.article { padding-top: 48px; }

/* ---------- Hero top padding now that the nav is sticky ----------------- */
.hero { padding-top: 80px !important; }

/* ==========================================================================
   Animation layer (transform/opacity only; respects reduced motion)
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s ease, transform .6s ease; will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .08s; }
.reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; }
.reveal.d4 { transition-delay: .32s; }

/* Hover lift + accent glow on cards/buttons */
.feature-card, .use-case-card, .stat { transition: transform .12s ease, box-shadow .12s ease; }
.btn { transition: transform .1s ease, box-shadow .1s ease, background .15s ease; }
.btn-accent:hover, .btn-primary:hover { box-shadow: 0 0 0 0 var(--foreground), 0 8px 24px -6px var(--accent); }

/* Animated flow arrows (the How-It-Works section) */
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
.flow-arrow .flow-line { animation: nudge 1.6s ease-in-out infinite; }

/* Blinking terminal cursor */
@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }
.cursor { display: inline-block; width: 9px; height: 1.05em; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: blink 1s step-end infinite; }

/* Copy button injected onto code blocks */
.copy-btn {
    position: absolute; top: 8px; right: 8px;
    background: var(--foreground); color: var(--background);
    border: none; font-family: inherit; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 4px 8px; cursor: pointer; opacity: 0; transition: opacity .15s ease;
}
.has-copy { position: relative; }
.has-copy:hover .copy-btn { opacity: 1; }
.copy-btn.copied { background: var(--accent); color: var(--foreground); }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .flow-arrow .flow-line, .cursor { animation: none; }
    .btn, .feature-card, .use-case-card, .stat { transition: none; }
}

/* ==========================================================================
   Interactive demo — "See It Fire"
   ========================================================================== */
.demo { padding: 100px 0; border-bottom: 4px solid var(--foreground); background: var(--card); }
.demo .container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.demo h2 { margin-bottom: 16px; }
.demo .section-intro { color: var(--muted); margin-bottom: 48px; max-width: 640px; }

.demo-grid { display: grid; grid-template-columns: 360px 1fr; gap: 28px; align-items: stretch; }
@media (max-width: 820px) { .demo-grid { grid-template-columns: 1fr; } }

.demo-client {
    border: 4px solid var(--foreground);
    background: var(--background);
    box-shadow: 8px 8px 0 0 var(--foreground);
    display: flex; flex-direction: column;
}
.demo-client-head {
    background: var(--accent); border-bottom: 4px solid var(--foreground);
    padding: 12px 16px; font-weight: 900; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.03em;
}
.demo-client-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.demo-file {
    border: 3px solid var(--foreground); padding: 12px 14px; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer;
    transition: background .12s ease;
}
.demo-file[aria-pressed="true"], .demo-file:hover { background: var(--card); }
.demo-file .tag { background: var(--foreground); color: var(--background); font-size: 0.65rem; padding: 2px 7px; font-weight: 700; }
.demo-select { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; }
.demo-select label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 2px solid var(--foreground); padding: 5px 9px; }
.demo-select input { accent-color: var(--accent-ink); }
.demo-run {
    margin-top: auto;
    background: var(--foreground); color: var(--background);
    border: 4px solid var(--foreground); box-shadow: 4px 4px 0 0 var(--foreground);
    font-family: inherit; font-weight: 900; text-transform: uppercase; letter-spacing: -0.02em;
    padding: 14px; cursor: pointer; font-size: 0.9rem;
    transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
}
.demo-run:hover:not(:disabled) { background: var(--accent); color: var(--foreground); transform: translate(2px,2px); box-shadow: none; }
.demo-run:disabled { opacity: .55; cursor: progress; }

.demo-terminal {
    background: var(--term); color: hsl(0 0% 88%);
    border: 4px solid var(--foreground); box-shadow: 8px 8px 0 0 var(--foreground);
    padding: 20px; font-size: 0.82rem; line-height: 1.7;
    min-height: 320px; overflow-x: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.demo-terminal .ln { white-space: pre-wrap; word-break: break-word; }
.demo-terminal .prompt { color: var(--accent); }
.demo-terminal .dim { color: hsl(0 0% 50%); }
.demo-terminal .ok { color: var(--accent); font-weight: 700; }
.demo-terminal .err { color: hsl(0 84% 64%); font-weight: 700; }
.demo-terminal .key { color: hsl(48 96% 62%); }
.demo-bar { height: 8px; background: hsl(0 0% 20%); margin: 4px 0; overflow: hidden; }
.demo-bar > i { display: block; height: 100%; width: 0; background: var(--accent); }
