/* © 2026 Filip Mráček / Japaneseffect. All rights reserved.
   Japaneseffect grammar: coloured sentence chunks (meaning above, furigana, romaji under), the growing sentence,
   chapters and topic cards. The same philosophy as Chineseffect's grammar, built for Japanese. */
:root {
  --r-S: #7cb8ff; --r-T: #f2c46d; --r-P: #6fd3a0; --r-M: #ff9fb5; --r-W: #c9b0ff; --r-X: #a1a1a6; --r-V: #ffffff;
  --r-A: #ffe39a; --r-O: #8fd3e8; --r-L: #ffb380; --r-R: #ff9f8a; --r-Y: #e3dc7c; --r-G: #2997ff;
  --g-soft: rgba(41,151,255,.16); --ease: cubic-bezier(.25,.8,.25,1);
}
.sl--S { --rc: var(--r-S); } .sl--T { --rc: var(--r-T); } .sl--P { --rc: var(--r-P); } .sl--M { --rc: var(--r-M); }
.sl--W { --rc: var(--r-W); } .sl--X { --rc: var(--r-X); } .sl--V { --rc: var(--r-V); } .sl--A { --rc: var(--r-A); }
.sl--O { --rc: var(--r-O); } .sl--L { --rc: var(--r-L); } .sl--R { --rc: var(--r-R); } .sl--Y { --rc: var(--r-Y); } .sl--G { --rc: var(--r-G); }

/* ── one example: chunks ── */
.gex { margin: 0 0 16px; }
.gex__line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 4px; }
.sl { display: inline-flex; flex-direction: column; align-items: center; padding: 0 3px 2px; border-bottom: 2px solid color-mix(in srgb, var(--rc, transparent) 70%, transparent); border-radius: 2px; }
.sl__lab { font: 500 11.5px/1.15 var(--ui); color: var(--rc, var(--text-2)); margin-bottom: 2px; white-space: nowrap; }
.sl--X .sl__lab { color: var(--text-2); }
.sl__ja { font: 400 1.5rem/1.5 var(--ja); }
.sl--V .sl__ja, .sl--A .sl__ja { font-weight: 600; }
.sl--G { background: var(--g-soft); border-radius: 6px 6px 2px 2px; }
.sl--G .sl__ja { color: var(--r-G); font-weight: 600; }
.sl__ro { font: 400 .78rem/1.3 var(--ui); color: var(--text-3); white-space: nowrap; min-height: 1em; margin-top: 1px; }
.sl--p { padding: 0; border-bottom-color: transparent; }
.sl--p .sl__ja { color: var(--text-2); }
.sl ruby, .jin ruby { ruby-position: over; ruby-align: center; }
.sl rt { font-size: 10.5px; color: #b7bcc6; letter-spacing: -.04em; }
.no-romaji .sl__ro, .no-romaji .jin__ro { display: none; }
.gex__en { color: var(--text-2); margin: 4px 0 0; font-size: .97rem; }
.gex__say { align-self: center; margin-left: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.gex__say:hover { color: var(--text); background: rgba(255,255,255,.13); }

/* ── Japanese inside the text ── */
.jin { white-space: normal; }
.jin [lang="ja"] { font-size: 1.08em; color: var(--text); }
.jin rt { font-size: .5em; color: #b7bcc6; }
.jin__ro { font-size: .78em; color: var(--text-3); margin-left: .35em; font-style: italic; }
.jin__ro::before { content: "("; } .jin__ro::after { content: ")"; }

/* ── the growing sentence ── */
.builder { margin: 26px 0 0; text-align: center; background: var(--surface); border-radius: 26px; padding: 22px 18px 20px; box-shadow: 0 0 0 1px var(--line), 0 24px 70px rgba(0,0,0,.45); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.builder__stages { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.builder__st { display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font: 500 .88rem/1.2 var(--ui); color: var(--text-2); background: rgba(255,255,255,.07); padding: 8px 14px 8px 8px; border-radius: 999px; text-align: left; transition: background .25s, color .25s; }
.builder__st.is-on { color: #fff; background: rgba(41,151,255,.22); box-shadow: inset 0 0 0 1px rgba(41,151,255,.5); }
.builder__n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); font-weight: 700; font-size: .8rem; }
.builder__st.is-on .builder__n { background: var(--r-G); }
.builder__line { justify-content: center; min-height: 100px; gap: 6px 6px; }
.builder__line .sl { max-width: 10em; overflow: hidden; transition: max-width .7s var(--ease), opacity .5s var(--ease), padding .7s var(--ease); }
.builder__line .sl.is-off { display: none; }
.builder__line .sl:not(.is-off) { animation: slin .6s var(--ease); }
@keyframes slin { from { opacity: 0; transform: translateY(6px); } }
.builder__line .sl__ja { font-size: clamp(1.4rem, 4vw, 2.2rem); }
.builder__line .sl__lab { font-size: 12px; }
.builder__en { color: var(--text-2); margin: 14px 0 0; }
.builder__note { color: var(--text-3); font-size: 14px; margin: 10px 0 0; }

/* ── legend ── */
.legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 16px 0 0; }
.legend span { font: 600 12px/1 var(--ui); padding: 6px 9px; border-radius: 999px; color: var(--rc); background: color-mix(in srgb, var(--rc) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 28%, transparent); }

/* ── table of contents ── */
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 30px 0 50px; }
.toc a { display: block; padding: 14px 16px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--text); }
.toc a:hover { box-shadow: 0 0 0 1px rgba(41,151,255,.55); }
.toc b { display: block; color: var(--r-G); font-size: 13px; font-weight: 600; }
.toc small { display: block; color: var(--text-3); font-size: 13px; margin-top: 4px; font-family: var(--ja); }

/* ── chapters and topics ── */
.gch { margin: 0 0 60px; scroll-margin-top: 80px; }
.gch__n { color: var(--r-G); font-weight: 600; margin: 0 0 6px; }
.gch h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.gch__lead { color: var(--text-2); font-size: 1.1rem; max-width: 720px; margin: 8px 0 22px; }
/* speed (CHFX rules 3–4): off-screen cards are rendered lazily; no blur behind the cards (soft light looks the same) */
.gpt { background: rgba(26, 26, 30, .74); border-radius: 22px; padding: 22px 24px 10px; margin-bottom: 16px; box-shadow: 0 0 0 1px var(--line); scroll-margin-top: 80px; transition: box-shadow .4s;
  content-visibility: auto; contain-intrinsic-size: auto 820px; }
@media (max-width: 600px) { .gpt { contain-intrinsic-size: auto 1100px; } }
.gpt.is-hi, .gpt:target { box-shadow: 0 0 0 1px rgba(255,159,10,.6), 0 0 40px rgba(255,159,10,.14); }
.gpt__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gpt__tag { font: 600 1.1rem var(--ja); color: var(--r-G); background: var(--g-soft); padding: 3px 10px; border-radius: 10px; }
.gpt__title { font-size: 1.3rem; font-weight: 650; margin: 0; }
.gpt__lead { font-size: 1.07rem; margin: 10px 0 4px; }
.gpt__body { color: #d6d6db; }
.gpt__body p { margin: .6em 0; }
.gpt__box { margin: 12px 0; padding: 10px 14px; border-radius: 14px; font-size: .96rem; }
.gpt__box b { display: block; font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 2px; }
.gpt__why { background: rgba(41,151,255,.1); } .gpt__why b { color: var(--r-G); }
.gpt__watch { background: rgba(255,159,10,.09); } .gpt__watch b { color: #ffb340; }
.gpt__ex { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.gpt__foot { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--text-3); }
.gpt__foot a { color: var(--text-2); padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.06); }
.gpt__foot a:hover { color: var(--text); }
.gtab { border-collapse: collapse; margin: 12px 0; font-size: .95rem; width: 100%; display: block; overflow-x: auto; }
.gtab th, .gtab td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.gtab thead th { color: var(--text-3); font-weight: 500; font-size: .85rem; }
.gtab tbody th { color: var(--text-2); font-weight: 500; white-space: nowrap; }
@media (max-width: 560px) {
  .gpt { padding: 18px 15px 6px; border-radius: 18px; }
  .sl__ja { font-size: 1.3rem; }
}
