/* Shared stylesheet for the Minna no Nihongo Part 2 index page. */
.mn {
        --ink:      #14181f;   /* sumi black          */
        --ink-2:    #2b3340;
        --paper:    #f7f5f1;   /* washi paper         */
        --line:     #e2ddd4;
        --vermil:   #0d6efd;   /* site brand blue     */
        --muted:    #6b7280;
        --serif:    "Noto Serif JP", Georgia, serif;
        --sans:     "Inter", -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;

        background: var(--paper);
        color: var(--ink);
        font-family: var(--sans);
        -webkit-font-smoothing: antialiased;
    }
    .mn .jp { font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", var(--sans); }

    /* ============================================================== top */
    .mn-top {
        background: var(--ink);
        color: #fff;
        padding: 84px 0 78px;
        position: relative;
        overflow: hidden;
    }
    /* a large, very quiet kanji watermark */
    .mn-top::before {
        content: "文法";
        position: absolute;
        right: 30%;
        top: 50%;
        transform: translateY(-50%);
        font-family: var(--serif);
        font-size: 15rem;
        font-weight: 700;
        line-height: 1;
        color: rgba(255,255,255,.035);
        letter-spacing: .1em;
        pointer-events: none;
        user-select: none;
    }
    .mn-top .container { position: relative; z-index: 1; }
    .kicker {
        display: inline-flex;
        align-items: center;
        gap: .55rem;
        font-size: .74rem;
        font-weight: 700;
        letter-spacing: .18em;
        text-transform: uppercase;
        color: #fff;
        border: 1px solid rgba(255,255,255,.28);
        border-radius: 2px;
        padding: .42rem .85rem;
    }
    .kicker i { color: var(--vermil); }
    .mn-top h1 {
        font-family: var(--serif);
        font-weight: 700;
        font-size: clamp(2.1rem, 5vw, 3.4rem);
        line-height: 1.18;
        letter-spacing: -.01em;
        margin: 1.5rem 0 0;
    }
    .mn-top h1 .thin { color: #9aa3b0; font-weight: 500; }
    .rule {
        width: 62px;
        height: 3px;
        background: var(--vermil);
        margin: 1.5rem 0;
    }
    .mn-top .ja {
        font-size: 1.12rem;
        color: #b9c0cb;
        letter-spacing: .08em;
        margin-bottom: 1.1rem;
    }
    .mn-top .intro {
        color: #cfd4dc;
        font-size: 1.03rem;
        line-height: 1.85;
        max-width: 56ch;
        margin: 0;
    }
    .facts {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        margin-top: 2.6rem;
        border-top: 1px solid rgba(255,255,255,.14);
        padding-top: 1.6rem;
    }
    .fact { padding-right: 2.6rem; margin-right: 2.6rem; border-right: 1px solid rgba(255,255,255,.14); }
    .fact:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
    /* the book cover on the right of the top section */
    .cover-wrap { display: flex; justify-content: center; }
    .cover {
        position: relative;
        max-width: 268px;
        width: 100%;
    }
    .cover img {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 2px 5px 5px 2px;
        box-shadow:
            0 2px 4px rgba(0,0,0,.35),
            0 22px 48px -12px rgba(0,0,0,.75);
    }
    /* the spine edge, so the cover reads as a physical book */
    .cover::before {
        content: "";
        position: absolute;
        left: 0; top: 0; bottom: 0;
        width: 11px;
        border-radius: 2px 0 0 2px;
        background: linear-gradient(90deg, rgba(0,0,0,.42), rgba(0,0,0,.10) 60%, rgba(255,255,255,.16));
        pointer-events: none;
        z-index: 2;
    }
    @media (max-width: 991.98px) {
        .cover-wrap { margin-top: 2.75rem; }
        .cover { max-width: 200px; }
    }

    .fact b { display: block; font-family: var(--serif); font-size: 1.65rem; font-weight: 700; line-height: 1.3; }
    .fact span { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: #8d95a2; }

    /* ========================================================== heading */
    .head-row {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 1.5rem;
        padding-bottom: 1.3rem;
        border-bottom: 1px solid var(--line);
        margin-bottom: 2.6rem;
    }
    .head-row h2 {
        font-family: var(--serif);
        font-weight: 700;
        font-size: clamp(1.5rem, 3vw, 2.05rem);
        margin: 0;
    }
    .head-row p { color: var(--muted); margin: .45rem 0 0; font-size: .97rem; }
    .head-count {
        font-family: var(--serif);
        font-size: .88rem;
        color: var(--muted);
        white-space: nowrap;
        padding-bottom: .3rem;
    }

    /* ============================================================ cards */
    .lesson {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 320px;
        padding: 30px 30px 26px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 3px;
        text-decoration: none;
        color: inherit;
        position: relative;
        transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    }
    /* the vermilion rule that grows on hover */
    .lesson::before {
        content: "";
        position: absolute;
        left: -1px; top: -1px;
        width: 3px; height: 58px;
        background: var(--vermil);
        transition: height .28s ease;
    }
    .lesson:hover, .lesson:focus-visible {
        color: inherit;
        transform: translateY(-4px);
        border-color: #cfc7ba;
        box-shadow: 0 18px 34px -18px rgba(20,24,31,.30);
    }
    .lesson:hover::before, .lesson:focus-visible::before { height: calc(100% + 2px); }

    .lesson-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: .9rem;
    }
    .lesson-no {
        font-family: var(--serif);
        font-size: 2.9rem;
        font-weight: 700;
        line-height: 1;
        color: var(--ink);
        letter-spacing: -.02em;
    }
    .lesson-ja {
        font-size: .85rem;
        color: var(--muted);
        letter-spacing: .12em;
    }
    .lesson-name {
        font-family: var(--serif);
        font-size: 1.24rem;
        font-weight: 600;
        line-height: 1.4;
        margin: 0 0 .6rem;
    }
    .lesson-desc {
        font-size: .93rem;
        line-height: 1.75;
        color: var(--muted);
        margin: 0 0 1.3rem;
    }
    .tags {
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        gap: .4rem;
        padding: 0;
        margin: 0 0 1.4rem;
    }
    .tags li {
        font-size: .82rem;
        line-height: 1.6;
        padding: .22rem .6rem;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: 2px;
        color: var(--ink-2);
    }
    .lesson-go {
        margin-top: auto;
        padding-top: 1.1rem;
        border-top: 1px solid var(--line);
        font-size: .84rem;
        font-weight: 600;
        letter-spacing: .04em;
        color: var(--ink);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .lesson-go i { color: var(--vermil); transition: transform .2s ease; }
    .lesson:hover .lesson-go i { transform: translateX(5px); }

    @media (max-width: 575.98px) {
        .mn-top { padding: 60px 0 54px; }
        .mn-top::before { font-size: 9rem; opacity: .6; }
        .fact { padding-right: 1.5rem; margin-right: 1.5rem; }
        .lesson { padding: 24px 22px 22px; min-height: 0; }
        .lesson-no { font-size: 2.3rem; }
    }

/* Section buttons in the dark top area (grammar <-> vocabulary, other part) */
.mn-top-links { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 2rem; }
.mn-top-links a {
    display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1.05rem; border-radius: 999px;
    font-weight: 600; font-size: .92rem; text-decoration: none; color: #14181f; background: #fff;
}
.mn-top-links a:hover { background: #ffc107; color: #14181f; }
.mn-top-links a.alt { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.mn-top-links a.alt:hover { background: rgba(255,255,255,.12); color: #fff; }

/* "Vocabulary · N words" tab under each grammar lesson card */
.mn-vlink-col { display: flex; flex-direction: column; }
.mn-vlink-col > .lesson { flex: 1 1 auto; height: auto; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.mn-card-vocab {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .65rem 1.1rem; background: #14181f; color: #fff; text-decoration: none;
    font-size: .85rem; font-weight: 600; border-radius: 0 0 3px 3px; transition: background .15s ease;
}
.mn-card-vocab:hover { background: #0d6efd; color: #fff; }
.mn-card-vocab i.bi-translate { margin-right: .35rem; opacity: .8; }
