/* ─── Static page overrides ─── */
html    {
    overflow: auto;
}
body.page {
    height: auto;
    min-height: 100%;
    overflow-x: auto;
    overflow-y: auto;
}

.page-nav a {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.page-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--border);
}

.page-nav a.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--border);
}

.page-main {
    padding: 36px 20px 80px;
}

.page-wrap {
    max-width: 1920px;
    margin: 0 auto;
}

.page-head {
    margin-bottom: 30px;
}

.page-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.15;
}

.page-title .accent { color: var(--strike); }

.page-lede {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}

.page-wrap a { color: var(--accent); text-decoration: none; }
.page-wrap a:hover { text-decoration: underline; }

/* ─── Section headings ─── */
.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 32px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section-head .sec-icon {
    font-size: 18px;
    line-height: 1;
}

.section-head h2 {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.section-head .sec-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 8px;
}

.section-head:first-of-type { margin-top: 0; }

/* ─── Cards ─── */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    line-height: 1.4;
}

.card h3 .bullet {
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}

.card p {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-left: 22px;
}

.card p strong { color: var(--text-primary); }

.card .quote {
    margin-top: 9px;
    padding-left: 22px;
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-primary);
}

/* ─── Sub items ─── */
.sub-list {
    list-style: none;
    margin: 10px 0 0 0;
    padding-left: 22px;
}

.sub-list li {
    position: relative;
    padding: 8px 0 8px 22px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-left: 2px solid var(--border);
    margin-left: 2px;
}

.sub-list li::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 15px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 2px solid var(--accent);
}

.sub-list li strong { color: var(--text-primary); }

.sub-list li .quote {
    display: block;
    margin-top: 5px;
    font-style: italic;
    color: var(--text-primary);
    font-size: 12.5px;
}

/* ─── Status pill ─── */
.pill {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    white-space: nowrap;
}


.pill.planned   { background: rgba(52, 152, 219, 0.15);  color: #3498db; border: 1px solid rgba(52,152,219,0.35); }
.pill.bug       { background: rgba(231, 76, 60, 0.15);   color: #e74c3c; border: 1px solid rgba(231,76,60,0.35); }
.pill.ui        { background: rgba(241, 196, 15, 0.13);  color: #b7950b; border: 1px solid rgba(241,196,15,0.32); }
.pill.perf      { background: rgba(230, 126, 34, 0.15);  color: #e67e22; border: 1px solid rgba(230,126,34,0.35); }
.pill.feature    { background: rgba(181, 45, 0, 0.14);  color: #b5a77c; border: 1px solid rgba(46,204,113,0.32); }
.pill.dream     { background: rgba(155, 89, 182, 0.16);  color: #8e44ad; border: 1px solid rgba(155,89,182,0.35); }

.pill.done   { background: rgba(46, 204, 113, 0.14);  color: #27ae60; border: 1px solid rgba(46,204,113,0.32); }
.card.done { background: rgba(46, 204, 113, 0.1); }

.card.done {
  color: var(--text-quaternary);
  padding:5px;
  font-size: 10px;
}

.card.done p {
   text-decoration: line-through;
   color: var(--text-quaternary);
  font-size: 11px;
}

.card.done span {
   color: var(--text-quaternary);
}

html[data-theme="dark"] .pill.ui    { color: #f1c40f; }
html[data-theme="dark"] .pill.collab { color: #2ecc71; }
html[data-theme="dark"] .pill.dream { color: #b07cd6; }

/* ─── Back link ─── */
.next-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 30px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-panel);
    text-decoration: none !important;
    transition: border-color 0.15s, background 0.15s;
}

.next-link:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.next-link .nl-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    font-weight: 600;
}

.next-link .nl-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.next-link .nl-arrow {
    font-size: 20px;
    color: var(--accent);
}

@media (max-width: 768px) {
    .page-main { padding: 22px 12px 72px; }
    .page-title { font-size: 26px; }
    .page-lede { font-size: 14px; }
    .card { padding: 15px 16px; border-radius: 10px; }
    .page-nav a { padding: 5px 8px; font-size: 11px; }
    .section-head h2 { font-size: 15px; }
    .card p, .sub-list li { font-size: 13px; }
}

/* ─── Flowchart card wrapper ─── */
.flowchart-card {
    padding: 16px 20px 20px;
}
.flowchart-card h3 + p { margin-top: 4px; }

/* Horizontal scroll on narrow viewports, scales up on wide */
.flowchart-wrap {
    margin-top: 16px;
    padding: 12px 4px 4px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    /* Fade-in edge to hint at scrollability */
    background-image:
        linear-gradient(to right,
            var(--bg-dark) 30%,
            transparent 30%,
            transparent 70%,
            var(--bg-dark) 70%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-attachment: local, scroll;
}

/* The SVG itself: fluid up to a max width, min width to stay legible */
.flowchart {
    display: block;
    width: 100%;
    min-width: 720px;   /* anything narrower → horizontal scroll */
    max-width: 1000px;
    height: auto;
    margin: 0 auto;
    color: var(--text-primary);
}

/* Mobile: allow scroll but keep the wrapper tight */
@media (max-width: 768px) {
    .flowchart-wrap {
        padding: 8px 2px 2px;
    }
    .flowchart {
        min-width: 640px;
    }
}