/* ---------------------------------------------------------------
   /learn — Ben's German Grammar Guide

   Follows the design language set in style.css: one paper ground,
   hairline rules instead of coloured blocks, Zen Old Mincho for
   display type, and a single filled panel reserved for asides.
   --------------------------------------------------------------- */

:root {
  --learn-sidebar-width: 250px;
}

/* --- Mobile level jump bar (hidden on desktop) --------------------- */

.learn-jump {
  display: none;
}

@media (max-width: 900px) {
  .learn-jump {
    display: flex;
    gap: calc(var(--space) * 1.25);
    overflow-x: auto;
    padding: 0.75rem var(--space);
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .learn-jump a {
    flex: 0 0 auto;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .learn-jump a:hover {
    color: var(--indigo);
  }
}

/* --- Layout --------------------------------------------------- */

.learn-layout {
  display: flex;
  align-items: flex-start;
  gap: calc(var(--space) * 3.5);
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(var(--space) * 3) var(--space) calc(var(--space) * 5);
}

.learn-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--max-width-wide);
}

/* --- Sidebar --------------------------------------------------- */

.learn-sidebar {
  flex: 0 0 var(--learn-sidebar-width);
  position: sticky;
  top: calc(var(--space) * 2);
  max-height: calc(100vh - var(--space) * 4);
  overflow-y: auto;
  padding-right: calc(var(--space) * 1.5);
  border-right: 1px solid var(--rule);
}

.learn-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  margin-bottom: calc(var(--space) * 2);
}

.learn-brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--rule);
  flex: 0 0 auto;
}

.learn-sidebar-title {
  margin: 0 0 1em;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-level {
  margin-bottom: 1.75em;
}

.toc-level-link {
  display: block;
  text-decoration: none;
  color: var(--indigo);
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.6em;
}

.toc-level-link strong {
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-right: 0.45em;
}

.toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-sublist li {
  margin-bottom: 0.5em;
}

.toc-sublist a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.toc-sublist a:hover {
  color: var(--clay);
}

@media (max-width: 900px) {
  .learn-sidebar {
    display: none;
  }

  .learn-layout {
    padding-top: calc(var(--space) * 2);
  }
}

/* --- Intro (the one filled aside) --------------------------------- */

.learn-intro {
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.75);
  background: var(--paper-deep);
  border-radius: var(--radius);
  padding: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 3.5);
}

.learn-intro > div {
  min-width: 0;
}

.learn-intro-art {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--rule);
}

.learn-intro h1 {
  margin: 0 0 0.35em;
  font-size: 1.85rem;
  color: var(--indigo);
}

.learn-intro p {
  margin: 0;
  color: var(--ink);
  max-width: 58ch;
}

@media (max-width: 560px) {
  .learn-intro {
    flex-direction: column;
    text-align: center;
  }

  .learn-intro > div {
    width: 100%;
  }
}

/* --- Level sections ------------------------------------------------ */

.level {
  margin-bottom: calc(var(--space) * 4);
}

.level-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  border-bottom: 1px solid var(--indigo);
  padding-bottom: 0.5em;
  margin-bottom: 1.5em;
}

.level-code {
  font-size: 1.9rem;
  color: var(--indigo);
  letter-spacing: 0.04em;
}

.level-name {
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.level h3 {
  font-size: 1.2rem;
  color: var(--indigo);
  margin: 2.5em 0 0.7em;
  padding-top: 1.2em;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}

.level h3:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Subheadings inside a section ("Plurals", "Definite articles") — these come
   from ### in the source and carry no anchor, so they stay visibly lighter
   than the numbered section headings above them. */
.level h4 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 2em 0 0.6em;
}

/* --- Grammar tables ------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  margin: 1.75em 0 2.25em;
}

.level table {
  width: 100%;
  min-width: 24rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.level th,
.level td {
  border-bottom: 1px solid var(--rule);
  padding: 0.7em 1.25em 0.7em 0;
  text-align: left;
  vertical-align: top;
}

.level th:last-child,
.level td:last-child {
  padding-right: 0;
}

.level th {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  white-space: nowrap;
}

.level em {
  color: var(--clay);
  font-style: italic;
}

.level strong {
  font-weight: 600;
}

.level ul {
  padding-left: 1.1rem;
}

.level li {
  margin-bottom: 0.4em;
}

/* --- Closing notes -------------------------------------------------- */

.closing-notes {
  background: var(--paper-deep);
  border-radius: var(--radius);
  padding: calc(var(--space) * 2);
}

.closing-notes h2 {
  margin-top: 0;
  font-size: 1.4rem;
  color: var(--indigo);
}

.closing-notes p {
  max-width: 62ch;
}

.closing-cta {
  margin: 1.5em 0 0;
}

.back-to-top {
  text-align: center;
  margin-top: calc(var(--space) * 3);
}

.back-to-top a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.back-to-top a:hover {
  color: var(--indigo);
}
