:root {
  --bg: #000000;
  --cream: #fff5e1;
  --cream-muted: rgba(255, 245, 225, 0.7);
  --cream-nav: rgba(255, 245, 225, 0.78);
  --divider: rgba(255, 245, 225, 0.2);
  --column-max: 22rem;
  --nav-rail-width: 9.5rem;
  --hub-gap: 1.25rem;
  /*
   * Pull the nav + main cluster further left. Base term is half the rail width;
   * add extra until the sentence block lines up with the fox/read as centered.
   */
  --hub-body-shift-extra: 5.75rem;
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-jp: "IBM Plex Sans JP", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  opacity: 0.85;
}

a:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.25rem 1.25rem 2.75rem;
}

.hub-header {
  width: 100%;
  text-align: center;
  margin-bottom: 1.75rem;
}

.hub-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto;
}

.hub-brand img {
  margin: 0;
}

.hub-brand__name {
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--cream);
  white-space: nowrap;
}

.hub-tagline {
  margin: 0.75rem auto 0;
  max-width: 22rem;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
  text-align: center;
}

.hub-shell {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.hub-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--hub-gap);
  width: 100%;
  max-width: calc(var(--nav-rail-width) + var(--hub-gap) + var(--column-max));
}

.hub-column {
  flex: 1;
  min-width: 0;
  max-width: var(--column-max);
  display: flex;
  flex-direction: column;
}

.hub-nav {
  flex: 0 0 var(--nav-rail-width);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: var(--nav-rail-width);
}

.hub-nav__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.72rem 0.25rem;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-nav);
  transition: color 0.2s, opacity 0.2s;
}

.hub-nav__link:hover {
  opacity: 1;
  color: var(--cream);
}

.hub-nav__link[aria-current="page"] {
  color: var(--cream);
  pointer-events: none;
  opacity: 1;
}

main {
  flex: 1;
  width: 100%;
  padding: 0 0 2.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.no-wrap {
  white-space: nowrap;
}

.main-inner {
  width: 100%;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.15rem;
  padding: 0.3rem;
  border: 1px solid var(--divider);
  border-radius: 999px;
}

.voice-toggle__label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-muted);
  padding-left: 0.45rem;
}

.voice-toggle__btn {
  border: 0;
  background: transparent;
  color: var(--cream-muted);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.voice-toggle__btn[aria-pressed="true"] {
  background: rgba(255, 245, 225, 0.1);
  color: var(--cream);
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.archive-card {
  border: 1px solid var(--divider);
  border-radius: 0.75rem;
  padding: 1rem;
}

.archive-card__jp {
  margin: 0 0 0.3rem;
  font-family: var(--font-jp);
  font-size: 1rem;
  font-weight: 600;
}

.archive-card__hira {
  margin: 0 0 0.45rem;
  font-family: var(--font-jp);
  font-size: 0.85rem;
  color: var(--cream-muted);
}

.archive-card__en {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  color: var(--cream);
}

.archive-card__link {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream);
}

.archive-card__link:hover {
  color: var(--cream-muted);
}

.lesson-card {
  padding-top: 2rem;
  border-top: 1px solid var(--divider);
}

.lesson-card:first-child {
  padding-top: 0;
  border-top: 0;
}

.lesson-card__page-link {
  margin-top: 1rem;
  text-align: center;
}

.lesson-card__page-link a {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.lesson-card__page-link a:hover {
  color: var(--cream);
}

.sentence-panel {
  text-align: center;
  margin-bottom: 2.5rem;
}

.sentence-panel__jp {
  font-family: var(--font-jp);
  font-size: clamp(1.6rem, 5.5vw, 2.05rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem;
}

.sentence-panel__hiragana {
  margin: 0;
  font-family: var(--font-jp);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--cream-muted);
}

.sentence-panel__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}

.sentence-panel__romaji {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--divider);
  border-radius: 50%;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.audio-btn:hover {
  border-color: var(--cream-muted);
  background: rgba(255, 245, 225, 0.06);
}

.audio-btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

.audio-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 2px;
}

.audio-voice-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  border: 1px solid var(--divider);
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.audio-btn[data-playing="true"] svg .play-shape {
  display: none;
}

.audio-btn:not([data-playing="true"]) svg .pause-shape {
  display: none;
}

.sentence-panel__en {
  margin: 1.25rem 0 0;
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--divider);
  padding-top: 1.75rem;
}

.breakdown--6 {
  grid-template-columns: repeat(6, 1fr);
}

.breakdown--7 {
  grid-template-columns: repeat(7, 1fr);
}

.breakdown__col {
  padding: 0 0.5rem;
  text-align: center;
}

.breakdown__col:not(:last-child) {
  border-right: 0;
}

.breakdown__jp {
  font-family: var(--font-jp);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.breakdown__jp-sub {
  font-family: var(--font-jp);
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--cream-muted);
  margin: 0 0 0.4rem;
  min-height: 1.25em;
}

.breakdown__jp-sub:empty {
  margin: 0;
  min-height: 0;
}

.breakdown__romaji {
  margin: 0 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--cream-muted);
}

.breakdown__en {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--cream);
  opacity: 0.95;
}

.page-about .prose {
  text-align: center;
}

.page-about .prose h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

.page-about .prose p {
  color: var(--cream-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin: 0 0 1rem;
}

.page-about .prose p:last-child {
  margin-bottom: 0;
}

.page-about .prose a {
  color: var(--cream);
  font-weight: 400;
}

.page-about .prose a:hover {
  color: var(--cream);
}

.page-about .prose .no-wrap {
  color: var(--cream);
}

.site-footer {
  width: 100%;
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.site-footer__logo {
  width: 3rem;
  opacity: 0.95;
}

.site-footer__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.site-footer__meta {
  margin-top: 0.15rem;
  text-align: center;
  padding: 0 0.75rem 0.35rem;
  max-width: 22rem;
}

.site-footer__tagline {
  margin: 0 0 0.4rem;
  font-size: 0.73rem;
  line-height: 1.45;
  letter-spacing: 0.045em;
  color: var(--cream-muted);
}

.site-footer__copy {
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-muted);
  opacity: 0.92;
}

.site-footer__top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--divider);
  border-radius: 50%;
  color: var(--cream);
  transition: background 0.2s, border-color 0.2s;
}

.site-footer__top:hover {
  opacity: 1;
  background: rgba(255, 245, 225, 0.06);
  border-color: var(--cream-muted);
}

.site-footer__top svg {
  width: 1.125rem;
  height: 1.125rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--divider);
  border-radius: 50%;
  color: var(--cream);
  transition: background 0.2s, border-color 0.2s;
}

.social-icon:hover {
  opacity: 1;
  background: rgba(255, 245, 225, 0.06);
  border-color: var(--cream-muted);
}

.social-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.site-footer__nav {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.site-footer__nav a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.site-footer__nav a:hover {
  color: var(--cream);
}

.footer-contact {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--cream);
  white-space: nowrap;
}

.footer-contact:hover {
  color: var(--cream);
}

@media (min-width: 561px) {
  /* Center the text column under the fox: flexbox centers the whole row, which biases content right */
  .hub-body {
    margin-left: calc((var(--nav-rail-width) + var(--hub-gap)) / -2 - var(--hub-body-shift-extra));
  }
}

@media (max-width: 560px) {
  .hub-body {
    flex-direction: column;
    align-items: center;
    gap: 1.35rem;
    max-width: var(--column-max);
    margin-left: 0;
  }

  .hub-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: var(--column-max);
    flex: 0 0 auto;
    gap: 0.65rem;
  }

  .hub-nav__link {
    flex: 1 1 auto;
    min-width: 7.75rem;
    max-width: 12rem;
  }

  .hub-column {
    max-width: 100%;
    width: 100%;
  }

  .breakdown--6 {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 0;
  }

  .breakdown--7 {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem 0;
  }
}

@media (min-width: 420px) {
  :root {
    --column-max: 24rem;
  }

  .breakdown__jp {
    font-size: 1rem;
  }

  .breakdown__romaji {
    font-size: 0.8125rem;
  }

  .breakdown__en {
    font-size: 0.75rem;
  }
}

@media (max-width: 340px) {
  .breakdown {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .breakdown__col:not(:last-child) {
    border-right: none;
    border-bottom: 0;
    padding-bottom: 0;
  }

  .breakdown__col:last-child {
    padding-bottom: 0;
  }
}
