/*
 * Grundlagen – Community Hub Light Design
 * Navigation update: v1.13.28 / Version A (compact responsive chapter selector)
 * UI mapping based on the existing spielerstatistik.php visual system.
 * Scope is deliberately restricted to .grundlagen-page so the frozen front page
 * and other frontend modules are not affected.
 */

.grundlagen-page {
  --gl-bg: #ece8dc;
  --gl-surface: #ffffff;
  --gl-surface-soft: #f7f4ed;
  --gl-ink: #1d2429;
  --gl-muted: #6e706a;
  --gl-line: #d8d3c7;
  --gl-line-strong: #c9c2b4;
  --gl-accent: #9f8740;
  --gl-accent-soft: #e9dfbd;
  --gl-dark: #11171b;
  --gl-shadow: 0 1px 3px rgba(23, 28, 31, .08);
  --gl-radius: 2px;

  color: var(--gl-ink);
  background: var(--gl-bg);
  padding-bottom: 38px;
}

.grundlagen-page,
.grundlagen-page * {
  box-sizing: border-box;
}

.grundlagen-page a {
  color: #263746;
  text-decoration-color: rgba(159, 135, 64, .55);
  text-underline-offset: 3px;
}

.grundlagen-page a:hover,
.grundlagen-page a:focus-visible {
  color: #11171b;
  text-decoration-color: var(--gl-accent);
}

/* Header: same light card language as the player/community hub reference. */
.grundlagen-page-head {
  position: relative;
  display: block;
  margin: 0 0 8px;
  padding: 18px 20px 17px;
  background: var(--gl-surface);
  border: 1px solid var(--gl-line);
  border-top: 3px solid var(--gl-accent);
  box-shadow: var(--gl-shadow);
}

.grundlagen-page-head::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  width: 76px;
  height: 3px;
  background: #c2a84d;
}

.grundlagen-page .community-kicker,
.grundlagen-kicker {
  margin: 0 0 5px;
  color: #77756e;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.grundlagen-page-head h1 {
  margin: 0;
  color: #1b2227;
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: .98;
  font-weight: 850;
  letter-spacing: -.035em;
  text-transform: none;
}

.grundlagen-page-head > div:first-child > p:last-child {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--gl-muted);
  font-size: 13px;
  line-height: 1.55;
}

/* Version A: one compact, sticky and responsive chapter navigation. */
.grundlagen-chapter-nav {
  position: sticky;
  top: var(--frontend-nav-height, 52px);
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(210px, 320px);
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(248, 246, 240, .97);
  border: 1px solid var(--gl-line);
  box-shadow: 0 2px 5px rgba(23, 28, 31, .07);
  backdrop-filter: blur(8px);
}

.grundlagen-chapter-nav__label {
  color: #8b742f;
  font-size: 9px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.grundlagen-chapter-nav__current {
  min-width: 0;
  overflow: hidden;
  color: #292f32;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grundlagen-chapter-nav__select-wrap {
  display: block;
  min-width: 0;
}

.grundlagen-chapter-nav__select {
  width: 100%;
  min-height: 34px;
  padding: 6px 34px 6px 10px;
  color: #313639;
  background: #fff;
  border: 1px solid var(--gl-line-strong);
  border-radius: 2px;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.grundlagen-chapter-nav__select:hover {
  border-color: #b8aa79;
}

.grundlagen-chapter-nav__select:focus-visible {
  outline: 2px solid rgba(159, 135, 64, .36);
  outline-offset: 2px;
  border-color: var(--gl-accent);
}

.grundlagen-page .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.grundlagen-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

/* Every source chapter becomes the same pale section/card system used in the hub. */
.grundlagen-section {
  scroll-margin-top: 118px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 14px;
  background: var(--gl-surface-soft);
  border: 1px solid var(--gl-line);
  box-shadow: var(--gl-shadow);
}

.grundlagen-section > .community-kicker:first-child,
.grundlagen-section > .section-head .community-kicker,
.grundlagen-section > .section-head > .community-kicker {
  margin-bottom: 6px;
}

.grundlagen-section .section-head {
  position: relative;
  margin: 0 0 10px;
  padding: 0 0 9px 0;
  border-bottom: 1px solid var(--gl-line);
}

.grundlagen-section .section-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: -14px;
  width: 54px;
  height: 3px;
  background: var(--gl-accent);
}

.grundlagen-section .section-head .content-body {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.grundlagen-section h2,
.grundlagen-section h3,
.grundlagen-section h4 {
  color: #1d2429;
}

.grundlagen-section h2 {
  margin: 0;
  font-size: clamp(19px, 2.1vw, 26px);
  line-height: 1.15;
  font-weight: 820;
  letter-spacing: -.02em;
}

.grundlagen-section h3 {
  margin: 18px 0 8px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
}

.grundlagen-section p,
.grundlagen-section li,
.grundlagen-section td,
.grundlagen-section th,
.grundlagen-section small {
  font-size: 12px;
  line-height: 1.58;
}

.grundlagen-section p {
  margin: 0 0 10px;
  color: #454a4c;
}

.grundlagen-section ol,
.grundlagen-section ul {
  margin: 10px 0 12px;
  padding-left: 22px;
  color: #454a4c;
}

.grundlagen-card,
.grundlagen-section > .content-body,
.grundlagen-section > .military-table-wrap,
.grundlagen-section .cms-panel,
.grundlagen-section .screenshot-frame {
  background: var(--gl-surface);
  border: 1px solid #ddd8cd;
  box-shadow: 0 1px 2px rgba(23, 28, 31, .05);
}

.grundlagen-card,
.grundlagen-section > .content-body,
.grundlagen-section > .military-table-wrap {
  width: 100%;
  max-width: none;
  padding: 14px 15px;
}

.grundlagen-section .content-body > h3:first-child,
.grundlagen-section .military-table-wrap > h3:first-child {
  margin-top: 0;
}

/* KPI/overview cards: compact cards like the player hub. */
.grundlagen-page .overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.grundlagen-page .overview-grid:has(.overview-card:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grundlagen-page .overview-card {
  min-width: 0;
  padding: 12px;
  color: #3d4345;
  background: var(--gl-surface);
  border: 1px solid #ddd8cd;
  border-top: 2px solid #b8a263;
  box-shadow: 0 1px 2px rgba(23, 28, 31, .05);
}

.grundlagen-page .overview-card .overview-title,
.grundlagen-page .overview-title {
  display: block;
  margin-bottom: 3px;
  color: #77736b;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.grundlagen-page .overview-card strong {
  display: inline-block;
  color: #1d2429;
  font-size: 15px;
  line-height: 1.2;
}

.grundlagen-page .overview-card small {
  display: inline-block;
  margin-top: 4px;
  color: #70736f;
}

/* Spielbetrieb: separate text rows prevent legacy <br> spacing and overlap. */
.grundlagen-page .overview-card--operation strong,
.grundlagen-page .overview-card--operation small {
  display: block;
}

.grundlagen-page .overview-card--operation strong {
  margin: 0;
}

.grundlagen-page .overview-card--operation small {
  margin: 8px 0 0;
}

.grundlagen-page .overview-card--operation .warning {
  margin-top: 14px;
}

/* Images retain source ordering, but now sit inside neutral reference cards. */
.grundlagen-page .responsive-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 10px auto 0;
  background: #e7e5df;
  border: 1px solid #d2cec4;
  box-shadow: 0 2px 8px rgba(26, 31, 34, .08);
  cursor: zoom-in;
}

.grundlagen-page .overview-card .responsive-img {
  margin-top: 9px;
}

.grundlagen-page .screenshot-frame {
  margin: 12px 0;
  padding: 10px;
}

.grundlagen-page .screenshot-caption {
  padding: 7px 2px 0;
  color: #77736b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Tables switch from dark military panels to light, fine-line data cards. */
.grundlagen-page .military-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.grundlagen-page .military-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  color: #3f4447;
  background: #fff;
}

.grundlagen-page .military-table th,
.grundlagen-page .military-table td {
  padding: 9px 10px;
  vertical-align: top;
  border: 1px solid #dedbd2;
  text-align: left;
}

.grundlagen-page .military-table thead th {
  color: #2a3034;
  background: #f1eee6;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.grundlagen-page .military-table tbody tr:nth-child(even) td {
  background: #fbfaf6;
}

.grundlagen-page code {
  padding: 1px 5px;
  color: #2b3134;
  background: #efede7;
  border: 1px solid #ddd8cb;
  border-radius: 2px;
  font-size: .92em;
}

/* Warnings and info boxes use restrained status accents instead of dark blocks. */
.grundlagen-page .warning {
  position: relative;
  margin: 11px 0 0;
  padding: 10px 12px 10px 14px;
  color: #5a5238;
  background: #fbf6e5;
  border: 1px solid #dfd2a6;
  border-left: 3px solid #b49b4f;
  font-size: 11px;
  line-height: 1.55;
}

.grundlagen-page .military-info-box {
  margin-top: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8d3c7;
  box-shadow: 0 1px 2px rgba(23, 28, 31, .05);
}

.grundlagen-page .mib-header {
  display: flex;
  align-items: stretch;
  min-height: 35px;
  background: #f1eee6;
  border-bottom: 1px solid #d8d3c7;
}

.grundlagen-page .mib-header-title {
  display: flex;
  align-items: center;
  padding: 7px 12px;
  border-left: 3px solid var(--gl-accent);
}

.grundlagen-page .mib-header-title h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.grundlagen-page .mib-header-stripes {
  flex: 1;
  opacity: .22;
  background: repeating-linear-gradient(135deg, transparent 0 8px, #9f8740 8px 9px);
}

.grundlagen-page .mib-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
}

.grundlagen-page .mib-icon-info {
  color: var(--gl-accent);
  font-size: 20px;
}

.grundlagen-page .mib-text-content h3:first-child {
  margin-top: 0;
}

.grundlagen-page .formula-box {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 8px 11px;
  color: #1e2529;
  background: #f3f0e8;
  border: 1px solid #d8d2c2;
  border-left: 3px solid var(--gl-accent);
  font-weight: 850;
  letter-spacing: .04em;
}

.grundlagen-page .formula-desc {
  color: #74746e;
  font-size: 11px;
}

.grundlagen-page .orange {
  color: #735d1e;
  font-weight: 750;
}

/* Modal image viewer */
.grundlagen-lightbox {
  width: min(94vw, 1180px);
  max-height: 92vh;
  padding: 38px 12px 12px;
  background: #f7f4ed;
  border: 1px solid #aaa397;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .32);
}

.grundlagen-lightbox::backdrop {
  background: rgba(12, 16, 19, .78);
}

.grundlagen-lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 54px);
  margin: auto;
}

.grundlagen-lightbox button {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #fff;
  background: #171d21;
  border: 1px solid #30373b;
  border-radius: 2px;
  font-size: 20px;
  line-height: 24px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .grundlagen-chapter-nav {
    grid-template-columns: auto minmax(0, 1fr) minmax(190px, 260px);
    gap: 9px;
  }

  .grundlagen-page .overview-grid,
  .grundlagen-page .overview-grid:has(.overview-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grundlagen-page-head,
  .grundlagen-section {
    padding: 12px;
  }

  .grundlagen-section .section-head::before {
    top: -12px;
  }

  .grundlagen-page .overview-grid,
  .grundlagen-page .overview-grid:has(.overview-card:nth-child(2):last-child) {
    grid-template-columns: 1fr;
  }

  .grundlagen-chapter-nav {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
  }

  .grundlagen-chapter-nav__label {
    display: none;
  }

  .grundlagen-chapter-nav__current {
    padding: 0 2px;
    font-size: 11px;
  }

  .grundlagen-chapter-nav__select {
    min-height: 42px;
    font-size: 16px;
  }

  .grundlagen-page .military-table th,
  .grundlagen-page .military-table td {
    min-width: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grundlagen-page *,
  .grundlagen-page *::before,
  .grundlagen-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
