/* ==========================================================================
   Mindwrack — Global Stylesheet
   All page styling lives in this single file. No inline <style> attributes.
   ========================================================================== */

/* ---------- 1. CSS Custom Properties (design tokens) ---------- */
:root {
    /* Brand palette — deep navy + gold, adjust once final logo is supplied */
    --color-navy: #0A2540;
    --color-navy-light: #123A5E;
    --color-gold: #C9A86C;
    --color-gold-light: #E4CFA0;
    --color-white: #FFFFFF;
    --color-off-white: #F7F5F2;
    --color-gray-100: #F2F3F5;
    --color-gray-300: #D6D9DE;
    --color-gray-600: #5B6470;
    --color-gray-900: #1B1F27;
    --color-success: #2E7D5B;
    --color-danger: #B3402A;

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2.5rem;
    --space-6: 4rem;

    /* Layout */
    --container-max: 1200px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.08);
    --shadow-md: 0 4px 16px rgba(10, 37, 64, 0.12);
    --transition-base: all 0.2s ease-in-out;
}

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

/* Any element that also has its own `display` set via a class (buttons,
   flex/grid children, etc.) silently overrides the browser's default
   `[hidden] { display: none }` UA rule, since author CSS always wins over
   the UA stylesheet regardless of specificity. Without this, toggling the
   `hidden` attribute via JS (as the quote wizard and pipeline console do)
   would have no visible effect on elements styled with .btn and similar. */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-gray-900);
    background-color: var(--color-white);
    -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

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

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

ul, ol {
    list-style: none;
}

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-navy);
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.5rem; }

p {
    color: var(--color-gray-600);
}

/* ---------- 4. Layout helpers ---------- */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

.section {
    padding-block: var(--space-6);
}

/* ---------- 5. Header / Navigation ---------- */
.site-header {
    background-color: var(--color-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--space-3);
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-navy);
    letter-spacing: 0.02em;
}

.main-nav {
    display: flex;
    gap: var(--space-4);
}

.main-nav a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-navy);
    padding-block: var(--space-2);
    border-bottom: 2px solid transparent;
    transition: var(--transition-base);
}

.main-nav a:hover,
.main-nav a.is-active {
    color: var(--color-gold);
    border-bottom-color: var(--color-gold);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background-color: var(--color-navy);
}

/* ---------- 6. Footer ---------- */
.site-footer {
    background-color: var(--color-navy);
    color: var(--color-gray-300);
    margin-top: var(--space-6);
}

.site-footer__columns {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 0.8fr;
    gap: var(--space-5);
    padding-block: var(--space-5) var(--space-4);
}

.brand--footer {
    color: var(--color-white);
}

.site-footer__legal-name {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    color: var(--color-gold);
    margin-top: var(--space-1);
}

.site-footer__tagline {
    color: var(--color-gray-300);
    font-size: 0.9rem;
    margin-top: var(--space-3);
}

.site-footer__col-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-gold);
    margin-bottom: var(--space-2);
}

.site-footer__col-title:not(:first-child) {
    margin-top: var(--space-4);
}

.site-footer__address {
    font-style: normal;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--color-gray-300);
}

.site-footer__contact-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.site-footer__contact-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-footer__contact-list span {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-gray-300);
    opacity: 0.7;
}

.site-footer__contact-list a {
    font-size: 0.9rem;
    color: var(--color-white);
    transition: var(--transition-base);
}

.site-footer__contact-list a:hover {
    color: var(--color-gold);
}

.site-footer__links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.site-footer__links a {
    color: var(--color-gray-300);
    font-size: 0.9rem;
    transition: var(--transition-base);
}

.site-footer__links a:hover {
    color: var(--color-gold);
}

.site-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding-block: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer__recognition {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.78rem;
    color: var(--color-gray-300);
    flex-wrap: wrap;
}

.site-footer__recognition i {
    color: var(--color-gold);
}

.site-footer__recognition a {
    color: var(--color-gold);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.site-footer__recognition a:hover {
    color: var(--color-white);
}

.site-footer__copy {
    font-size: 0.8rem;
    color: var(--color-gray-300);
    opacity: 0.7;
}

.site-footer__copy a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.site-footer__copy a:hover {
    color: var(--color-gold);
}

/* ---------- 7. Buttons ---------- */
.btn {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-base);
}

.btn--primary {
    background-color: var(--color-navy);
    color: var(--color-white);
}

.btn--primary:hover {
    background-color: var(--color-navy-light);
}

.btn--gold {
    background-color: var(--color-gold);
    color: var(--color-navy);
}

.btn--gold:hover {
    background-color: var(--color-gold-light);
}

.btn--danger {
    background-color: var(--color-danger);
    color: var(--color-white);
}

/* ---------- 8. Alerts ---------- */
.alert {
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
}

.alert--success {
    background-color: rgba(46, 125, 91, 0.1);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

/* ---------- 9. Admin panel ---------- */
.admin-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-4);
    padding-block: var(--space-4);
}

.admin-sidebar {
    background-color: var(--color-off-white);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.admin-sidebar__title {
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: var(--space-3);
}

.admin-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.admin-sidebar__nav a {
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--color-gray-600);
    font-weight: 500;
}

.admin-sidebar__nav a.is-active,
.admin-sidebar__nav a:hover {
    background-color: var(--color-navy);
    color: var(--color-white);
}

.admin-content {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.admin-search {
    display: flex;
    gap: var(--space-2);
}

.admin-search input {
    padding: var(--space-2);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 640px;
}

.admin-form--inline {
    max-width: none;
    margin-top: var(--space-4);
}

/* ---------- 10. Neural Pipeline Console — interactive AI-pipeline hero ---------- */

:root {
    /* Deep-space/tech palette, scoped as its own token set since it's intentionally
       darker/higher-contrast than the rest of the corporate site. */
    --color-void: #060810;
    --color-void-light: #0F1524;
    --color-panel: #0B0F1A;
    --color-gold-hero: #C8A86E;
    --color-cyan: #00E5FF;
    --color-grid-line: rgba(0, 229, 255, 0.14);
}

.neural-console {
    position: relative;
    padding-block: var(--space-6);
    background: radial-gradient(ellipse at 50% 0%, var(--color-void-light) 0%, var(--color-void) 65%);
    color: var(--color-gray-300);
    overflow: hidden;
}

/* ----- Intro ----- */
.console-intro {
    max-width: 640px;
    margin-inline: auto;
    text-align: center;
    margin-bottom: var(--space-6);
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-gold-hero);
    margin-bottom: var(--space-2);
}

.console-intro h1 {
    color: var(--color-white);
    margin-bottom: var(--space-3);
}

.console-intro p {
    color: var(--color-gray-300);
}

/* ----- Pipeline rail (story-bar nodes + connecting line) ----- */
.pipeline-rail {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 900px;
    margin-inline: auto;
    margin-bottom: var(--space-5);
}

.pipeline-line {
    position: absolute;
    top: 28px;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 0;
    overflow: visible;
}

.pipeline-line path {
    fill: none;
    stroke: var(--color-grid-line);
    stroke-width: 2;
}

.pipeline-line path.is-flowing {
    stroke: var(--color-cyan);
    stroke-dasharray: 8 10;
    animation: flow-dash 1.2s linear infinite;
}

@keyframes flow-dash {
    to {
        stroke-dashoffset: -36;
    }
}

.pipeline-node {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border: none;
    cursor: pointer;
    width: 25%;
    padding: 0;
}

.pipeline-node__progress {
    width: 80%;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.pipeline-node__progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-gold-hero), var(--color-cyan));
    transition: width 0.1s linear;
}

.pipeline-node__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-void-light);
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: var(--color-gray-300);
    font-size: 1.25rem;
    transition: var(--transition-base);
}

.pipeline-node__label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-gray-300);
    transition: var(--transition-base);
}

.pipeline-node:hover .pipeline-node__icon {
    border-color: var(--color-gold-hero);
}

.pipeline-node.is-active .pipeline-node__icon {
    background: var(--color-panel);
    border-color: var(--color-cyan);
    color: var(--color-cyan);
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.4);
    animation: node-pulse 2.4s ease-in-out infinite;
}

.pipeline-node.is-active .pipeline-node__label {
    color: var(--color-white);
}

.pipeline-node.is-complete .pipeline-node__icon {
    color: var(--color-gold-hero);
    border-color: var(--color-gold-hero);
}

@keyframes node-pulse {
    0%, 100% {
        box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
    }
    50% {
        box-shadow: 0 0 28px rgba(200, 168, 110, 0.45);
    }
}

/* ----- Stage panels ----- */
.pipeline-stage {
    position: relative;
    max-width: 1000px;
    margin-inline: auto;
    min-height: 460px;
}

.pipeline-panel {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: var(--space-5);
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
    pointer-events: none;
}

.pipeline-panel.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.pipeline-panel__step {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--color-cyan);
    margin-bottom: var(--space-2);
}

.pipeline-panel__copy h2 {
    color: var(--color-white);
    margin-bottom: var(--space-2);
}

.pipeline-panel__copy p {
    color: var(--color-gray-300);
}

.pipeline-panel__demo {
    background: var(--color-panel);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
}

/* ----- Ingest demo: streaming data table ----- */
.data-stream {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-stream thead th {
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-gold-hero);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-stream tbody tr {
    opacity: 0;
    animation: row-in 0.4s ease forwards;
}

.data-stream td {
    padding-block: var(--space-2);
    color: var(--color-gray-300);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-stream .status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.data-stream .status-badge.is-ok {
    background: rgba(46, 125, 91, 0.15);
    color: #4CD190;
}

.data-stream .status-badge.is-warn {
    background: rgba(200, 168, 110, 0.15);
    color: var(--color-gold-hero);
}

@keyframes row-in {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ----- Train demo: live loss chart ----- */
.train-demo {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.train-demo canvas {
    width: 100%;
    height: auto;
    background: var(--color-void);
    border-radius: var(--radius-sm);
}

.train-demo__stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-cyan);
    letter-spacing: 0.03em;
}

/* ----- Evaluate demo: confusion matrix + gauge ----- */
.evaluate-demo {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.confusion-matrix {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    flex: 1;
}

.confusion-matrix__cell {
    background: var(--color-void);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    text-align: center;
}

.confusion-matrix__cell .cm-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-white);
}

.confusion-matrix__cell .cm-label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-gray-600);
    margin-top: var(--space-1);
}

.accuracy-gauge {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.accuracy-gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.accuracy-gauge__track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 8;
}

.accuracy-gauge__fill {
    fill: none;
    stroke: var(--color-cyan);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 327; /* 2 * PI * 52, precomputed for the r=52 circle */
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 0.3s ease;
}

.accuracy-gauge__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-white);
}

/* ----- Deploy demo: terminal ----- */
.terminal {
    width: 100%;
    background: var(--color-void);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.terminal__bar {
    display: flex;
    gap: 6px;
    padding: var(--space-2) var(--space-3);
    background: rgba(255, 255, 255, 0.04);
}

.terminal__bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}

.terminal__lines {
    padding: var(--space-3);
    min-height: 180px;
    font-size: 0.82rem;
    line-height: 1.7;
}

.terminal__lines .terminal-line {
    color: #4CD190;
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal__lines .terminal-line.is-json {
    color: var(--color-cyan);
}

.terminal__lines .terminal-line--typing::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 14px;
    margin-left: 2px;
    background: var(--color-gold-hero);
    animation: cursor-blink 0.9s steps(1) infinite;
    vertical-align: text-bottom;
}

@keyframes cursor-blink {
    50% {
        opacity: 0;
    }
}

/* ----- CTA ----- */
.console-cta {
    text-align: center;
    margin-top: var(--space-5);
}

.btn--cosmos {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: 999px;
    background: linear-gradient(120deg, var(--color-gold-hero), var(--color-cyan));
    color: var(--color-void);
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.25);
    transition: var(--transition-base);
}

.btn--cosmos:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 45px rgba(200, 168, 110, 0.45);
}

/* Respect reduced-motion preferences: keep the current stage visible and
   interactive, but drop autoplay-driven and decorative animation. */
@media (prefers-reduced-motion: reduce) {
    .pipeline-node.is-active .pipeline-node__icon,
    .pipeline-line path.is-flowing,
    .data-stream tbody tr,
    .terminal-line--typing::after {
        animation: none !important;
    }

    .pipeline-panel {
        transition: none;
    }
}
/* ---------- 11. Responsive breakpoints ---------- */

@media (max-width: 1024px) {
    .site-footer__columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ----- Tablet / mobile (<= 768px) ----- */
@media (max-width: 768px) {
    .main-nav {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .site-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-footer__columns {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .pipeline-rail {
        gap: var(--space-2);
    }

    .pipeline-node__label {
        display: none;
    }

    /* The desktop layout absolutely-positions every panel on top of each other
       (inset: 0) inside a fixed-height .pipeline-stage so they can crossfade
       without a layout jump. On narrow screens the copy+demo stack into a
       single column and get taller than that fixed height, so instead we drop
       absolute positioning entirely here: only the active panel is rendered
       (others display:none), and .pipeline-stage grows to fit it naturally. */
    .pipeline-stage {
        min-height: 0;
    }

    .pipeline-panel {
        position: static;
        display: none;
        grid-template-columns: 1fr;
        gap: var(--space-4);
        transform: none;
        opacity: 1;
        visibility: visible;
    }

    .pipeline-panel.is-active {
        display: grid;
    }

    .pipeline-panel__demo {
        min-height: 0;
    }

    .train-demo canvas {
        width: 100%;
        height: auto;
    }

    .evaluate-demo {
        flex-direction: column;
    }
}

/* ----- Small phones (<= 480px) ----- */
@media (max-width: 480px) {
    .pipeline-node__icon {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .pipeline-line {
        top: 22px;
    }

    .confusion-matrix__cell .cm-value {
        font-size: 1.15rem;
    }

    .terminal__lines {
        font-size: 0.72rem;
    }

    .console-cta .btn--cosmos span {
        font-size: 0.85rem;
    }
}

/* Large-display (>1080p) width scaling lives in custom.css, alongside the
   rest of the homepage section styles it also affects — see that file's
   "Large displays" block near the end for the full breakpoint set. */
