/* =============================================================================
   Decode — Landing & Legal styles
   -----------------------------------------------------------------------------
   Typography: IBM Plex Sans (headings, UI labels) + IBM Plex Mono (all body).
   Colors mirror the Decode editor canvas — see :root for tunable tokens.
   ========================================================================== */

:root {
    --font-sans: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "Consolas", monospace;

    --bg:            #0b0b0c;
    --bg-elevated:   #141416;
    --card-top:      #2c2c2e;
    --card-bottom:   #1e1e20;
    --line:          #363636;
    --line-soft:     #242427;
    --title-bar:     #3c4133;

    --text:          #f4f4f5;
    --text-dim:      #a1a1aa;
    --text-faint:    #6b6b73;

    --accent:        #c2703a;
    --accent-bright: #e08a4e;
    --accent-deep:   #97562b;

    --wire-blue:    #5b80a6;
    --wire-green:   #5ba65b;
    --wire-amber:   #a6805b;
    --wire-magenta: #a65ba6;
    --wire-teal:    #5ba6a6;
    --wire-event:   #c8c8c8;
    --dirty:        #90ee90;

    --radius:        14px;
    --radius-sm:     8px;
    --maxw:          1180px;
    --ease:          cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* All body copy uses mono; headings use sans. */
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

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

h1, h2, h3, .eyebrow, .btn, .canvas-toolbar .tt {
    font-family: var(--font-sans);
}

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.12;
    margin: 0;
}

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 600px at 78% -5%, rgba(194, 112, 58, 0.16), transparent 60%),
        radial-gradient(700px 500px at 12% 8%, rgba(91, 128, 166, 0.10), transparent 60%),
        linear-gradient(180deg, #0b0b0c 0%, #0e0e10 100%);
}

.backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: radial-gradient(circle at 60% 30%, #000 0%, transparent 78%);
}

.wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Nav ---- */
.nav {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 0;
}

.brand { display: flex; align-items: center; }

/* ARPM wordmark from assets/ARPM_white.svg */
.brand-logo {
    display: block;
    height: 90px;
    width: auto;
}

.nav-actions { display: flex; align-items: center; gap: 12px; }

/* ---- Buttons ---- */
.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 11px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-primary {
    color: #1a0f07;
    background: linear-gradient(180deg, var(--accent-bright), var(--accent));
    box-shadow: 0 6px 20px rgba(194, 112, 58, 0.30);
}

.btn-primary:hover {
    box-shadow: 0 10px 28px rgba(194, 112, 58, 0.42);
    transform: translateY(-1px);
}

.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--line);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: #4a4a4a;
}

.btn-lg { padding: 14px 26px; font-size: 0.95rem; }

/* ---- Hero ---- */
.hero {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 56px;
    align-items: start;
    padding: 56px 0 56px;
}

/* Right column: diagram stacked above legend */
.hero-visual {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-bright);
    border: 1px solid rgba(194, 112, 58, 0.35);
    background: rgba(194, 112, 58, 0.08);
    padding: 6px 12px;
    border-radius: 999px;
}

.eyebrow .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent-bright);
    box-shadow: 0 0 0 0 rgba(224, 138, 78, 0.6);
    animation: pulse 2.4s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(224, 138, 78, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(224, 138, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(224, 138, 78, 0); }
}

.hero h1 {
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    margin: 22px 0 0;
}

.hero h1 .grad {
    background: linear-gradient(120deg, var(--accent-bright), var(--wire-amber) 60%, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p.lede {
    margin: 22px 0 0;
    font-size: 1.05rem;
    color: var(--text-dim);
    max-width: 50ch;
}

.hero-cta { display: flex; gap: 14px; margin-top: 34px; flex-wrap: wrap; }

.hero-note {
    margin-top: 18px;
    font-size: 0.82rem;
    color: var(--text-faint);
}

/* ---- Canvas showcase ---- */
.canvas-frame {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: radial-gradient(120% 120% at 50% 0%, #161618 0%, #0c0c0d 100%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.015);
}

.canvas-toolbar .tw { width: 11px; height: 11px; border-radius: 50%; }
.canvas-toolbar .run { background: var(--accent-deep); }
.canvas-toolbar .pause,
.canvas-toolbar .recompute { background: #6b6b6b; }

.canvas-toolbar .tt {
    font-size: 0.72rem;
    color: var(--text-faint);
    letter-spacing: 0.04em;
}

.canvas-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.canvas-stage { display: block; width: 100%; height: auto; }

.comp { cursor: default; transition: opacity 0.25s var(--ease); }
.canvas-stage:hover .comp { opacity: 0.55; }
.canvas-stage .comp:hover { opacity: 1; }
.comp:hover .comp-outline { stroke: var(--accent-bright); }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.015);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.82rem;
    color: var(--text-dim);
}

.legend-swatch { flex: none; }

/* ---- Narrative sections (philosophy, developers, etc.) ---- */
.section { padding: 56px 0; }

.section-label {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-bright);
    margin-bottom: 14px;
}

.section h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.35rem);
    max-width: 22ch;
}

.section-lead {
    margin: 18px 0 0;
    font-size: 1rem;
    color: var(--text-dim);
    max-width: 62ch;
}

/* Two-column narrative: prose left, illustration right (or stacked on mobile). */
.narrative {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    margin-top: 40px;
}

.narrative.reverse { direction: rtl; }
.narrative.reverse > * { direction: ltr; }

.narrative-body p {
    margin: 0 0 16px;
    color: var(--text-dim);
    font-size: 0.92rem;
}

.narrative-body p:last-child { margin-bottom: 0; }

.narrative-body strong { color: var(--text); font-weight: 500; }

/* Framed SVG illustration panels */
.illus-frame {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #141416, #0c0c0d);
    padding: 20px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.illus-frame svg { display: block; width: 100%; height: auto; }

.illus-caption {
    margin-top: 12px;
    font-size: 0.78rem;
    color: var(--text-faint);
    text-align: center;
}

/* Full-width philosophy comparison (black-box vs glass-box). */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
}

.compare-card {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
}

.compare-card.glass {
    border-color: rgba(194, 112, 58, 0.35);
    background: rgba(194, 112, 58, 0.04);
}

.compare-card h3 {
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.compare-card p {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: var(--text-dim);
}

/* ---- Feature grid (6 cards) ---- */
.features-head {
    text-align: center;
    max-width: 56ch;
    margin: 0 auto 40px;
}

.features-head h2 { max-width: none; margin: 0 auto; }
.features-head p { margin: 14px 0 0; color: var(--text-dim); }

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--card-top), var(--card-bottom));
    padding: 24px;
    transition: transform 0.25s var(--ease), border-color 0.25s;
}

.feature:hover { transform: translateY(-3px); border-color: var(--line); }

.feature .ficon {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 9px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.feature h3 {
    font-size: 1.05rem;
    margin-bottom: 0;
}

.feature p {
    margin: 10px 0 0;
    color: var(--text-dim);
    font-size: 0.88rem;
    line-height: 1.55;
}

/* ---- Closing / origin strip ---- */
.origin {
    text-align: center;
    padding: 48px 24px 0;
    max-width: 52ch;
    margin: 0 auto;
    font-size: 0.92rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.origin .heart { color: var(--accent-bright); }

.origin-link {
    text-align: center;
    margin: 12px auto 0;
    font-size: 0.88rem;
}

.origin-link a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.origin-link a:hover { color: var(--text); }

/* ---- Footer ---- */
.footer {
    border-top: 1px solid var(--line-soft);
    padding: 28px 0 40px;
    margin-top: 56px;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.footer-links { display: flex; gap: 20px; }
.footer-links a:hover { color: var(--text); }

/* ---- Legal page (entire document in mono) ---- */
.legal {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0 auto;
    padding: 8px 24px 96px;
    font-family: var(--font-mono);
}

.legal h1, .legal h2, .legal h3, .legal .toc strong {
    font-family: var(--font-sans);
}

.legal-head { padding: 28px 0 8px; }
.legal-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.legal-head .updated { margin-top: 12px; color: var(--text-faint); font-size: 0.82rem; }

.legal .notice {
    margin: 28px 0;
    padding: 16px 18px;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: rgba(194, 112, 58, 0.07);
    color: var(--text-dim);
    font-size: 0.9rem;
}

.legal h2 {
    font-size: 1.25rem;
    margin: 40px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.legal h3 { font-size: 1rem; margin: 22px 0 8px; }
.legal p, .legal li, .legal .notice { color: var(--text-dim); font-size: 0.9rem; }
.legal code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
}
.legal a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; }

.legal .toc {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.015);
    margin-top: 24px;
}

.legal .toc strong {
    color: var(--text);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.legal .toc ol { margin: 10px 0 0; padding-left: 20px; }
.legal .toc a { text-decoration: none; }
.legal .toc a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
    .features { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
    .hero { grid-template-columns: 1fr; gap: 40px; padding: 32px 0 48px; }
    .narrative,
    .compare-grid { grid-template-columns: 1fr; }
    .narrative.reverse { direction: ltr; }
    .nav-actions .btn-ghost.hide-sm { display: none; }
}

@media (max-width: 560px) {
    .features { grid-template-columns: 1fr; }
    .compare-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .eyebrow .dot { animation: none; }
}
