#courses {
  color-scheme: light;
  --ivory: #faf8f3;
  --ink: #343e3e;
  --muted: #545d58;
  --line: #c9c4b8;
  --accent: #245672;
}
#courses {
  max-width: none;
  text-align: start;
  background: var(--ivory);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}
.course-navigation {
  width: min(100% - 40px, 1080px);
  margin-inline: auto;
  padding-block: clamp(56px, 9vw, 128px);
}
@font-face {
  font-family: "Comparison Noto Serif";
  src: url("fonts/NotoSerif.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

@scope (#courses) {
button, a { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; }
:where(button, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.navigation-stage { display: grid; overflow-anchor: none; }
.panel { grid-area: 1 / 1; min-width: 0; align-self: start; }
.panel[hidden] { display: none; }
.languages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.languages button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: clamp(124px, 14vw, 184px);
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
  text-align: center;
}
.languages button::after {
  position: absolute;
  content: "";
  inset: 23% 0 23% auto;
  border-right: 1px solid var(--line);
  pointer-events: none;
}
.languages button:nth-child(3n)::after { display: none; }
.native {
  font: 400 clamp(22px, 3vw, 40px)/1.12 "Times New Roman", "Yu Mincho", serif;
  letter-spacing: .045em;
}
.japanese { color: var(--muted); font-size: 14px; letter-spacing: .07em; }
.lessons { width: min(100%, 760px); justify-self: center; }
.lessons ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.lessons li { border-bottom: 1px solid var(--line); }
.lesson-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 64px;
  padding: 14px 12px;
  font-size: clamp(16px, 1.7vw, 20px);
  overflow-wrap: anywhere;
  text-decoration: none;
}
.arrow { color: var(--accent); font-size: 17px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  margin-bottom: 14px;
  padding: 0 12px;
  color: var(--accent);
  font-size: 14px;
}
.back-bottom { margin-block: 14px 0; }
.empty { margin: 0; padding: 22px 12px; border-block: 1px solid var(--line); }
.test-page main { padding-top: 24px; }
.test-header { margin-bottom: 24px; }
.test-header h1 { margin-block: 8px; font-size: 22px; }
.test-header p { margin-block: 6px; font-size: 14px; }
.test-state, .lesson-row small { color: #794221; }
.lesson-row small { display: inline-block; font-size: 12px; }
@media (hover: hover) {
  .languages button:hover, a.lesson-row:hover, .back:hover { background: #eeeae1; }
}
@media (max-width: 767px) {
  .languages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .languages button:nth-child(3n)::after { display: block; }
  .languages button:nth-child(2n)::after { display: none; }
  .native { font-size: clamp(17px, 5.25vw, 28px); }
  .japanese { font-size: 13px; }
  .lesson-row { padding-inline: 8px; }
}

.comparison-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 20px;
  font-size: 14px;
}
.comparison-controls select { max-width: 100%; font: inherit; color: inherit; }
.count-control { display: inline-flex; align-items: center; gap: 4px; }
.comparison-controls a, .font-details summary { color: var(--accent); }
.font-details { margin-top: 24px; font-size: 14px; }
.font-details summary { cursor: pointer; }
.count-note { margin: 0 0 12px; padding-inline: 8px; font-size: 14px; color: #794221; }
[data-count-extra][hidden] { display: none; }
.native {
  display: grid;
  align-items: end;
  min-height: 2.24em;
  max-width: 100%;
  font-family: var(--comparison-native, "Times New Roman", serif);
}
.japanese {
  font-family: var(--comparison-japanese, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif);
  font-weight: var(--comparison-japanese-weight, 400);
  line-height: 1.65;
}

.languages button { min-height: clamp(112px, 12vw, 160px); }
.native {
  font-weight: var(--native-weight, 400);
  letter-spacing: var(--native-spacing, .035em);
  font-synthesis: none;
}
.languages .native {
  align-items: center;
  min-height: 2.5rem;
  font-size: clamp(20px, var(--native-scale, 2.65vw), var(--native-max, 37px));
}
.lesson-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 8px;
  padding-inline: 8px;
}
.lesson-title .native {
  display: inline;
  min-height: 0;
  font-size: clamp(18px, 3vw, 24px);
  color: var(--accent);
}
.back {
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-inline: 8px;
}
.lesson-row small { margin-inline-start: .55em; }

@media (max-width: 767px) {
  .languages button { padding-inline: 8px; }
  .languages .native {
    min-height: 2.85rem;
    font-size: clamp(15px, var(--native-mobile, 5.1vw), 27px);
    text-wrap: balance;
  }
}
}

#courses .lesson-title {
  margin: 0 0 8px;
  line-height: normal;
}
#courses .count-note {
  margin: 0 0 12px;
}
#courses .comparison-controls {
  margin: 24px 0 0;
}
#courses .navigation-stage {
  scroll-margin-top: var(--site-header-height, 48px);
}

body[data-type="d"] #courses :is([data-language="ita"], [data-panel="ita"]) {
  --native-scale: 2.72vw;
  --native-max: 38px;
  --native-mobile: 5.42vw;
  --native-spacing: .04em;
}
body[data-type="d"] #courses :is([data-language="spa"], [data-panel="spa"]) {
  --native-scale: 2.51vw;
  --native-max: 35px;
  --native-mobile: 5.08vw;
  --native-spacing: .025em;
}
body[data-type="d"] #courses :is([data-language="ger"], [data-panel="ger"]) {
  --native-scale: 2.43vw;
  --native-max: 34px;
  --native-mobile: 5.02vw;
  --native-spacing: .035em;
}
body[data-type="d"] #courses :is([data-language="eng"], [data-panel="eng"]) {
  --native-scale: 2.64vw;
  --native-max: 37px;
  --native-mobile: 5.45vw;
  --native-spacing: .05em;
}
body[data-type="d"] #courses :is([data-language="lat"], [data-panel="lat"]) {
  --native-scale: 2.48vw;
  --native-max: 34px;
  --native-mobile: 4.52vw;
  --native-spacing: .015em;
}
body[data-type="d"] #courses :is([data-language="gra"], [data-panel="gra"]) {
  --native-scale: 2.42vw;
  --native-max: 33px;
  --native-mobile: 4.78vw;
  --native-spacing: 0;
}

/* Keep the viewport anchored to the same page coordinate during panel height changes. */
html { overflow-anchor: none; }
