/* styles.css — Squan Resources */

/* ── Google Fonts (loaded via HTML) ──────────────────────────────────────── */

/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
    --bg: #0c0e12;
    --bg-alt: #10141c;
    --surface: #181d28;
    --surface-hover: #1e2535;
    --surface-card: #161b26;
    --border: #2a3349;
    --border-subtle: #1f2840;

    /* Text — bumped up for better contrast */
    --text: #e8edf5;
    --text-muted: #9aaec8;
    /* was #68788f — much more readable now */
    --text-dim: #5f728f;
    /* was #3d4d63 */

    /* Brand — matched to SquanGo source */
    --accent: #48cae4;
    /* SquanGo cyan */
    --accent-soft: rgba(72, 202, 228, 0.12);
    --link: #75b3f0;
    /* from SquanGo --border-col */
    --link-hover: #9fceff;

    /* Type badge colors */
    --type-doc: #4dd9a0;
    --type-doc-bg: rgba(77, 217, 160, 0.11);
    --type-video: #f5894e;
    --type-video-bg: rgba(245, 137, 78, 0.11);
    --type-trainer: #a87ef7;
    --type-trainer-bg: rgba(168, 126, 247, 0.11);
    --type-image: #e879c0;
    --type-image-bg: rgba(232, 121, 192, 0.11);
    --type-website: #60c8f0;
    --type-website-bg: rgba(96, 200, 240, 0.11);

    /* Column headings */
    --col-learn: #75b3f0;
    --col-train: #f5a44e;

    --radius-sm: 6px;
    --radius-md: 11px;
    --radius-lg: 15px;
    --radius-xl: 20px;

    --font-body: 'Outfit', system-ui, sans-serif;

    --topbar-h: 56px;
    --max-w: 1200px;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100dvh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

body.modal-open {
    overflow: hidden;
}

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

button {
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    background: none;
}

/* ── Subtle grid texture ──────────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

main,
.topbar {
    position: relative;
    z-index: 1;
}

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
    background: rgba(12, 14, 18, 0.90);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 0;
}

/* SquanGo brand — matched exactly to source */
.squango {
    font-family: var(--font-body);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.18s ease;
    user-select: none;
}

.squango:hover {
    opacity: 0.75;
}

.squango-sq {
    color: #48cae4;
}

.squango-go {
    color: #e0f2fe;
}

.nav-divider {
    width: 1px;
    height: 1.2rem;
    margin: 0 16px;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    border-radius: 1px;
    align-self: center;
}

.topbar-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    transition: color 0.15s;
}

.topbar-link:hover {
    color: var(--text);
}

/* ── Roadmap nudge (desktop only) ────────────────────────────────────────── */
.roadmap-nudge {
    display: none;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 6px 12px 10px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
    opacity: 0.8;
    transition: color 0.2s, transform 0.2s, opacity 0.2s;
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.3) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.3) 100%);
}

.roadmap-nudge:hover {
    color: var(--text);
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
    -webkit-mask-image: none;
    mask-image: none;
}

.roadmap-nudge--left {
    right: auto;
    left: 0;
    padding: 12px 10px 12px 6px;
    transform: translateY(-50%);
    opacity: 0.8;
    -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.3) 100%);
    mask-image: linear-gradient(to left, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.3) 100%);
}

.roadmap-nudge--left:hover {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
    -webkit-mask-image: none;
    mask-image: none;
}

.roadmap-nudge-arrow {
    width: 56px;
    height: 44px;
    transition: transform 0.2s ease;
}

.roadmap-nudge-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.roadmap-nudge:hover .roadmap-nudge-label {
    opacity: 1;
}

@media (min-width: 700px) {
    .roadmap-nudge {
        display: flex;
    }
}

/* ── Mobile page-switch tab ───────────────────────────────────────────────── */
.mobile-page-tab {
    display: none;
}

@media (max-width: 700px) {
    .mobile-page-tab {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: fit-content;
        margin: 28px auto;
        padding: 10px 22px;
        text-decoration: none;
        color: var(--text-muted);
        font-family: var(--font-body);
        font-size: 0.88rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 999px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transform: translateY(10px);
        transition: color 0.15s, opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.1, 0.64, 1);
    }

    .mobile-page-tab.visible {
        opacity: 1;
        pointer-events: all;
        transform: translateY(0);
    }

    .mobile-page-tab:hover {
        color: var(--text);
    }

    .mobile-page-tab svg {
        flex-shrink: 0;
        color: var(--accent);
    }
}

/* ── Main Layout ──────────────────────────────────────────────────────────── */
main {
    max-width: var(--max-w);
    margin: 0 auto;
    /*
     * Reserve space for the fixed left nudge (~96px wide). When the page's natural
     * auto-centering margin already clears the nudge, padding returns to the base 28px.
     * Half of --max-w (1200px) = 600px → that's where auto-centering kicks in.
     */
    --_side-pad: clamp(28px, calc(96px - max(0px, calc(50vw - 600px))), 96px);
    padding: 56px var(--_side-pad) 50px;
    flex: 1;
    width: 100%;
}

/* ── Page Title ───────────────────────────────────────────────────────────── */
.main-title {
    font-size: clamp(2.4rem, 5.5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    cursor: pointer;
    display: inline-block;
    line-height: 1.1;
    transition: opacity 0.18s;
}

.main-title:hover {
    opacity: 0.78;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 42px;
    font-size: 1rem;
    font-weight: 600;
}

/* Shared capsule wrapping both nav buttons */
.bc-nav-capsule {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    border-radius: calc(var(--radius-sm) + 2px);
    overflow: hidden;
}

.bc-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 100%;
    border: none;
    background: transparent;
    color: rgba(233, 239, 245, 0.92);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.bc-nav-btn:hover {
    background: rgba(117, 179, 240, 0.18);
    color: var(--link);
}

.bc-nav-btn.disabled,
.bc-nav-btn[disabled] {
    color: rgba(131, 148, 167, 0.85);
    background: transparent;
    cursor: default;
}

.bc-nav-btn.disabled:hover,
.bc-nav-btn[disabled]:hover {
    background: transparent;
    color: rgba(131, 148, 167, 0.85);
}

.bc-nav-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.bc-nav-btn svg {
    display: block;
    width: 14px;
    height: 14px;
}

/* Search button — mirrors the nav capsule styling, sits after forward */
.bc-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    border-radius: calc(var(--radius-sm) + 2px);
    color: rgba(233, 239, 245, 0.92);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.bc-search-btn:hover {
    background: rgba(117, 179, 240, 0.18);
    border-color: rgba(117, 179, 240, 0.4);
    color: var(--link);
}

.bc-search-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.bc-search-btn svg {
    display: block;
}

/* Thin divider between the two nav buttons inside the capsule */
.bc-nav-inner-sep {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

/* Vertical rule separating capsule from path */
.bc-vdiv {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

/* Folder icon anchoring the path section */
.bc-folder-icon {
    display: flex;
    align-items: center;
    color: var(--text-dim);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.bc-link {
    color: var(--link);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 4px 7px;
    margin: -4px -7px;
    transition: color 0.15s, background 0.15s;
}

.bc-link:hover {
    color: var(--link-hover);
    background: rgba(117, 179, 240, 0.10);
}

/* Slash separator — visually distinct from nav chevrons */
.bc-sep {
    color: var(--text-dim);
    padding: 0 2px;
    font-size: 0.9rem;
    font-weight: 400;
    user-select: none;
    line-height: 1;
}

/* ── Unified card grid for folders and resources ─────────────────────────── */
.card-grid,
.folder-grid,
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.folder-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 24px 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
    user-select: none;
    min-height: 120px;
    outline: none;
}

.folder-card:hover,
.folder-card:focus-visible {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.folder-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.015em;
}

.folder-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 7px;
    line-height: 1.55;
    white-space: pre-line;
}

.folder-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.folder-count {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: monospace;
}

.folder-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--text-dim);
    transition: color 0.12s, transform 0.12s;
}

.folder-arrow svg {
    display: block;
}

.folder-card:hover .folder-arrow,
.folder-card:focus-visible .folder-arrow {
    color: var(--text-muted);
    transform: translateX(3px);
}

/* ── Resource flat grid (Leaf pages — Learn / Train) ─────────────────────── */
/* Both columns share one grid so row heights equalize naturally */
.leaf-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: -20px;
    margin-bottom: 28px;
    white-space: pre-line;
}

.resource-flat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 28px;
    align-items: stretch;
    position: relative;
}

/* Center divider via pseudo-element */
.resource-flat-grid::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-14px);
    background: var(--border);
    pointer-events: none;
}

/* Column headings */
.col-heading {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid currentColor;
    margin-bottom: 2px;
}

.col-learn {
    color: var(--col-learn);
}

.col-train {
    color: var(--col-train);
}

.col-empty {
    color: var(--text-dim);
    border-bottom-color: var(--border);
}

/* Cards fill their full row height so cross-column pairs match */
.resource-flat-grid .resource-card {
    height: 100%;
}

/* Invisible balance placeholder — takes space, shows nothing */
.resource-card-placeholder {
    visibility: hidden;
    pointer-events: none;
    height: 100%;
}

.empty-col {
    font-size: 0.9rem;
    color: var(--text-dim);
    text-align: center;
    padding: 36px 0;
}

/* ── Misc unified grid ────────────────────────────────────────────────────── */
.card-grid,
.folder-grid,
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ── Resource Card ────────────────────────────────────────────────────────── */
.resource-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 13px;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, transform 0.15s, box-shadow 0.15s;
    outline: none;
}

.resource-card:hover,
.resource-card:focus-visible {
    background: var(--surface-hover);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
}

.resource-card-top {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.resource-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.3;
    text-decoration: none;
    display: inline;
    transition: color 0.14s;
}

.resource-title:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-decoration-color: rgba(159, 206, 255, 0.5);
    text-underline-offset: 3px;
}

.resource-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.58;
    white-space: pre-line;
}

.resource-card-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.resource-credit {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    margin-top: 2px;
    margin-bottom: 4px;
}

.resource-credit em {
    font-style: italic;
    color: var(--accent);
}

.modal-credit {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-top: 6px;
    line-height: 1.5;
}

.modal-credit em {
    font-style: italic;
    color: var(--accent);
}

/* ── Featured card ────────────────────────────────────────────────────────── */
.resource-card--featured {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--surface-card) 60%, rgba(72, 202, 228, 0.06));
    position: relative;
}

.resource-card--featured::before {
    content: '★';
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.7rem;
    color: var(--accent);
    opacity: 0.7;
    line-height: 1;
}

.resource-card--featured:hover,
.resource-card--featured:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 6px 24px rgba(72, 202, 228, 0.12);
}

/* ── Type Badges ──────────────────────────────────────────────────────────── */
.type-badge {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
}

.type-doc-sheet {
    color: var(--type-doc);
    background: var(--type-doc-bg);
}

.type-video {
    color: var(--type-video);
    background: var(--type-video-bg);
}

.type-trainer {
    color: var(--type-trainer);
    background: var(--type-trainer-bg);
}

.type-image {
    color: var(--type-image);
    background: var(--type-image-bg);
}

.type-website {
    color: var(--type-website);
    background: var(--type-website-bg);
}

.type-other {
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.07);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(6, 8, 12, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    /* stronger border + highlight so it pops from bg */
    border: 1px solid var(--border);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 28px 90px rgba(0, 0, 0, 0.65);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 860px;
    max-height: 90dvh;
    overflow-y: auto;
    padding: 36px 36px 30px;
    position: relative;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.24s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.modal-backdrop.active .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding-right: 40px;
}

.modal-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
    flex: 1;
    text-decoration: none;
    transition: color 0.14s;
}

.modal-title:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.modal-sep {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ── Modal body — desktop: desc left, visual right ────────────────────────── */
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-body.has-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 22px;
    align-items: start;
}

.modal-desc {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.68;
    white-space: pre-line;
}

/* Slot management for desktop/mobile visual positioning */
.modal-visual-mobile {
    display: none;
}

.modal-visual-desktop {
    grid-column: 2;
    grid-row: 1;
}

/* Shared visual wrapper — hidden by default, revealed on load */
.modal-visual-wrap {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: transparent;
    opacity: 0;
    /* small delay so fade-in lands in sync with the modal open animation (0.24s) */
    transition: opacity 0.18s ease 0.1s;
}

.modal-visual-wrap.visual-loaded {
    opacity: 1;
}

/* iframe-specific */
.modal-iframe-wrap {
    aspect-ratio: 16 / 9;
}

.modal-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* image-specific */
.modal-img-wrap img {
    width: 100%;
    display: block;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* On desktop, prevent a tall image from making the modal scroll on its own.
   Cap height to fit within the modal's 90dvh max, minus fixed chrome
   (padding-top 36 + header ~52 + sep ~41 + actions ~68 + padding-bottom 30 ≈ 227px).
   Use contain so the full image is visible rather than cropped. */
@media (min-width: 701px) {
    .modal-visual-desktop .modal-img-wrap {
        display: flex;
        justify-content: center;
        border: none;
    }

    .modal-visual-desktop .modal-img-wrap img {
        max-height: calc(90dvh - 235px);
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }
}

/* Visit button */
.modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.modal-visit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(72, 202, 228, 0.28);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.modal-visit-btn:hover {
    background: rgba(72, 202, 228, 0.22);
    border-color: rgba(72, 202, 228, 0.48);
}

.modal-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: var(--surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.modal-share-btn:hover {
    color: var(--text);
    border-color: var(--text-dim);
    background: var(--surface-card);
}

/* Copy button: visually matches share button */
.modal-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.modal-copy-btn:hover {
    color: var(--text);
    border-color: var(--text-dim);
    background: var(--surface-card);
}

/* Flash state for successful copy/share */
.copied-flash {
    background: var(--type-doc-bg);
    border-color: rgba(77, 217, 160, 0.36);
    color: var(--type-doc);
    box-shadow: 0 6px 20px rgba(77, 217, 160, 0.08);
}

/* ── Feedback button (topbar) ─────────────────────────────────────────────── */
.topbar-feedback-btn {
    margin-left: auto;
    padding: 0.5em 0.9em;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.11);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ── Feedback modal ────────────────────────────────────────────────────────── */
.feedback-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(6, 8, 12, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}

.feedback-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.feedback-backdrop .modal {
    max-width: 400px;
}

.feedback-backdrop.active .modal {
    transform: translateY(0) scale(1);
}

.feedback-body {
    color: var(--text-muted);
    font-size: 0.97rem;
    line-height: 1.65;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-body b {
    font-weight: 700;
    color: #c4d3e8;
}

.feedback-link {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(117, 179, 240, 0.45);
    transition: color 0.14s;
}

.feedback-link:hover {
    color: var(--link-hover);
}

/* ── Not Found ────────────────────────────────────────────────────────────── */
.not-found {
    text-align: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.not-found p {
    margin-bottom: 20px;
    font-size: 1rem;
}

.not-found button {
    background: var(--surface);
    color: var(--link);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 26px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.not-found button:hover {
    background: var(--surface-hover);
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* ── Content fade-in ──────────────────────────────────────────────────────── */
.content-area {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(7px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Site footer credit ───────────────────────────────────────────────────── */
.site-footer {
    margin-top: auto;
    padding-top: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.6;
}

/* ── Mobile tab bar (hidden on desktop) ───────────────────────────────────── */
.mobile-tab-bar {
    display: none;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    main {
        padding: 36px 18px 0;
    }

    /* ── Tab bar ── */
    .mobile-tab-bar {
        display: flex;
        gap: 0;
        margin-bottom: 20px;
        background: var(--surface-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .mobile-tab {
        flex: 1;
        padding: 12px 10px;
        font-family: var(--font-body);
        font-size: 0.9rem;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        border: none;
        cursor: pointer;
        background: transparent;
        color: var(--text-dim);
        transition: color 0.15s, background 0.15s;
        position: relative;
    }

    /* Separator between tabs */
    .mobile-tab:first-child {
        border-right: 1px solid var(--border);
    }

    .mobile-tab.active-learn {
        color: var(--col-learn);
        background: rgba(117, 179, 240, 0.08);
    }

    .mobile-tab.active-train {
        color: var(--col-train);
        background: rgba(245, 164, 78, 0.08);
    }

    /* Bottom-edge indicator line */
    .mobile-tab::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        border-radius: 2px 2px 0 0;
        background: transparent;
        transition: background 0.15s;
    }

    .mobile-tab.active-learn::after {
        background: var(--col-learn);
    }

    .mobile-tab.active-train::after {
        background: var(--col-train);
    }

    /* ── Flat grid collapses to single column; tabs control visibility ── */
    .resource-flat-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .resource-flat-grid::after {
        display: none;
    }

    .resource-flat-grid[data-active="learn"] [data-col="train"] {
        display: none;
    }

    .resource-flat-grid[data-active="train"] [data-col="learn"] {
        display: none;
    }

    .resource-card-placeholder {
        display: none;
    }

    .col-heading {
        display: none;
    }

    /* ── Modal ── */
    .modal {
        padding: 26px 22px 24px;
        border-radius: var(--radius-lg);
        max-height: 93dvh;
    }

    .modal-body.has-visual {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .modal-visual-mobile {
        display: block;
    }

    .modal-visual-desktop {
        display: none;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-desc {
        font-size: 0.95rem;
    }

    /* Allow modal action buttons to wrap naturally on small screens */
    .modal-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Ensure copied flash styling wins even when hovered */
    .modal-share-btn.copied-flash,
    .modal-copy-btn.copied-flash {
        background: var(--type-doc-bg);
        border-color: rgba(77, 217, 160, 0.36);
        color: var(--type-doc);
        box-shadow: 0 6px 20px rgba(77, 217, 160, 0.08);
    }

    .modal-share-btn.copied-flash:hover,
    .modal-copy-btn.copied-flash:hover {
        background: var(--type-doc-bg);
        border-color: rgba(77, 217, 160, 0.36);
        color: var(--type-doc);
    }

    .card-grid,
    .folder-grid,
    .resource-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 16px;
    }

    .main-title {
        font-size: 2rem;
    }

    .resource-card {
        padding: 16px 16px 13px;
    }

    .folder-card {
        padding: 20px 18px 15px;
    }
}

/* ── Search modal ─────────────────────────────────────────────────────────── */
.search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(6, 8, 12, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 84px 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.search-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.search-modal {
    max-width: 620px;
    padding: 0;
    overflow: hidden;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.search-input-icon {
    color: var(--text-dim);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
}

.search-input::placeholder {
    color: var(--text-dim);
}

.search-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.search-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.search-results {
    max-height: min(56dvh, 460px);
    overflow-y: auto;
    padding: 8px;
}

.search-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.12s;
}

.search-result:hover,
.search-result.active {
    background: var(--surface-hover);
}

.search-result-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--text-dim);
}

.search-result.is-folder .search-result-icon {
    color: var(--accent);
}

.search-result-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.search-result-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-tag {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

.search-result-crumb {
    font-size: 0.8rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
