/* ===== Layout / Vars ===== */
:root {
  --content-max: 800px;
  --card-max: 600px;
  --card-radius: 12px;
  --card-bg: #fff;
  --card-border: rgba(0, 0, 0, 0.10);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.06),
                 0 6px 20px rgba(0, 0, 0, 0.06);
  --header-offset: 70px;
  --label-font: 1rem;
  --text-muted: #333;
}

html {
  scroll-behavior: smooth;
}

body {
  padding: 1rem;
}

/* ===== Top nav ===== */
.navbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1em;
  max-width: var(--content-max);
  margin: 0 auto 2em;
}

h1 {
  text-align: center;
}
.kanji-font {
  font-size: 2.2rem;
  line-height: 1;
}

.kanji-font-printed {
  font-family: "Noto Serif JP", serif;
}

.kanji-font-handwritten {
  font-family: "Yuji Mai", serif;
  opacity: 0.9;
}


.style-label::before {
  content: "— ";
  opacity: 0.5;
}

.kanji-header {
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}

/* ===== Stroke hint ===== */
.stroke-hint {
  font-size: 0.8rem;
  font-style: italic;
  color: #666;
  margin-top: -8px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.stroke-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ===== Hero (lesson art) ===== */
.lesson-art img {
  display: block;
  margin-inline: auto;
  width: 100%;
  max-width: min(320px, 85vw);
  height: auto;
}

/* Stroke-order kanji image behaves like a button */
.kanji-title-img {
  height: 80px;
  width: auto;
  vertical-align: middle;
  margin-right: 0.4rem;

  border: 1px solid #aaa;
  border-radius: 6px;
  padding: 4px;
  background: #fff;

  box-shadow: 1px 1px 4px rgba(0,0,0,0.08);

  transition: 
    transform 0.15s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.kanji-title-img:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  cursor: pointer;
}

.kanji-title-img:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.kanji-header a {
  text-decoration: none;
  color: inherit;
}
.kanji-font,
.kanji-header {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.kanji-title-img:hover {
  box-shadow: 0 0 8px rgba(255, 165, 0, 0.6);
  cursor: pointer;
}
.kanji-story {
  margin-bottom: 0.5em;
  line-height: 1.6;
}
.kanji-readings {
  margin: 0.6rem 0 0.8rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-top: 1px dashed rgba(0,0,0,0.08);
  padding-top: 0.5rem;
}
/* ===== Anchor list ===== */
.anchor-list {
  position: sticky;
  top: 0.5rem;
  z-index: 100;

  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;

  background: var(--card-bg);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;

  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.anchor-list a {
  font-size: 1.15rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  text-decoration: none;
}

.anchor-list a:hover {
  background: rgba(0,0,0,0.08);
}

.anchor-list a:focus-visible {
  outline: 2px solid #0055aa;
  outline-offset: 2px;
}

.anchor-list a.active {
  background: #2563eb;
  color: white;
  font-weight: 600;
}
/* ===== Kanji cards ===== */
.kanji-entry {
  max-width: var(--card-max);
  margin: 1.25rem auto 2rem;
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 1rem 1.25rem 1rem;
  box-shadow: var(--card-shadow);
  scroll-margin-top: var(--header-offset);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kanji-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08),
              0 10px 24px rgba(0, 0, 0, 0.10);
}

/* Big kanji + English gloss */
.kanji-header {
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: 1.05;
  margin: 0.25em 0 0.1em;
}

.kanji-header span {
  font-size: 0.72em;
  font-weight: 500;
  margin-left: 0.3em;
}

@media (max-width: 600px) {
  .anchor-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
  }
}

/* ===== Kanji-art image in each card ===== */
.mnemonic {
  margin: 2.0rem auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mnemonic img {
  max-width: 200px;
  width: 100%;
  height: auto;
  object-fit: contain;
}


/* Printed/Handwritten row */
.style-row {
  display: flex;
  justify-content: center;
  gap: 1em;
  flex-wrap: wrap;
  margin-top: 0.5em;
  margin-bottom: 0.7rem;

  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
}

.style-row div {
  text-align: center;
}

.style-row .kanji-font {
  font-size: 4rem;
  display: block;
  margin-bottom: 0.5rem;
}

.style-label {
  font-size: var(--label-font);
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
  color: var(--text-muted);
}

/* Back-to-Top link */
.kanji-entry a[href="#top"] {
  display: inline-block;
  text-align: center;
  margin: 0.9rem auto 0;

  padding: 0.25rem 0.55rem;
  border-radius: 6px;

  color: #0066aa;
  text-decoration: none;
  font-size: 0.9rem;

  transition: background 0.2s ease, transform 0.15s ease;
}

.kanji-entry a[href="#top"]:hover {
  background: rgba(0,0,0,0.06);
  text-decoration: none;
  transform: translateY(-1px);
}

.kanji-entry a[href="#top"]:active {
  transform: translateY(0);
}
/* Back-to-Top link */
.kanji-entry a[href="#top"] {
  display: inline-block;
  text-align: center;
  margin: 0.9rem auto 0;

  padding: 0.25rem 0.55rem;
  border-radius: 6px;

  color: #0066aa;
  text-decoration: none;
  font-size: 0.9rem;

  transition: background 0.2s ease, transform 0.15s ease;
}


/* ===== Accessibility ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
  width: auto;
  height: auto;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border: 2px solid #000;
  border-radius: 6px;
  z-index: 1000;
}

/* ===== CTA button (Compounds link) ===== */
.cta {
  display: flex;
  justify-content: center;
  margin-top: 2em;
  position: relative;
  z-index: 1;
}

.btn-compounds {
  display: inline-block;
  background: #ffcc00;
  border-radius: 8px;
  padding: 0.45em 1.1em;
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1.1;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  color: #0055aa;
}

.btn-compounds:hover {
  filter: brightness(0.95);
}

.btn-compounds:active {
  transform: translateY(1px);
}

.btn-compounds:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* ===== Stamps ===== */
.stamps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2em;
  margin: 2em 0 2rem;
}

.stamps img {
  display: block;
  border-radius: 6px;
  opacity: 0.9;
}

/* ===== Japanese glyphs ===== */
.jp,
:lang(ja) {
  font-family: "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Kaku Gothic ProN",
               "Yu Gothic", "Meiryo", "Noto Serif JP", "Hiragino Mincho ProN",
               "Yu Mincho", sans-serif !important;
}

/* ===== Kanji notes ===== */
.kanji-note {
  margin: 0.75rem auto 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid #4b5563;
  background: #f8fafc;
  color: #111827;
  border-radius: 0.25rem;
  line-height: 1.55;
  font-size: 0.95rem;
  text-align: left;
  max-width: 42rem;
}

/* ===== Compound word images ===== */
.kanji-med {
  max-width: 80px;
  height: auto;
  display: block;
  margin: 0 auto 0.5em;
}

.kanji-img-center {
  text-align: center;
  margin-bottom: 0.5em;
}

/* ===== Mobile/Desktop polish ===== */

/* Compound blocks in a grid on larger screens */
.content-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* ----------------------------------
   Chunks of Meaning – Gallery Frame
---------------------------------- */

.kanji-chunks-frame {
  max-width: 120px;
  margin: 2.5rem auto;
  padding: 1.4rem 2.2rem;

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;

  background: rgba(0, 0, 0, 0.02);

  text-align: center;
}

.kanji-chunks-frame img {
  max-width: 80%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Optional subtle caption */
.kanji-chunks-frame .placeholder {
  font-size: 0.90rem;
  color: #777;
  letter-spacing: 0.03em;
}
@media (max-width: 420px) {
  .kanji-font-printed,
  .kanji-font-handwritten {
    font-size: 2.3rem; /* slightly smaller for phones */
  }
}

/* Navbar stacks nicely on narrow phones */
@media (max-width: 400px) {
  .navbar {
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
  }
}
.emoji-hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;

  margin-top: 0.7rem;
  margin-bottom: 1.2rem;

  opacity: 0.85;
}

.emoji-hint img {
  height: 60px;
  width: auto;
}

.emoji-hint .lightbulb {
  font-size: 1.5rem; /* smaller */
  line-height: 1;
}


@media (prefers-color-scheme: dark) {
  :root {
    --text-muted: #bbb;
  }
}


/* Lesson 6 – smaller hero art */
.lesson-6 .lesson-art img {
  display: block;
  margin: 0 auto 1.25rem;
  width: 100%;
  max-width: 280px;
  height: auto;
}

@media (max-width: 480px) {
  .lesson-6 .lesson-art img {
    max-width: 220px;
  }
}