/* ==========================================================================
   Documentation hub + Framework / Machine docs switcher
   ========================================================================== */

.docs-switch {
    background-color: var(--tf-bg);
    border-bottom: 1px solid var(--tf-card-border);
    font-family: var(--tf-font);
}

.docs-switch-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    font-size: 0.95rem;
}

.docs-switch-home,
.docs-switch-sep {
    color: var(--tf-text-muted) !important;
    text-decoration: none !important;
}

.docs-switch-home:hover { color: var(--tf-text-strong) !important; }

.docs-switch-tab {
    color: var(--tf-text-muted) !important;
    padding: 0.2rem 0.8rem;
    border: 1px solid transparent;
    border-radius: var(--tf-radius-pill);
    font-weight: 600;
    text-decoration: none !important;
}

.docs-switch-tab:hover { color: var(--tf-text-strong) !important; }

.docs-switch-tab.is-active {
    color: var(--tf-text-strong) !important;
    border-color: var(--tf-card-border-hover);
    background: var(--tf-ghost-hover-bg);
}

/* Fixed nav already offsets the page; the switcher supplies that offset on docs pages. */
.docs-switch + .handbook { padding-top: 2rem; }

.docs-page {
    color: var(--tf-text);
    font-family: var(--tf-font);
    background-color: var(--tf-bg);
    padding: 3.5rem 0 5rem;
    min-height: calc(100vh - var(--tf-nav-height, 4rem));
    box-sizing: border-box;
}

.docs-page-header { max-width: 42rem; margin-bottom: 2.5rem; }

.docs-page-header h1 {
    color: var(--tf-text-strong);
    font-weight: 700;
    font-size: clamp(2.1rem, 4.5vw, 3.1rem);
    line-height: 1.12;
    margin: 0 0 0.7rem;
}

.docs-page-header p {
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.5;
    margin: 0;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.docs-card {
    display: flex;
    flex-direction: column;
    background: var(--tf-card-bg);
    border: 1px solid var(--tf-card-border);
    border-radius: var(--tf-radius);
    padding: 1.75rem;
}

.docs-card-eyebrow {
    color: var(--tf-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.docs-card h2 { color: var(--tf-text-strong); font-size: 1.6rem; margin: 0 0 0.6rem; }
.docs-card p { line-height: 1.55; }

.docs-card ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.docs-card li { padding: 0.3rem 0; }
.docs-card li a { color: var(--tf-accent); }
.docs-card li .docs-soon { color: var(--tf-text-muted); font-size: 0.85rem; margin-left: 0.4rem; }
.docs-card-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.docs-more { margin-top: 2.5rem; color: var(--tf-text-muted); }
.docs-more a { color: var(--tf-accent); }

@media (max-width: 767.98px) {
    .docs-grid { grid-template-columns: 1fr; }
    .docs-page { padding-top: 2.5rem; }
}

/* Hub cards: the title is the primary link and the whole card responds to hover */
.docs-card { transition: border-color 0.15s ease; }
.docs-card:hover { border-color: var(--tf-card-border-hover); }
.docs-card h2 a { color: inherit !important; text-decoration: none !important; }
.docs-card h2 a:hover { color: var(--tf-accent) !important; }
.docs-card p { max-width: none; }
.docs-card ul { margin-top: 0.5rem; }

.docs-card .docs-card-actions > a { margin: 0; }
.docs-card > p:not(.docs-card-eyebrow) { max-width: none; width: 100%; }

/* Hub cards are descriptions plus actions — no link lists */
.docs-card > p:not(.docs-card-eyebrow) { margin-bottom: 1.75rem; }

/* The site balances text for headings; card descriptions should just fill the card. */
.docs-card > p:not(.docs-card-eyebrow) { text-wrap: pretty; }

/* The whole card is one link: the title's link covers the card (stretched link). */
.docs-card { position: relative; cursor: pointer; }
.docs-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--tf-radius); }
.docs-card h2 a:focus-visible { outline: none; }
.docs-card:has(h2 a:focus-visible) { border-color: var(--tf-accent); }
.docs-card-actions { position: relative; z-index: 1; }

/* Pixel-art card icons (same 1-bit look as the 404 ostrich) */
.docs-card-art {
    position: absolute;
    top: 1.6rem;
    right: 1.75rem;
    height: auto;
    pointer-events: none;
}

.docs-card-art .px-ink { fill: rgba(var(--tf-fg-rgb), 0.85); }
.docs-card-art .px-dim { fill: rgba(var(--tf-fg-rgb), 0.3); }
.docs-card-art .px-acc { fill: var(--tf-accent); }
.docs-card-art .px-cur { fill: var(--tf-accent); animation: px-blink 1.1s steps(1, end) infinite; }
.docs-card-art .px-led { fill: var(--tf-accent); animation: px-blink 1.6s steps(1, end) infinite; }

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

@media (prefers-reduced-motion: reduce) {
    .docs-card-art .px-cur,
    .docs-card-art .px-led { animation: none; }
}

@media (max-width: 575.98px) {
    .docs-card-art { width: 70px; right: 1.25rem; top: 1.25rem; }
}

/* Small icons: a whole 2px per art pixel at every size, so edges stay crisp. */
.docs-card-art { top: 1.4rem; right: 1.5rem; }
.docs-card-art--term { width: 44px; }
.docs-card-art--chip { width: 36px; }

@media (min-width: 576px) {
    /* Keep descriptions clear of the icon in the card corner. */
    .docs-card > p:not(.docs-card-eyebrow) { padding-right: 4rem; }
}

@media (max-width: 575.98px) {
    .docs-card-art { top: 1.3rem; right: 1.25rem; }
}

/* Impressionist backdrop behind the cards (the same painting as the Machine hero) */
.docs-stage {
    position: relative;
    padding: 2.5rem;
    border-radius: 1.25rem;
    overflow: hidden;
    background-color: var(--tf-bg-deep);
    background-image:
        linear-gradient(color-mix(in srgb, var(--tf-bg) 38%, transparent), color-mix(in srgb, var(--tf-bg) 38%, transparent)),
        url("/images/machine-hero.jpg");
    background-size: cover;
    background-position: center 40%;
    border: 1px solid var(--tf-card-border);
}

/* Cards sit on the painting as solid, slightly translucent panels */
.docs-stage .docs-card {
    background: color-mix(in srgb, var(--tf-card-bg) 90%, transparent);
    border-color: rgba(var(--tf-fg-rgb), 0.18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.docs-stage .docs-card:hover { border-color: rgba(var(--tf-fg-rgb), 0.4); }

@media (max-width: 575.98px) {
    .docs-stage { padding: 1rem; border-radius: 1rem; }
}

/* Larger cards, thinner painted border: the painting is a frame, not the main event */
.docs-stage { padding: 1rem; }
.docs-stage .docs-grid { gap: 1rem; }

.docs-stage .docs-card {
    padding: 2.5rem 2.5rem 2.25rem;
    min-height: 20rem;
}

.docs-stage .docs-card h2 { font-size: 2.1rem; margin-bottom: 0.9rem; }
.docs-stage .docs-card > p:not(.docs-card-eyebrow) { font-size: 1.15rem; line-height: 1.5; }
.docs-stage .docs-card-art { top: 2rem; right: 2.25rem; }

@media (max-width: 575.98px) {
    .docs-stage { padding: 0.6rem; }
    .docs-stage .docs-card { padding: 1.75rem 1.5rem; min-height: 0; }
    .docs-stage .docs-card h2 { font-size: 1.8rem; }
    .docs-stage .docs-card > p:not(.docs-card-eyebrow) { font-size: 1.05rem; }
    .docs-stage .docs-card-art { top: 1.5rem; right: 1.4rem; }
}
