/* ==============================
   TUTORIALS — shared styles
   Reuses the exact brand tokens from index.css (dark, ink-black/glow-red)
   rather than inventing a parallel palette — tutorials should read as an
   extension of the main site, not a separate microsite.
   ============================== */
:root {
    --ink-black: #0a0a0a;
    --deep-black: #000000;
    --splash-white: #ffffff;
    --off-white: #f5f5f5;
    --accent-silver: #c0c0c0;
    --dark-ember: rgba(120, 0, 0, 0.6);
    --glow-red: #ff2800;
    --glow-red-dim: rgba(255, 40, 0, 0.14);
    --border: rgba(255, 255, 255, 0.10);
    --border-soft: rgba(255, 255, 255, 0.06);
    --card-bg: rgba(255, 255, 255, 0.03);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    /* Nonzero so .tut-subnav's margin-top below can't collapse through into
       body (which would silently erase the gap it creates) — this pixel is
       never visible, it's just a margin-collapse guard. */
    padding-top: 1px;
    background: var(--ink-black);
    color: var(--off-white);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.65;
}

a { color: inherit; }

/* ---------- Sticky sub-nav (individual tutorial pages only) ----------
   Tutorial pages load inside documentation.html's #docFrame, which already
   supplies logo/download chrome — this is pure content-level wayfinding
   (back to the list, prev/next tutorial) the shell can't provide since it
   doesn't know the tutorial-to-tutorial order. Deliberately lighter than
   the old full .tut-header this replaces: no logo, no CTA button, just
   three small links, so it doesn't reintroduce a second masthead. */
.tut-subnav {
    position: sticky;
    top: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 14px;
    padding: 0.7rem 1.5rem;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 40, 0, 0.18);
}

.tut-subnav-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    color: var(--accent-silver);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}
.tut-subnav-back:hover { color: var(--glow-red); }
.tut-subnav-back svg { width: 14px; height: 14px; flex-shrink: 0; display: block; }

.tut-subnav-adjacent {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.tut-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    color: var(--accent-silver);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}
.tut-subnav-link svg { width: 14px; height: 14px; flex-shrink: 0; display: block; }
.tut-subnav-link.next { color: var(--splash-white); }
.tut-subnav-link:hover,
.tut-subnav-link.next:hover { color: var(--glow-red); }

@media (max-width: 640px) {
    .tut-subnav { padding: 0.6rem 1rem; }
    .tut-subnav-back span.subnav-label { display: none; }
    .tut-subnav-link.prev span.subnav-label { display: none; }
    .tut-subnav-link.next span.subnav-label {
        display: inline-block;
        max-width: 38vw;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: bottom;
    }
    .tut-subnav-adjacent { gap: 0.6rem; }
}

/* ==============================
   HUB PAGE — learning path
   ============================== */
.tut-hub {
    max-width: 900px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 6rem;
}

.tut-hub-head {
    margin-bottom: 3rem;
}

.tut-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--glow-red);
    margin-bottom: 1rem;
}
.tut-kicker::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--glow-red);
    box-shadow: 0 0 12px 2px var(--glow-red-dim);
}

.tut-hub-head h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    color: var(--splash-white);
    margin: 0 0 0.85rem;
    text-wrap: balance;
    letter-spacing: -0.01em;
}

.tut-hub-head p {
    max-width: 60ch;
    color: var(--accent-silver);
    font-size: 1.05rem;
    margin: 0;
}

/* The path — a connected, numbered sequence (order carries real meaning
   here: each tutorial builds on the last), not an order-independent card
   grid like the reference-docs feature list uses. */
.tut-path {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tut-path::before {
    content: '';
    position: absolute;
    left: 27px;
    top: 36px;
    bottom: 36px;
    width: 1px;
    background: linear-gradient(180deg, var(--border) 0%, var(--border) 100%);
}

.tut-path-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    text-decoration: none;
    color: inherit;
}

.tut-path-num {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--deep-black);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--accent-silver);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.tut-path-item:hover .tut-path-num {
    border-color: var(--glow-red);
    color: var(--splash-white);
    background: var(--dark-ember);
}

.tut-path-body {
    flex: 1;
    min-width: 0;
    padding-top: 0.35rem;
}

.tut-path-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.tut-path-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--splash-white);
}

.tut-path-time {
    font-size: 0.78rem;
    color: var(--accent-silver);
    white-space: nowrap;
}
.tut-path-time::before { content: '·'; margin-right: 0.7rem; }

.tut-path-track {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--glow-red);
    background: var(--glow-red-dim);
    border: 1px solid rgba(255,40,0,0.3);
    border-radius: 4px;
    padding: 0.18rem 0.55rem;
    white-space: nowrap;
}

.tut-path-desc {
    color: var(--accent-silver);
    font-size: 0.95rem;
    max-width: 60ch;
}

.tut-path-arrow {
    align-self: center;
    flex-shrink: 0;
    width: 18px; height: 18px;
    color: var(--border);
    transition: transform 0.2s ease, color 0.2s ease;
}
.tut-path-item:hover .tut-path-arrow {
    transform: translateX(4px);
    color: var(--glow-red);
}

/* ==============================
   TUTORIAL PAGE
   ============================== */
.tut-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
}

.tut-meta-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

.tut-step-pill {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--glow-red);
    background: var(--glow-red-dim);
    border: 1px solid rgba(255,40,0,0.3);
    border-radius: 4px;
    padding: 0.3rem 0.75rem;
}

.tut-time {
    font-size: 0.85rem;
    color: var(--accent-silver);
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}
.tut-time svg { width: 14px; height: 14px; }

.tut-page h1 {
    font-size: clamp(1.9rem, 4.5vw, 2.5rem);
    font-weight: 800;
    color: var(--splash-white);
    margin: 0 0 0.9rem;
    text-wrap: balance;
    letter-spacing: -0.01em;
}

.tut-intro {
    font-size: 1.08rem;
    color: var(--accent-silver);
    margin-bottom: 2.75rem;
    padding-bottom: 2.25rem;
    border-bottom: 1px solid var(--border-soft);
}

/* Step sections */
.tut-step {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2.75rem;
    scroll-margin-top: 76px;
}

.tut-step-num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--deep-black);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--off-white);
    margin-top: 0.15rem;
}

.tut-step-body { flex: 1; min-width: 0; }

.tut-step h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--splash-white);
    margin: 0 0 0.6rem;
}

.tut-step p {
    color: var(--off-white);
    font-size: 1rem;
    margin: 0 0 1rem;
}
.tut-step p:last-child { margin-bottom: 0; }

.tut-step ul {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--off-white);
}
.tut-step li { margin-bottom: 0.4rem; }

.tut-step strong { color: var(--splash-white); }

/* Screenshot frame — same shadow/border language as the homepage showcase */
.tut-shot {
    margin: 1.1rem 0 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.75);
    background: #0c0c14;
}
.tut-shot img {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
    transition: filter 0.15s ease;
}
.tut-shot img:hover { filter: brightness(1.06); }
.tut-shot-caption {
    margin: 0.6rem 0 0;
    font-size: 0.82rem;
    color: var(--accent-silver);
    text-align: center;
}

/* Click-to-enlarge lightbox — screenshots are 1920px shots squeezed into a
   ~700px reading column, so small UI text/labels can be hard to read at
   that scale. A cursor-following magnifier only shows a small circle at a
   time (an e-commerce pattern for inspecting texture, not for reading a
   whole screenshot) and has no mobile equivalent since there's no hover;
   click-to-enlarge works identically via tap or click and actually solves
   the readability problem instead of a flashier one. See js/tut-lightbox.js. */
.tut-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: zoom-out;
    animation: tutLightboxFadeIn 0.15s ease;
}
.tut-lightbox-overlay.open { display: flex; }
.tut-lightbox-overlay img {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 8px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
    cursor: default;
}
.tut-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.7);
    color: var(--off-white);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.tut-lightbox-close:hover { border-color: var(--glow-red); background: rgba(255, 40, 0, 0.15); }
.tut-lightbox-close svg { width: 18px; height: 18px; display: block; }
@keyframes tutLightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tut-callout {
    display: flex;
    gap: 0.75rem;
    margin: 1.1rem 0 0;
    padding: 1rem 1.15rem;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-left: 2px solid var(--glow-red);
    border-radius: 6px;
    font-size: 0.92rem;
    color: var(--accent-silver);
}
.tut-callout svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--glow-red); margin-top: 0.1rem; }

/* Prev/Next footer nav */
.tut-nav-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-soft);
}

.tut-nav-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    background: var(--card-bg);
    transition: border-color 0.15s ease, background 0.15s ease;
    min-width: 0;
}
.tut-nav-card:hover { border-color: rgba(255,255,255,0.24); background: rgba(255,255,255,0.05); }
.tut-nav-card.next { text-align: right; align-items: flex-end; }

.tut-nav-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-silver);
    display: flex;
    align-items: center;
    gap: 0.4em;
}
.tut-nav-label svg { width: 13px; height: 13px; }

.tut-nav-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--splash-white);
}

.tut-all-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.88rem;
    color: var(--accent-silver);
    text-decoration: none;
}
.tut-all-link:hover { color: var(--splash-white); }

@media (max-width: 640px) {
    .tut-nav-footer { grid-template-columns: 1fr; }
    .tut-nav-card.next { text-align: left; align-items: flex-start; }
    .tut-path::before { left: 23px; }
    .tut-path-num { width: 48px; height: 48px; font-size: 1rem; }
}
