/* src/styles.css */
:root {
  --bg: #fafaf8;
  --bg-sidebar: #1e293b;
  --bg-card: #fff;
  --text: #1a1a1a;
  --text-muted: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #fff;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --correct: #16a34a;
  --correct-bg: #dcfce7;
  --incorrect: #dc2626;
  --incorrect-bg: #fee2e2;
  --shadow: 0 1px 3px #0000000f, 0 1px 2px #0000000a;
}

* {
  box-sizing: border-box;
}

html, body, #root {
  color: var(--text);
  background: var(--bg);
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, Inter, Segoe UI, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
}

.hamburger {
  display: none;
  position: fixed;
  z-index: 30;
  background: var(--bg-sidebar);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: none;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  top: .65rem;
  left: .65rem;
}

.sidebar-scrim {
  display: none;
}

.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  overflow-y: auto;
  padding: 1rem .75rem 2rem;
  font-size: .9rem;
}

.sidebar-home {
  display: block;
  color: var(--text-sidebar-active);
  border-bottom: 1px solid #334155;
  margin-bottom: 1rem;
  padding: .5rem .75rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.sidebar-home:hover {
  text-decoration: none;
  color: #fff;
}

.sidebar-part {
  margin-bottom: 1.5rem;
}

.sidebar-part-title {
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
  margin: 0 0 .5rem .5rem;
  font-size: .7rem;
  font-weight: 600;
}

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

.sidebar-lesson {
  margin-bottom: .25rem;
}

.sidebar-lesson-header {
  display: flex;
  align-items:  center;
  gap: .25rem;
}

.sidebar-lesson-toggle {
  color: var(--text-sidebar);
  cursor: pointer;
  background: none;
  border: none;
  width: 1.5rem;
  padding: .25rem;
  font-size: .75rem;
}

.sidebar-lesson-link {
  display: block;
  color: var(--text-sidebar);
  border-radius: 4px;
  flex: 1;
  padding: .4rem .5rem;
}

.sidebar-lesson-link:hover {
  color: #fff;
  text-decoration: none;
  background: #334155;
}

.sidebar-lesson-link.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-lesson-num {
  opacity: .7;
  font-weight: 700;
}

.sidebar-lesson-count {
  opacity: .55;
  font-size: .78rem;
}

.sidebar-subsections {
  list-style: none;
  margin: .25rem 0 .5rem;
  padding: 0 0 0 1.75rem;
}

.sidebar-sub-link {
  display: block;
  color: #94a3b8;
  border-radius: 4px;
  padding: .3rem .5rem;
  font-size: .82rem;
}

.sidebar-sub-link:hover {
  color: #fff;
  text-decoration: none;
  background: #334155;
}

.sidebar-sub-link.active {
  background: var(--accent-light);
  color: var(--bg-sidebar);
}

.sidebar-sub-id {
  opacity: .7;
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .75rem;
}

.sidebar-sub-link {
  display: flex;
  align-items:  center;
  gap: .4rem;
}

.sidebar-sub-dot {
  background: none;
  border: 1px solid #475569;
  border-radius: 50%;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
}

.sidebar-sub-dot.visited {
  background: #64748b;
  border-color: #64748b;
}

.sidebar-sub-dot.complete {
  background: var(--correct);
  border-color: var(--correct);
}

.sidebar-lesson-count.all-complete {
  color: var(--correct);
  opacity: .9;
  font-weight: 600;
}

.app-main {
  overflow-y: auto;
  padding: 2.5rem 3rem;
}

.content {
  max-width: 760px;
  margin: 0 auto;
}

.content h1 {
  margin: 0 0 .25rem;
  font-size: 2rem;
}

.title-de {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 1.05rem;
  font-style: italic;
}

.lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.55;
}

.part-subcount {
  color: var(--text-muted);
  font-size: .95rem;
  font-weight: 400;
}

.breadcrumb {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: .85rem;
}

.landing {
  max-width: 760px;
}

.landing-hero {
  margin: 1rem 0 2rem;
}

.landing-hero h1 {
  letter-spacing: -.01em;
  margin: 0 0 .5rem;
  font-size: 2.4rem;
}

.landing-tagline {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
}

.landing-resume {
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
}

.landing-resume-label {
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  margin-bottom: .5rem;
  font-size: .72rem;
  font-weight: 700;
}

.landing-resume-link {
  display: flex;
  color: var(--text);
  align-items:  center;
  gap: .75rem;
  padding: .5rem 0;
}

.landing-resume-link:hover {
  text-decoration: none;
}

.landing-resume-link:hover .landing-resume-id {
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

.landing-resume-id {
  font-size: 1.05rem;
  font-weight: 600;
}

.landing-resume-de {
  color: var(--text-muted);
  flex: 1;
  font-size: .9rem;
  font-style: italic;
}

.landing-resume-arrow {
  color: var(--accent);
  font-size: 1.2rem;
}

.landing-progress-summary {
  color: var(--text-muted);
  margin-top: .5rem;
  font-size: .85rem;
}

.landing-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
  margin: 0 0 1.25rem;
}

.landing-cta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  box-shadow: var(--shadow);
  color: var(--text);
  border-radius: 8px;
  flex-direction: column;
  gap: .35rem;
  padding: 1.5rem 1.25rem;
  transition: border-color .15s, transform 50ms;
}

.landing-cta:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.landing-cta-icon {
  margin-bottom: .4rem;
  font-size: 1.6rem;
  line-height: 1;
}

.landing-cta-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.landing-cta-sub {
  color: var(--text-muted);
  font-size: .85rem;
}

.landing-secondary {
  text-align: center;
  margin: 1rem 0 0;
}

.landing-secondary-link {
  color: var(--text-muted);
  font-size: .9rem;
}

.landing-secondary-link:hover {
  color: var(--accent);
}

.lesson-grid, .subsection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
  margin: 1rem 0 2rem;
}

.lesson-card, .subsection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  box-shadow: var(--shadow);
  color: var(--text);
  border-radius: 8px;
  flex-direction: column;
  gap: .2rem;
  padding: .9rem 1rem;
  transition: border-color .15s, transform 50ms;
}

.lesson-card:hover, .subsection-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.lesson-card-num, .subsection-card-id {
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .72rem;
  font-weight: 700;
}

.lesson-card-title, .subsection-card-title {
  font-size: .98rem;
  font-weight: 600;
}

.lesson-card-de, .subsection-card-de {
  color: var(--text-muted);
  font-size: .82rem;
  font-style: italic;
}

.lesson-card-count {
  color: var(--text-muted);
  margin-top: .25rem;
  font-size: .78rem;
}

.lesson-card.is-complete {
  border-color: var(--correct);
  background: var(--correct-bg);
}

.lesson-card.is-complete .lesson-card-count {
  color: #166534;
  font-weight: 600;
}

.subsection-card.is-complete {
  border-color: var(--correct);
  background: var(--correct-bg);
}

.subsection-card.is-visited .subsection-card-id {
  opacity: .7;
}

.subsection-card-badge {
  display: inline-flex;
  color: var(--correct);
  justify-content: center;
  align-items:  center;
  margin-left: .4rem;
  font-size: .85rem;
  font-weight: 700;
}

.completion-bar {
  display: flex;
  justify-content: flex-end;
  margin: 2rem 0 0;
}

.completion-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  padding: .55rem 1rem;
  transition: border-color .15s, background .15s;
  font-family: inherit;
  font-size: .9rem;
}

.completion-toggle:hover {
  border-color: var(--correct);
}

.completion-toggle.completed {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: #166534;
  font-weight: 600;
}

.markdown {
  font-size: 1rem;
  line-height: 1.65;
}

.markdown h2 {
  border-bottom: 1px solid var(--border);
  margin-top: 2rem;
  padding-bottom: .3rem;
  font-size: 1.35rem;
}

.markdown h3 {
  margin-top: 1.5rem;
  font-size: 1.1rem;
}

.markdown code {
  background: #f1f5f9;
  border-radius: 3px;
  padding: .1rem .35rem;
  font-size: .92em;
}

.markdown pre {
  color: #e2e8f0;
  overflow-x: auto;
  background: #0f172a;
  border-radius: 6px;
  padding: 1rem;
}

.markdown blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  color: var(--text);
  margin: 1rem 0;
  padding: .5rem 1rem;
}

.markdown ul, .markdown ol {
  padding-left: 1.5rem;
}

.markdown table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

.markdown th, .markdown td {
  border: 1px solid var(--border);
  text-align: left;
  padding: .5rem .75rem;
}

.markdown th {
  background: #f8fafc;
  font-weight: 600;
}

.sign-embed {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  vertical-align: middle;
  border-radius: 6px;
  align-items:  center;
  gap: .75rem;
  max-width: 100%;
  margin: .5rem 0;
  padding: .5rem .75rem;
  transition: border-color .15s;
}

.sign-embed:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.sign-embed-img {
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  width: 48px;
  height: 48px;
}

.sign-embed-img img {
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
}

.sign-embed-body {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  min-width: 0;
  line-height: 1.2;
}

.sign-embed-code {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .7rem;
  font-weight: 700;
}

.sign-embed-title {
  font-size: .92rem;
  font-weight: 600;
}

.sign-embed-de {
  color: var(--text-muted);
  font-size: .78rem;
  font-style: italic;
}

.sign-embed-variants {
  color: var(--accent);
  margin-top: .15rem;
  font-size: .72rem;
}

.sign-embed-missing {
  display: inline;
  color: var(--incorrect);
  background: var(--incorrect-bg);
  border-radius: 3px;
  padding: .05rem .3rem;
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .85em;
}

.sidebar-signs-link {
  display: block;
  color: var(--text-sidebar);
  background: #334155;
  border-radius: 4px;
  margin: 0 0 1rem;
  padding: .5rem .75rem;
  font-size: .92rem;
  font-weight: 600;
}

.sidebar-signs-link:hover {
  color: #fff;
  text-decoration: none;
  background: #475569;
}

.sidebar-signs-link.active {
  background: var(--accent);
  color: #fff;
}

.signs-page {
  max-width: 1100px;
}

.signs-controls {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: .75rem;
  margin: 1.5rem 0;
}

.signs-search {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  flex: 1;
  min-width: 240px;
  padding: .55rem .85rem;
  font-family: inherit;
  font-size: .95rem;
}

.signs-search:focus {
  outline: none;
  border-color: var(--accent);
}

.signs-filter {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: .55rem .85rem;
  font-family: inherit;
  font-size: .92rem;
}

.signs-count {
  color: var(--text-muted);
  font-size: .85rem;
}

.signs-toggle {
  display: inline-flex;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  align-items:  center;
  gap: .4rem;
  font-size: .88rem;
}

.signs-toggle input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.signs-section {
  margin: 2rem 0;
}

.signs-section h2 {
  border-bottom: 1px solid var(--border);
  margin-bottom: .1rem;
  padding-bottom: .3rem;
}

.signs-category-de {
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: .9rem;
  font-style: italic;
}

.signs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem;
}

.sign-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  box-shadow: var(--shadow);
  overflow: hidden;
  border-radius: 8px;
  flex-direction: column;
  transition: border-color .15s;
}

.sign-card.expanded {
  border-color: var(--accent);
  grid-column: 1 / -1;
}

.sign-card.expanded .sign-card-main {
  flex-direction: row;
  align-items:  flex-start;
  gap: 1.25rem;
}

.sign-card.expanded .sign-card-img {
  flex-shrink: 0;
  width: 180px;
}

.sign-card.expanded .sign-card-body {
  flex: 1;
  padding-top: .25rem;
}

.sign-card.deprecated .sign-card-img {
  opacity: .65;
}

.sign-card-historical {
  display: inline-block;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #fef3c7;
  border-radius: 3px;
  margin-left: .4rem;
  padding: .1rem .4rem;
  font-family: -apple-system, BlinkMacSystemFont, Inter, sans-serif;
  font-size: .65rem;
  font-weight: 700;
}

.sign-card-main {
  display: flex;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  flex-direction: column;
  gap: .5rem;
  width: 100%;
  padding: .85rem;
}

.sign-card-main:hover {
  background: #f8fafc;
}

.sign-card-count {
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 400;
}

.sign-variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  border-top: 1px solid var(--border);
  background: #f8fafc;
  gap: .75rem;
  padding: 1rem;
}

.sign-variant {
  display: flex;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: 6px;
  flex-direction: column;
  align-items:  center;
  gap: .4rem;
  min-width: 0;
  padding: .75rem;
  transition: border-color .1s;
}

.sign-variant:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.sign-variant img {
  object-fit: contain;
  width: 100%;
  max-width: 110px;
  height: 110px;
}

.sign-variant-code {
  color: var(--accent);
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .7rem;
  font-weight: 600;
}

.sign-variant-label-en {
  color: var(--text);
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.25;
}

.sign-variant-label-de {
  color: var(--text-muted);
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: auto;
  max-width: 100%;
  font-size: .7rem;
  font-style: italic;
  line-height: 1.2;
}

.sign-card-img {
  aspect-ratio: 1;
  display: flex;
  overflow: hidden;
  background: #f8fafc;
  border-radius: 6px;
  justify-content: center;
  align-items:  center;
  width: 100%;
  padding: .5rem;
}

.sign-card-img img {
  object-fit: contain;
  display: block;
  width: 100%;
  height: 100%;
}

.sign-placeholder {
  display: flex;
  color: var(--text-muted);
  text-align: center;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  font-family: ui-monospace, SF Mono, monospace;
}

.sign-placeholder span {
  font-size: 1.3rem;
  font-weight: 700;
}

.sign-placeholder small {
  margin-top: .25rem;
  font-family: inherit;
  font-size: .7rem;
}

.sign-card-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sign-card-code {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  font-family: ui-monospace, SF Mono, monospace;
  font-size: .72rem;
  font-weight: 700;
}

.sign-card-title-en {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
}

.sign-card-title-de {
  color: var(--text-muted);
  font-size: .82rem;
  font-style: italic;
}

.sign-card-meaning {
  color: var(--text);
  margin-top: .3rem;
  font-size: .82rem;
  line-height: 1.45;
}

.prev-next {
  display: flex;
  border-top: 1px solid var(--border);
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
}

.prev-next-link {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  flex: 1;
  max-width: 48%;
  padding: .75rem 1rem;
  font-size: .9rem;
}

.prev-next-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.prev-next-link.prev {
  text-align: left;
}

.prev-next-link.next {
  text-align: right;
}

.app-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-align: center;
  margin-top: 4rem;
  padding: 1.5rem 0;
  font-size: .8rem;
  line-height: 1.55;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.app-footer a:hover {
  color: var(--accent);
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .hamburger {
    display: flex;
    justify-content: center;
    align-items:  center;
  }

  .sidebar {
    position: fixed;
    z-index: 25;
    width: min(85vw, 320px);
    transition: transform .2s ease-out;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 2px 0 10px #0003;
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-layout.sidebar-open .sidebar-scrim {
    display: block;
    position: fixed;
    z-index: 20;
    background: #00000073;
    inset: 0;
  }

  .app-main {
    padding: 3.5rem 1.25rem 2rem;
  }

  .content h1 {
    font-size: 1.55rem;
  }

  .lesson-grid, .subsection-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .6rem;
  }

  .signs-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .6rem;
  }

  .sign-variants {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    padding: .75rem;
  }

  .sign-variant img {
    max-width: 90px;
    height: 90px;
  }

  .sign-card.expanded .sign-card-main {
    flex-direction: column;
  }

  .sign-card.expanded .sign-card-img {
    align-self:  center;
    width: 100%;
    max-width: 220px;
  }

  .signs-controls {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
  }

  .signs-search {
    width: 100%;
  }

  .signs-toggle, .signs-count {
    text-align: left;
  }

  .prev-next {
    flex-direction: column;
  }

  .prev-next-link {
    max-width: 100%;
  }

  .prev-next-link.next, .prev-next-link.prev {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 3.25rem .85rem 1.5rem;
  }

  .content h1 {
    font-size: 1.35rem;
  }

  .lead {
    font-size: .95rem;
  }

  .lesson-grid, .subsection-grid, .signs-grid, .landing-cta-grid {
    grid-template-columns: 1fr;
  }

  .sign-variants {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: .5rem;
    padding: .6rem;
  }

  .sign-variant {
    gap: .3rem;
    padding: .5rem;
  }

  .sign-variant img {
    max-width: 70px;
    height: 70px;
  }

  .markdown {
    font-size: .95rem;
  }

  .markdown h2 {
    font-size: 1.15rem;
  }
}
