/* =====================================================================
   9 to 5 Japanese — lesson pages and the lessons hub
   Each lesson keeps its own styles (rescoped under .lesson-src by the
   build script); this file covers the frame around it and the hub list.
   ===================================================================== */

/* ---- Frame around a lesson ---- */
.lesson-shell { max-width: 46rem; margin: 0 auto; padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) clamp(3rem, 7vw, 5rem); }
.lesson-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem); padding-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.crumbs { font-size: 0.85rem; color: var(--ink-mid); display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.crumbs a { color: var(--ink-mid); text-decoration: none; }
.crumbs a:hover { color: var(--vermilion); }
.crumbs .sep { opacity: 0.5; }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; }
.furigana-toggle {
  font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer;
  color: var(--vermilion-deep); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.9rem;
}
.furigana-toggle[aria-pressed="true"] { background: var(--vermilion); color: #fdfaf3; border-color: var(--vermilion); }

/* Base for lesson content; the lesson's own rules sit on top of this */
.lesson-src { font-family: "Zen Kaku Gothic New", "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); }
.lesson-src section { padding-inline: 0; }
.lesson-src a { color: var(--vermilion-deep); }
.furigana-on .lesson-src rt { visibility: visible !important; }

.lesson-shell .pager { margin-top: 2.5rem; }
.lesson-shell .pager-prev:only-child { grid-column: 1; }

/* ---- Lessons hub ---- */
.lessons-hub .hero { padding-bottom: 0; }
.lessons-hub .hero-title { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
.series-nav { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }
.series-nav a {
  display: inline-flex; align-items: baseline; gap: 0.5rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.45rem 1rem; font-weight: 700; font-size: 0.92rem;
}
.series-nav a span { font-weight: 400; color: var(--ink-mid); font-size: 0.82rem; }
.series-nav a:hover { border-color: var(--vermilion); }

.lesson-series { max-width: var(--wrap, 72rem); margin: 0 auto; padding-bottom: clamp(2rem, 6vw, 4rem); }
.series { margin-top: clamp(2.5rem, 6vw, 4rem); scroll-margin-top: 5.5rem; }
.series-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.series-head h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; }
.series-head p { margin: 0; color: var(--ink-mid); font-size: 0.95rem; }
.series-progress { height: 4px; border-radius: 99px; background: var(--line-soft); overflow: hidden; margin: 0 0 1.2rem; }
.series-progress span { display: block; height: 100%; background: var(--vermilion); border-radius: 99px; }

.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 0.6rem; }
.lrow {
  display: grid; grid-template-columns: 4.6rem 1fr auto; align-items: center; gap: 0.2rem 0.8rem;
  text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 0.7rem 0.95rem; transition: border-color 0.2s, transform 0.2s var(--ease);
}
.lrow:hover { border-color: var(--vermilion); transform: translateY(-2px); }
.lrow-n { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--vermilion-deep); }
.lrow-main { display: flex; flex-direction: column; min-width: 0; }
.lrow-jp { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-t { font-size: 0.86rem; color: var(--ink-mid); line-height: 1.35; }
.lrow-d { font-size: 0.75rem; color: var(--ink-mid); white-space: nowrap; }
.lrow.is-new { border-color: var(--vermilion); }
.lrow.is-new .lrow-d { color: var(--vermilion-deep); font-weight: 700; }

@media (max-width: 600px) {
  .lrow { grid-template-columns: 4rem 1fr; }
  .lrow-d { display: none; }
}

/* Tip link after each lesson (shown only when SUPPORT_URL is set in the build script) */
.support { margin-top: 2.5rem; padding: 1.1rem 1.3rem; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line-soft); color: var(--ink-mid); font-size: 0.98rem; line-height: 1.6; }
.support p { margin: 0; }
.support strong { color: var(--ink); }
.support a { color: var(--vermilion-deep); font-weight: 700; }

/* Lesson sits on an outlined card, like the roadmap cards */
.lesson-src { background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--ink); padding: clamp(1.25rem, 4vw, 2.5rem); }
.crumbs { font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: 0.04em; text-transform: uppercase; }
.furigana-toggle { border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.series-head h2 { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: clamp(2.2rem, 5vw, 3rem); }
.series-nav a { border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font-family: var(--display); font-weight: 800; font-size: 1.05rem; letter-spacing: 0.03em; }
.lrow { border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.lrow:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); border-color: var(--ink); }
.lrow-n { font-family: var(--display); font-weight: 800; font-size: 0.85rem; color: var(--vermilion); }
.lrow-jp { font-family: "Zen Kaku Gothic New", sans-serif; font-weight: 900; }
.lrow.is-new { background: #fff3f1; border-color: var(--vermilion); box-shadow: 3px 3px 0 var(--vermilion); }
.support { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); background: var(--surface); }
.series-progress { height: 8px; border: 2px solid var(--ink); background: var(--surface); }

/* Lessons were written for a phone-width column; scale them up on bigger screens */
@media (min-width: 900px) {
  .lesson-page .lesson-shell { max-width: 58rem; }
  .lesson-src { zoom: 1.22; }
}
@media (min-width: 1400px) {
  .lesson-page .lesson-shell { max-width: 64rem; }
  .lesson-src { zoom: 1.35; }
}
@media (min-width: 1800px) {
  .lesson-page .lesson-shell { max-width: 76rem; }
  .lesson-src { zoom: 1.55; }
}

/* Follow / support box after each lesson: copy on the left, two buttons on the right */
.support { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1.1rem 2rem; margin-top: 2.5rem; padding: 1.4rem 1.6rem; }
.support-copy { display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 18rem; }
.support-copy strong { font-family: var(--display); font-weight: 900; font-size: 1.55rem; line-height: 1.05; text-transform: uppercase; color: var(--ink); }
.support-copy span { font-size: 1rem; line-height: 1.55; color: var(--ink-mid); }
.support-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.support .kofi-btn, .x-btn { min-height: 54px; }
.x-btn {
  display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none;
  background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--vermilion);
  padding: 0.55rem 1.15rem; font-family: var(--display); font-weight: 800; font-size: 1.08rem; letter-spacing: 0.03em;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.x-btn svg { width: 20px; height: 20px; flex: none; }
.x-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--vermilion); color: #fff; }
@media (min-width: 900px) { .lesson-page .support { padding: 1.6rem 2rem; } .support-copy strong { font-size: 1.75rem; } .support-copy span { font-size: 1.08rem; } }
@media (max-width: 600px) { .support-actions, .support-actions a { width: 100%; } .support-actions a { justify-content: center; } }
.support a.x-btn, .support a.x-btn:hover { color: #fff; }

/* Hub on desktop: one row per week, five lesson cards across (Mon-Thu lessons, Friday review) */
.lrow.is-review { background: var(--bg-2, #f4ecd8); }
@media (min-width: 1000px) {
  .lesson-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.85rem; }
  .lesson-list > li { display: flex; }
  .lrow {
    flex: 1; grid-template-columns: 1fr auto; grid-template-areas: "n d" "main main";
    align-items: start; align-content: start; gap: 0.45rem 0.5rem; padding: 0.85rem 0.95rem 0.95rem;
  }
  .lrow-n { grid-area: n; }
  .lrow-d { grid-area: d; }
  .lrow-main { grid-area: main; gap: 0.2rem; }
  .lrow-jp { white-space: normal; font-size: 1.15rem; }
  .lrow-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}

/* Drag-to-order quiz: tiles turn green once the order is checked and correct */
.lesson-src .correct .tile { background: #dcefe2; border-color: #2f7d4f; color: #1d4d31; transition: background 0.25s, border-color 0.25s; }
/* Keep two-kanji words together when their reading is wider than the kanji (先生, not 先 生) */
.lesson-src rt { margin-inline: -0.6em; }
