/* The flash cards page: /flashcards/ — the category tabs, the deck tiles and
   the study card. The cards' own words come from flashcards/decks/*.js. */

/* A category that sets `font` gets its script's typeface on every card face.
   Latin text inside falls through to Inter. */
body[data-font="tamil"] {
    --card-font: "Noto Sans Tamil", "Inter", system-ui, sans-serif;
}
[lang^="ta"] {
    font-family: "Noto Sans Tamil", "Inter", system-ui, sans-serif;
}

kbd {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(27, 34, 64, 0.08);
    margin-left: 8px;
}
.btn-primary kbd {
    background: rgba(255, 255, 255, 0.22);
}

.mini {
    border: 1.5px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 600;
    font-size: 13.5px;
    transition:
        background 0.15s,
        border-color 0.15s;
}
.mini:hover {
    background: var(--tint);
    border-color: var(--blue);
}

/* ---------- HEAD ---------- */
.fc-head {
    padding-block: 44px 22px;
}
.fc-head h1 {
    font-size: clamp(32px, 4.4vw, 50px);
    font-weight: 700;
    margin-top: 18px;
}
.fc-head .lead {
    font-size: 18px;
    color: var(--ink-soft);
    max-width: 580px;
    margin-top: 16px;
}
.fc-cats {
    margin-top: 24px;
}
.fc-cats .native {
    margin-left: 4px;
    font-weight: 600;
}

/* ---------- DECK TILES ---------- */
.deck-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.deck-grid[hidden] {
    display: none;
}
.deck {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    transition:
        transform 0.18s,
        box-shadow 0.18s,
        border-color 0.18s;
}
.deck:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
    border-color: var(--blue);
}
.deck-sample {
    font-size: 30px;
    font-weight: 700;
    color: var(--blue-deep);
    background: var(--tint);
    border-radius: var(--r-md);
    padding: 14px 16px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.04em;
}
.deck:nth-child(2) .deck-sample {
    background: var(--tint-warm);
    color: #b5520f;
}
.deck:nth-child(3) .deck-sample {
    background: #e6fbf6;
    color: #0b7c6f;
}
.deck-name {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}
.deck-eng {
    font-size: 14px;
    color: var(--ink-soft);
}
.meter {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: var(--tint);
    overflow: hidden;
    margin-top: 10px;
}
.meter i {
    display: block;
    height: 100%;
    background: var(--teal);
    border-radius: 999px;
    min-width: 0;
    transition: width 0.3s;
}
.deck-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-family: "DM Mono", monospace;
    font-size: 12px;
    color: var(--ink-soft);
}
.deck-foot .due {
    color: var(--coral);
    font-weight: 500;
}
.deck-go {
    margin-top: 10px;
    font-weight: 600;
    color: var(--blue);
}

/* ---------- STUDY ---------- */
.study[hidden] {
    display: none;
}
.study-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.study-bar h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}
.study-bar h2 small {
    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-left: 6px;
    letter-spacing: 0;
}
.study-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--ink-soft);
}
.fc-rows {
    margin-top: 14px;
    gap: 6px;
}
.fc-rows[hidden] {
    display: none;
}
.fc-rows .row {
    font-size: 17px;
    min-width: 42px;
    padding: 5px 10px;
    color: var(--ink);
}

.fc-stage {
    max-width: 560px;
    margin: 22px auto 0;
    display: grid;
    gap: 18px;
}

.card {
    position: relative;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-lift);
    min-height: 380px;
    padding: 18px 22px 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    font-family: var(--card-font, "Inter", sans-serif);
    animation: deal 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card[hidden] {
    display: none;
}
.card.flipped {
    cursor: default;
    background: linear-gradient(180deg, var(--surface), #fbfaf4);
    animation: turn 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes deal {
    from {
        opacity: 0;
        transform: translateY(12px) rotate(-1.5deg);
    }
}
@keyframes turn {
    from {
        transform: perspective(900px) rotateY(-70deg);
    }
}
.card-top {
    align-self: stretch;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
}
.tag {
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: var(--tint);
    border-radius: 999px;
    padding: 4px 11px;
}
.tag.new {
    background: var(--coral);
    color: #fff;
}
.read-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--tint);
    font-size: 18px;
    transition: background 0.15s;
}
.read-btn:hover {
    background: var(--yellow);
}
.read-btn[hidden] {
    display: none;
}

/* the letter itself — big enough to read from across the table */
.glyph {
    font-size: clamp(110px, 24vw, 168px);
    font-weight: 600;
    line-height: 1.15;
    margin-top: 6px;
    color: var(--ink);
}
.say {
    font-family: "Bricolage Grotesque", sans-serif;
    font-size: 36px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: 0.02em;
    line-height: 1.1;
}
/* the hint: a size up from body text, so a child can read it on their own */
.hint {
    margin-top: 14px;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    background: #fff6d6;
    border: 1.5px dashed #f1c84b;
    border-radius: var(--r-md);
    padding: 10px 18px;
    animation: deal 0.22s ease-out;
}
.note {
    margin-top: 14px;
    font-family: "Inter", sans-serif;
    font-size: 15px;
    color: var(--ink-soft);
    max-width: 420px;
}
.say[hidden],
.hint[hidden],
.note[hidden] {
    display: none;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.actions[hidden] {
    display: none;
}
.actions .btn-primary,
.actions .btn-ghost {
    justify-content: center;
}
.btn-ghost:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}
.rate {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}
.rate[hidden] {
    display: none;
}
.rate-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    border-radius: 16px;
    border: 2px solid transparent;
    font-weight: 700;
    font-size: 16px;
    transition:
        transform 0.15s,
        border-color 0.15s;
}
.rate-btn span {
    font-size: 28px;
    line-height: 1.1;
}
.rate-btn kbd {
    margin: 4px 0 0;
}
.rate-btn:hover,
.rate-btn:focus-visible {
    transform: translateY(-2px);
    border-color: currentColor;
}
.rate-btn.again {
    background: #ffe9e4;
    color: #c23a1f;
}
.rate-btn.good {
    background: var(--tint);
    color: var(--blue-deep);
}
.rate-btn.easy {
    background: #e2f8f3;
    color: #0b7c6f;
}

.done {
    text-align: center;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-card);
    padding: 36px 24px;
}
.done[hidden] {
    display: none;
}
.done-emoji {
    font-size: 56px;
}
.done h3 {
    font-size: 28px;
    font-weight: 800;
    margin-top: 6px;
}
.done p {
    color: var(--ink-soft);
    font-size: 17px;
    max-width: 400px;
    margin: 10px auto 22px;
}

/* ---------- HOW IT WORKS ---------- */
/* the static intro to the Tamil category — what's in the decks */
.fc-about {
    max-width: 760px;
    margin-top: 56px;
}
.fc-about h2 {
    font-size: 24px;
    margin-bottom: 10px;
}
.fc-about p {
    font-size: 15.5px;
    color: var(--ink-soft);
}
.fc-about p + p {
    margin-top: 10px;
}
.fc-about a {
    color: var(--blue);
    font-weight: 600;
}
.fc-about [lang="ta"] {
    font-family: "Noto Sans Tamil", sans-serif;
}

.fc-how {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-block: 56px 60px;
}
.fc-how > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
}
.fc-how .ic {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
    background: var(--tint);
    margin-bottom: 12px;
}
.fc-how h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}
.fc-how p {
    font-size: 14.5px;
    color: var(--ink-soft);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .deck-grid,
    .fc-how {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .wrap {
        padding-inline: 16px;
    }
    .fc-head {
        padding-top: 30px;
    }
    .card {
        min-height: 330px;
        padding-inline: 16px;
    }
    .hint {
        font-size: 24px;
    }
    .study-count {
        margin-left: 0;
        flex-basis: 100%;
    }
    kbd {
        display: none;
    }
    .actions .btn-primary,
    .actions .btn-ghost {
        flex: 1;
        padding-inline: 14px;
    }
}
