/* Lesson compounds prototype. Scoped so existing compound pages stay as they are. */

.compounds-lesson .navbar,
.compounds-hero,
.compounds-lesson h1,
.furigana-bar,
.compounds-sheet {
  max-width: 60rem;
}

.compounds-lesson .navbar {
  margin-bottom: 1.25rem;
}

.compounds-hero {
  position: relative;
  margin: 0.25rem auto 0;
  aspect-ratio: 3.2 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #221f1b;
  box-shadow:
    0 0 0 1px rgba(201, 164, 88, 0.18),
    0 12px 36px rgba(0, 0, 0, 0.45);
}

.compounds-hero[hidden] {
  display: none;
}

.compounds-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
  display: block;
}

.compounds-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(23, 21, 18, 0.35), transparent 46%);
  pointer-events: none;
}

.compounds-lesson h1 {
  margin: 1.35rem auto 0.7rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.furigana-bar {
  margin: 0 auto 1.35rem;
  text-align: center;
}

.furigana-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.2rem 0.15rem;
  border: 0;
  background: transparent;
  color: var(--nav-ink);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.furigana-toggle:hover,
.furigana-toggle:focus-visible {
  color: var(--nav-gold);
}

.furigana-toggle:focus-visible {
  outline: 2px solid rgba(201, 164, 88, 0.7);
  outline-offset: 3px;
  border-radius: 4px;
}

.furigana-mark {
  width: 0.72rem;
  height: 0.72rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

html:not(.furigana-off) .furigana-mark {
  background: currentColor;
}

.compounds-sheet {
  margin: 0 auto 1.5rem;
  background: var(--card-bg);
  color: #2a261f;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.compounds-status {
  margin: 0;
  padding: 2.2rem 1.4rem;
  text-align: center;
  color: #5c564c;
}

.compound-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  padding: 1.15rem 1.6rem 0.2rem;
}

.compound-group-kanji {
  font-family: "Yuji Syuku", "Noto Serif JP", serif;
  font-size: 1.7rem;
  line-height: 1;
  color: #b79a52;
}

.compound-group-reading,
.compound-group-keyword {
  font-size: 0.84rem;
  color: #6d675e;
}

.compound-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, 13rem) minmax(0, 1fr);
  column-gap: 2rem;
  align-items: center;
  padding: 1.2rem 1.6rem 1.35rem;
  border-top: 1px solid rgba(42, 38, 31, 0.1);
}

.compound-entry {
  text-align: center;
  min-width: 0;
}

.compound-surface,
.compound-reading,
.compound-meaning,
.compound-ja,
.compound-en {
  overflow-wrap: break-word;
  word-break: normal;
}

.compound-surface {
  margin: 0;
  font-family: "Noto Serif JP", serif;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.compound-reading {
  margin: 0.28rem 0 0;
  font-family: "Noto Serif JP", serif;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  color: #6b645b;
}

.compound-meaning {
  margin: 0.22rem 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #4e4942;
}

.compound-example {
  min-width: 0;
}

.compound-ja {
  margin: 0;
  font-family: "Noto Serif JP", serif;
  font-size: clamp(1.12rem, 2.2vw, 1.35rem);
  line-height: 1.7;
  color: #241f1a;
}

.ja-plain {
  display: none;
}

html.furigana-off .ja-ruby {
  display: none;
}

html.furigana-off .ja-plain {
  display: inline;
}

html:not(.furigana-off) .compound-ja {
  line-height: 2.85;
}

.compound-ja ruby {
  ruby-position: over;
  ruby-align: center;
}

html:not(.furigana-off) .compound-ja rt {
  font-size: 0.6em;
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: 0.01em;
  padding-bottom: 0.16em;
  color: #2a261f;
}

.compound-en {
  margin: 0.55rem 0 0;
  font-family: "Noto Serif JP", Palatino, "Palatino Linotype", serif;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(42, 38, 31, 0.72);
}

@media (max-width: 760px) {
  .compound-group {
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .compound-row {
    grid-template-columns: 1fr;
    row-gap: 0.85rem;
    justify-items: center;
    padding: 1.15rem 1rem 1.3rem;
  }

  .compound-example,
  .compound-en {
    text-align: center;
  }

  .compound-ja {
    font-size: 1.2rem;
  }
}

@media (max-width: 400px) {
  .compound-surface {
    font-size: 1.55rem;
  }

  .compound-ja {
    font-size: 1.08rem;
  }

  .compound-en {
    font-size: 0.95rem;
  }
}
