/* ════════════════════════════════════════════════════════════════
   PayFlow interactive architecture — editorial light skin
   Page chrome matches editorial.css / the homepage; the 3D viewport
   stays a dark panel (like the homepage's black CTA banner) because
   the Three.js scene (fog 0x060914) is tuned for a dark backdrop.
   ════════════════════════════════════════════════════════════════ */
:root {
    --bg:        #f1f0ee;
    --bg-card:   #ffffff;
    --ink:       #111111;
    --ink-2:     #555555;
    --ink-3:     #8a8a86;
    --line:      #dddbd6;
    --dark:      #0c0c0c;
    --radius:    18px;

    /* dark-viewport accents (over the canvas only) */
    --scene-bg:  #060914;
    --scene-line: rgba(226, 232, 240, 0.12);
    --scene-text: #f8fafc;
    --scene-muted: #b6c2d6;
    --gold: #f3c969;
    --teal: #4fd1c5;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.arch-topbar {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    pointer-events: none;
}

.arch-back,
.arch-source,
.arch-brand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(241, 240, 238, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    text-decoration: none;
    pointer-events: auto;
}

.arch-back,
.arch-source {
    padding: 0 16px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: color .2s, border-color .2s;
}

.arch-back:hover,
.arch-source:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.arch-back i,
.arch-source i {
    font-size: 0.75rem;
}

.arch-brand {
    justify-self: center;
    padding: 0 18px 0 10px;
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.arch-mark {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.arch-page {
    min-height: 100vh;
}

/* ── Hero ───────────────────────────────────────────────────── */
.arch-hero {
    min-height: 100vh;
    padding: 110px 20px 28px;
    display: grid;
    gap: 26px;
}

.arch-copy {
    width: min(1160px, 100%);
    margin: 0 auto;
    display: block;
}

.arch-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
}

.arch-eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink);
}

.arch-copy h1,
.reference-copy h2 {
    margin: 0;
    color: var(--ink);
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1.05;
    font-weight: 400;
    letter-spacing: -0.025em;
    max-width: 920px;
}

.arch-copy p:last-child,
.reference-copy p {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1.65;
}

.arch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.arch-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 22px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background .2s, color .2s, opacity .2s;
}

.arch-action:hover {
    background: var(--ink);
    color: #fff;
}

.arch-action-primary {
    border-color: var(--dark);
    background: var(--dark);
    color: #fff;
}

.arch-action-primary:hover {
    background: var(--dark);
    color: #fff;
    opacity: 0.85;
}

/* ── Viewer shell ───────────────────────────────────────────── */
.arch-shell {
    width: min(1500px, 100%);
    min-height: min(760px, calc(100vh - 220px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-rows: auto minmax(520px, 1fr);
    gap: 14px;
}

.arch-toolbar {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.flow-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--ink-2);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
}

.flow-btn:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.flow-btn.is-active {
    background: var(--dark);
    border-color: var(--dark);
    color: #fff;
}

/* The 3D viewport — intentionally dark, framed like the homepage's
   black banner. The Three.js scene is lit for this backdrop. */
.scene-wrap {
    position: relative;
    min-height: 520px;
    overflow: hidden;
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 20% 0%, rgba(124, 140, 255, 0.18), transparent 30%),
        radial-gradient(circle at 92% 12%, rgba(79, 209, 197, 0.14), transparent 28%),
        linear-gradient(180deg, #060914 0%, #0b1020 54%, #060914 100%);
    background-size: 56px 56px, 56px 56px, auto, auto, auto;
}

#architectureCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#architectureCanvas:active {
    cursor: grabbing;
}

.node-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.node-label {
    position: absolute;
    max-width: 126px;
    padding: 5px 7px;
    border: 1px solid rgba(226, 232, 240, 0.14);
    border-radius: 6px;
    background: rgba(7, 9, 20, 0.72);
    color: var(--scene-text);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.node-label.is-muted {
    display: none;
}

.scene-hint {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid var(--scene-line);
    border-radius: 999px;
    background: rgba(7, 9, 20, 0.76);
    color: var(--scene-muted);
    font-size: 0.78rem;
    font-weight: 500;
    pointer-events: none;
}

.scene-hint i {
    color: var(--gold);
}

/* ── Detail panel ───────────────────────────────────────────── */
.arch-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--ink-2);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-kicker::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink);
}

.arch-panel h2 {
    margin: 0 0 10px;
    color: var(--ink);
    font-family: 'Inter Tight', 'Inter', sans-serif;
    font-size: 1.4rem;
    line-height: 1.18;
    font-weight: 500;
    letter-spacing: -0.015em;
}

.arch-panel p {
    margin: 0;
    color: var(--ink-2);
    font-size: 0.92rem;
    line-height: 1.65;
}

.panel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 18px 0;
}

.panel-tags span {
    padding: 5px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink-2);
    font-size: 0.74rem;
    font-weight: 500;
}

.panel-path {
    padding: 12px 14px;
    border-left: 3px solid var(--dark);
    border-radius: 0 10px 10px 0;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.5;
}

/* ── Reference section ──────────────────────────────────────── */
.arch-reference {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto 80px;
    padding: 32px;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1fr);
    gap: 28px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.reference-copy h2 {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.reference-links {
    display: grid;
    gap: 12px;
}

.reference-card {
    display: grid;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.reference-card:hover {
    opacity: 0.75;
}

.reference-card img {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    object-position: center;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.repo-card {
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
    transition: border-color .2s;
}

.repo-card:hover {
    border-color: var(--ink);
}

.repo-card i {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--dark);
    color: #fff;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.repo-card span {
    display: grid;
    gap: 3px;
    color: var(--ink-2);
    font-size: 0.84rem;
    line-height: 1.35;
}

.repo-card strong {
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1040px) {
    .arch-copy,
    .arch-reference {
        grid-template-columns: 1fr;
    }

    .arch-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 68vh auto;
    }

    .arch-panel {
        min-height: 0;
    }
}

@media (max-width: 720px) {
    .arch-topbar {
        top: 12px;
        left: 12px;
        right: 12px;
        grid-template-columns: 44px 1fr 44px;
    }

    .arch-back,
    .arch-source {
        width: 44px;
        padding: 0;
        justify-content: center;
    }

    .arch-back span,
    .arch-source span {
        display: none;
    }

    .arch-brand {
        min-width: 0;
        justify-content: center;
        padding: 0 12px;
        font-size: 0.78rem;
    }

    .arch-mark {
        display: none;
    }

    .arch-hero {
        padding: 90px 14px 22px;
    }

    .arch-copy h1 {
        font-size: 2.15rem;
        line-height: 1.02;
    }

    .arch-copy p:last-child {
        font-size: 0.92rem;
    }

    .arch-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .arch-shell {
        grid-template-rows: auto minmax(420px, 58vh) auto;
    }

    .arch-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .flow-btn {
        flex: 0 0 auto;
        min-height: 42px;
    }

    .scene-wrap {
        min-height: 420px;
    }

    .node-label {
        max-width: 90px;
        font-size: 0.58rem;
        padding: 4px 5px;
    }

    .scene-hint {
        right: 12px;
        font-size: 0.7rem;
    }

    .arch-reference {
        width: calc(100% - 28px);
        margin-bottom: 44px;
        padding: 18px;
    }
}

@media (max-width: 420px) {
    .arch-topbar {
        left: 10px;
        right: 10px;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 8px;
    }

    .arch-back,
    .arch-source {
        width: 42px;
        min-height: 42px;
    }

    .arch-brand {
        min-height: 42px;
        padding: 0 10px;
        font-size: 0.72rem;
    }

    .arch-hero {
        padding: 84px 10px 18px;
    }

    .arch-copy h1 {
        font-size: 1.85rem;
    }

    .arch-action {
        min-height: 46px;
        justify-content: center;
        text-align: center;
    }

    .arch-shell {
        border-radius: 16px;
        grid-template-rows: auto minmax(360px, 54vh) auto;
    }

    .arch-toolbar {
        padding: 10px;
    }

    .flow-btn {
        padding: 0 12px;
        font-size: 0.74rem;
    }

    .scene-wrap {
        min-height: 360px;
    }

    .scene-hint {
        left: 12px;
        right: 12px;
        bottom: 10px;
        justify-content: center;
        text-align: center;
    }

    .arch-panel {
        padding: 16px;
    }
}
