/* course-japanese-v1.css — Japanese course overrides (Course.ThemeCSS in a4_courses.go).
   Loaded after the base/lesson css, so it only redefines the course tokens (see "Course tokens"
   in base css) plus the few rules that differ for Japanese. Chinese ships no course css. */

/* ===== Course tokens ===== */
:root {
    /* Japanese glyph shapes: kanji share code points with hanzi, so the font must be Japanese */
    --cjk-font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    --cjk-fallback: "Noto Sans JP", "Hiragino Sans";
    /* rounded kana display face for decorative native-script lines (logo) */
    --cjk-display-font: "Zen Maru Gothic", var(--cjk-font);
    /* hero images (home hero, auth popup, signup, subscribe, comeback cards) */
    --hero-img: url('/static/img/japanese/hero-v1.webp');
    --hero2-img: url('/static/img/japanese/hero2-v1.webp');
}

/* ===== Logo ===== */
/* native-script line: rounded display face, a touch bolder than the Chinese logo line */
.char-logo.zh {
    font-family: var(--cjk-display-font);
    font-weight: 500;
}

/* ===== Menu icons ===== */
/* Japanese versions of the menu icons with a Chinese motif; lessons, characters, quiz and account
   reuse the shared set (/static/img/menu-v1/). Same 48px line style, drawn as masks (base css .menuicon) */
.mi-continue   { --icon: url("/static/img/japanese/menu-v1/continue.svg"); }   /* torii gate */
.mi-vocabulary { --icon: url("/static/img/japanese/menu-v1/vocabulary.svg"); } /* tanzaku word strips */
.mi-subscribe  { --icon: url("/static/img/japanese/menu-v1/subscribe.svg"); }  /* chochin lantern */
.mi-contact    { --icon: url("/static/img/japanese/menu-v1/contact.svg"); }    /* kyusu teapot */
.mi-login      { --icon: url("/static/img/japanese/menu-v1/login.svg"); }      /* 5-yen coin key */
.mi-signout    { --icon: url("/static/img/japanese/menu-v1/signout.svg"); }    /* shoji door */

/* ===== Kana chart (Writing pages: lesson 1 hiragana, lesson 21 katakana) ===== */
/* today's characters get class="today"; irregular romaji sit in a <small> under the kana */
.kana-chart-wrap {
    overflow-x: auto;
    margin: 1rem 0 2rem;
}
.kana-chart {
    border-collapse: separate;
    border-spacing: 0.3rem;
    margin: 0 auto;
    font-family: var(--cjk-font);
}
.kana-chart th {
    color: var(--muted, #6b7280);
    font: 600 0.85rem system-ui, sans-serif;
    padding: 0.2rem 0.4rem;
}
.kana-chart td {
    width: 3rem;
    height: 3rem;
    text-align: center;
    font-size: 1.45rem;
    line-height: 1.1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
}
.kana-chart td:empty {
    background: none;
    border-color: transparent;
}
.kana-chart td small {
    display: block;
    font: 0.65rem system-ui, sans-serif;
    color: var(--muted, #6b7280);
}
.kana-chart td.today {
    background: rgb(53, 171, 106);
    border-color: rgb(53, 171, 106);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 3px 0 rgb(36, 128, 78);
}
.kana-chart td.today small {
    color: #e8fff1;
}

/* ===== Vocabulary grids ===== */
/* kana words are longer than hanzi words: wider Japanese column, and Japanese only breaks between phrases
   (at the spaces the lessons put between them); a word like こんにちは only breaks if it can't fit at all */
@media (min-width: 651px) {
    .voc-grid {
        grid-template-columns: 30% 24% 46%;
    }
}
.voc-grid > .chars,
.example > p.chars,
.dia-line > p.chars {
    word-break: keep-all;
    overflow-wrap: anywhere; /* emergency break only when a phrase can't fit at all */
}

/* ===== Quizzes ===== */
/* answer cards and the quiz-2 prompt are sized for 1-3 hanzi; Japanese words are several kana long.
   Each card is a size container and the engine sets --len (character count) on .opt-char, so the font
   scales to fit the word on one line: short words stay at 1.8rem, long ones shrink down to 1.1rem
   (kana are ~1em wide; 88cqi leaves a little side margin). Past the floor, the word wraps as a fallback. */
.quiz-option {
    container-type: inline-size;
}
.quiz-option .opt-char {
    font-size: clamp(1.1rem, calc(88cqi / var(--len, 3)), 1.8rem);
    word-break: keep-all;
    overflow-wrap: anywhere;
}
/* romaji under the kana (quiz 1): 5% smaller than the base 1.15rem / 1.05rem, to match the smaller kana */
.quiz-cont:not([data-quiz-type="reverse"]) .quiz-option .opt-pinyin {
    font-size: 1.09rem;
}
.quiz-cont[data-quiz-type="reverse"] .quiz-prompt {
    font-size: 2.6rem;
    word-break: keep-all;
    overflow-wrap: anywhere;
}
@media (max-width: 500px) {
    .quiz-cont:not([data-quiz-type="reverse"]) .quiz-option .opt-pinyin {
        font-size: 1rem;
    }
    .quiz-cont[data-quiz-type="reverse"] .quiz-prompt {
        font-size: 2rem;
    }
}

/* ===== Home hero: "Free beginners course" sticker above the headline ===== */
/* tilted sakura-pink sticker with a hard drop shadow; drops in from the top like the headline
   (base css .hero-title: slideDown .9s .25s), 0.5s after it, and lands with a small bounce */
.hero-pill {
    display: inline-block;
    margin: 0 0.5rem 1rem;
    padding: 0.45rem 1.1rem;
    border-radius: 999px;
    background: #f4a3ba;
    color: #3b1020;
    font-weight: 700;
    font-size: clamp(0.95rem, 1vw + 0.6rem, 1.15rem);
    letter-spacing: 0.02em;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
    transform: rotate(-3deg);
    opacity: 0;
    animation: pillDrop 0.9s 0.75s forwards;
}
@keyframes pillDrop {
    0%   { opacity: 0; transform: translateY(-120%) rotate(-3deg); }
    60%  { opacity: 1; transform: translateY(8%) rotate(-3deg); }
    80%  { transform: translateY(-4%) rotate(-3deg); }
    100% { opacity: 1; transform: translateY(0) rotate(-3deg); }
}
