/* ============================================================
   LearnToCodeNinja.com — v6 (mobile-first)
   Base styles target phones; larger screens enhance from there.
   Bump the filename (v6, v7...) when this file changes so
   returning visitors don't get a stale cached copy.
   ============================================================ */

/* ---------- Base (phones) ---------- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f4f4;
    color: #222;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2 {
    margin: 0 0 10px 0;
}

.empty-note {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* ---------- Header ---------- */

.site-header {
    background: #1a1a1a;
    color: #fff;
    padding: 20px 16px;
    text-align: center;
}

.site-header h1 {
    margin: 0 0 4px 0;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}

.site-header .tagline {
    margin: 0;
    color: #bbb;
    font-size: 0.9rem;
}

/* ---------- Site nav (Learning Paths | All Booklets) ---------- */

.site-nav {
    display: flex;
    gap: 6px;
    justify-content: center;
    background: #242424;
    padding: 0 16px 12px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: bold;
    color: #ddd;
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: #fff;
    border-color: #555;
}

.nav-link.nav-current {
    background: #fff;
    color: #1a1a1a;
}

/* ---------- Carousel ---------- */

.carousel-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 12px 6px;
}

.carousel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.carousel-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

/* Pause / play button */
.carousel-toggle {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    background: #fff;
    color: #1a1a1a;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.carousel-toggle:hover {
    background: #1a1a1a;
    color: #fff;
}

.mySwiper {
    width: 100%;
    padding-bottom: 36px; /* space for pagination */
}

.swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
}

.swiper-slide img {
    width: 120px;
    max-width: 100%;
    border-radius: 8px;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    background: #ddd;
}

/* ---------- Gallery: compact 3-column grid on phones ---------- */

.gallery-section {
    max-width: 1100px;
    margin: 22px auto 0;
    padding: 6px 12px;
}

.gallery-section h2 {
    font-size: 1.15rem;
    padding: 0 4px;
}

.gallery-section h2 .count {
    font-weight: normal;
    color: #666;
    font-size: 0.95rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 10px;
    justify-items: center;
}

.card {
    text-align: center;
    min-width: 0; /* lets long titles wrap instead of overflowing */
}

.card-link {
    display: inline-block;
    border-radius: 8px;
    width: 100%;
}

.card img {
    width: 100%;
    border-radius: 8px;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    background: #ddd; /* placeholder color while loading */
}

.card-title {
    font-size: 0.72rem;
    margin: 7px 0 3px;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.card-sub {
    margin: 0;
    font-size: 0.64rem;
    color: #555;
    line-height: 1.4;
}

.badge {
    display: inline-block;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.58rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    padding: 1px 7px;
    border-radius: 999px;
    vertical-align: 1px;
}

.badge-pdf {
    background: #b91c1c;
}

/* ---------- Larger phones / small tablets ---------- */

@media (min-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 22px 14px;
    }
    .card-title {
        font-size: 0.85rem;
    }
    .card-sub {
        font-size: 0.74rem;
    }
    .badge {
        font-size: 0.66rem;
        padding: 2px 8px;
    }
    .swiper-slide img {
        width: 150px;
    }
}

/* ---------- Desktop ---------- */

@media (min-width: 1000px) {
    .site-header {
        padding: 28px 20px;
    }
    .site-header h1 {
        font-size: 1.9rem;
    }
    .site-header .tagline {
        font-size: 1rem;
    }
    .carousel-section {
        padding: 30px 20px 10px;
    }
    .carousel-head h2,
    .gallery-section h2 {
        font-size: 1.5rem;
    }
    .gallery-section {
        padding: 10px 20px;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 28px 20px;
    }
    .card {
        max-width: 220px;
    }
    .card img {
        width: 180px;
    }
    .card-title {
        font-size: 0.98rem;
        margin: 10px 0 4px;
    }
    .card-sub {
        font-size: 0.82rem;
    }
    .badge {
        font-size: 0.7rem;
        padding: 2px 9px;
    }
    .swiper-slide img {
        width: 180px;
    }
}

/* ---------- Footer ---------- */

.site-footer {
    background: #1a1a1a;
    color: #ccc;
    margin-top: 48px;
    padding: 32px 16px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.site-footer h2 {
    color: #fff;
    font-size: 1.05rem;
}

.site-footer p {
    max-width: 70ch;
    font-size: 0.92rem;
}

.site-footer .copyright {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #333;
    font-size: 0.85rem;
    color: #999;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   v4 additions — booklet detail pages (/b/<slug>)
   ============================================================ */

.badge-docx {
    background: #1d4ed8;
}

.badge-level {
    background: #0f766e;
}

.badge-date {
    background: #555;
}

.brand-link {
    color: #fff;
    text-decoration: none;
}

.brand-link:hover {
    text-decoration: underline;
}

.detail-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 16px 8px;
}

.crumbs {
    font-size: 0.8rem;
    color: #666;
    margin: 0 0 14px;
}

.crumbs a {
    color: #1d4ed8;
}

.detail-hero {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 20px 18px;
}

.detail-cover {
    width: 180px;
    max-width: 60%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.detail-title {
    margin: 0 0 10px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.detail-badges {
    margin: 0 0 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-badges .badge {
    font-size: 0.66rem;
    padding: 3px 10px;
}

.detail-desc {
    margin: 0 0 14px;
    font-size: 0.95rem;
    color: #333;
}

.detail-h2 {
    font-size: 1.05rem;
    margin: 0 0 8px;
}

.detail-learn {
    margin: 0 0 16px;
    padding-left: 22px;
    font-size: 0.9rem;
}

.detail-learn li {
    margin-bottom: 5px;
}

.detail-actions {
    margin: 4px 0 10px;
}

.btn-download {
    display: inline-block;
    background: #1d4ed8;
    color: #fff;
    font-weight: bold;
    font-size: 0.95rem;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 8px;
}

.btn-download:hover {
    background: #1e40af;
}

.detail-minis {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.mini-btn {
    background: none;
    border: none;
    padding: 4px 0;
    font-size: 0.82rem;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
}

.mini-btn:hover {
    color: #1d4ed8;
}

.mini-btn.on {
    color: #0f766e;
    font-weight: bold;
    text-decoration: none;
}

.detail-toc {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 20px 18px;
    margin-top: 18px;
}

.detail-toc ol {
    margin: 0;
    padding-left: 24px;
    font-size: 0.9rem;
}

.detail-toc li {
    margin-bottom: 7px;
    padding-right: 8px;
}

.detail-related {
    margin-top: 22px;
}

.detail-relgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.rel-card {
    display: block;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 10px;
    text-decoration: none;
    color: #222;
    text-align: center;
}

.rel-card img {
    border-radius: 4px;
    margin-bottom: 6px;
}

.rel-title {
    display: block;
    font-size: 0.74rem;
    font-weight: bold;
    line-height: 1.3;
}

.saved-mark {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: bold;
    color: #0f766e;
    border: 1px solid #0f766e;
    border-radius: 999px;
    padding: 0 7px;
    margin-left: 6px;
    vertical-align: 2px;
}

/* ---------- Larger phones / small tablets ---------- */

@media (min-width: 600px) {
    .detail-hero {
        flex-direction: row;
        align-items: flex-start;
    }

    .detail-cover {
        flex: 0 0 200px;
        width: 200px;
        max-width: none;
        margin: 0;
    }
}

/* ---------- Desktop ---------- */

@media (min-width: 1000px) {
    .detail-cover {
        flex-basis: 230px;
        width: 230px;
    }

    .detail-title {
        font-size: 1.7rem;
    }
}

/* ============================================================
   v5 additions — learning paths
   ============================================================ */

.page-h1 {
    font-size: 1.5rem;
    margin: 0 0 8px;
}

.page-intro {
    font-size: 0.95rem;
    color: #444;
    margin: 0 0 14px;
    max-width: 62ch;
    line-height: 1.5;
}

.paths-section {
    margin-bottom: 6px;
}

.paths-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
}

.paths-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.paths-all {
    font-size: 0.82rem;
    white-space: nowrap;
}

.paths-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.path-card {
    display: block;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: #222;
}

.path-card:hover {
    border-color: #1d4ed8;
}

.path-card h3 {
    margin: 0 0 6px;
    font-size: 1.02rem;
    color: #1a1a1a;
}

.path-desc {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.45;
}

.path-meta {
    margin: 0 0 10px;
    font-size: 0.78rem;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.path-meta .badge {
    font-size: 0.62rem;
    padding: 2px 9px;
}

.progress-track {
    background: #e8e8e8;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    background: #0f766e;
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width 0.25s ease;
}

.progress-label {
    display: block;
    margin-top: 5px;
    font-size: 0.72rem;
    color: #666;
}

.progress-big .progress-track {
    height: 12px;
}

.path-progresswrap {
    margin: 14px 0 16px;
}

.progress-count {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #333;
}

.progress-count .progress-label {
    margin-top: 0;
    font-size: 0.85rem;
}

.continue-btn {
    margin-bottom: 18px;
}

.path-steps {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 10px 12px;
}

.step-num {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-row.done .step-num {
    background: #0f766e;
}

.step-cover {
    flex: 0 0 52px;
    line-height: 0;
}

.step-cover img {
    border-radius: 4px;
    width: 52px;
    height: auto;
}

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

.step-title {
    font-weight: bold;
    font-size: 0.9rem;
    color: #1a1a1a;
    text-decoration: none;
}

.step-title:hover {
    text-decoration: underline;
}

.step-sub {
    margin: 4px 0 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.step-sub .badge {
    font-size: 0.58rem;
    padding: 1px 7px;
}

.step-toggle {
    flex: 0 0 auto;
}

.path-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.path-navlink {
    font-size: 0.85rem;
}

.path-navlink-next {
    margin-left: auto;
}

.path-strip {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin: 0 0 14px;
}

/* ---------- Larger phones / small tablets ---------- */

@media (min-width: 600px) {
    .paths-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- Desktop ---------- */

@media (min-width: 1000px) {
    .paths-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .page-h1 {
        font-size: 1.7rem;
    }
}

.paths-alt {
    margin: 22px 0 6px;
    font-size: 0.9rem;
    color: #555;
}
