/* ============================================================
   RATIOMERA STATISTICS — SITE STYLESHEET  v1.2.0

   What this file does:
     Defines every custom CSS class used on the Ratiomera Statistics
     website. No .qmd page should ever contain inline CSS —
     all styling comes from classes defined here.

   How it relates to custom.scss:
     custom.scss overrides Bootstrap/Quarto theme variables
     (colours, fonts, spacing). This file adds custom
     components on top: cards, grids, badges, status dots,
     team layouts, etc.

   Rule: If you want to add a new visual element to any page,
     define its CSS class here first, then use that class name
     in the .qmd file. Never write style="..." in a .qmd file.

   IMPORTANT: After any change to this file, run:
     quarto render
   to rebuild the site and see the effect.
   ============================================================ */


/* ============================================================
   LAYOUT

   Controls the maximum width of page content on non-sidebar
   pages (homepage, about, contact, support). Without this,
   content would stretch to fill very wide monitors and become
   hard to read.

   The .page-columns gap override tightens the gutter between
   Quarto's content, sidebar, and margin columns.
   ============================================================ */

/* Caps content width at 1280px on non-sidebar pages.
   On pages WITH a sidebar (Statistics 1 topics), the grid
   layout from custom.scss already limits the width. */
.quarto-content {
  max-width: 1280px;
}

/* Removes the default gap between Quarto's layout columns.
   The individual components handle their own internal spacing,
   so this outer gap would cause unwanted double-spacing. */
#quarto-content .page-columns {
  gap: 0;
}


/* ============================================================
   ANIMATIONS

   Two reusable entrance animations used on homepage elements.
   Add class="fade-in" or class="slide-up" to any HTML element
   to animate it when the page loads.

   These are subtle (< 0.6 seconds) — decorative only.
   Do not overuse them; they should not be applied to content
   the user needs to read immediately.
   ============================================================ */

/* Fades element in from invisible to fully visible over 0.55s */
.fade-in {
  opacity: 0; /* Start invisible */
  animation: fadeIn 0.55s ease forwards; /* forwards = stays visible after animation ends */
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Slides element up 10 pixels while fading in — adds subtle depth */
.slide-up {
  opacity: 0;
  transform: translateY(10px); /* Start 10px lower than final position */
  animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); } /* End at natural position, fully visible */
}


/* ============================================================
   HOMEPAGE — HERO BLOCK

   The large introduction block at the top of the homepage
   (index.qmd). Contains the site title and tagline.

   Intentionally calm: light background, no border, no gradient.
   The padding creates generous breathing room around the text.

   Used with class="cs-hero" in index.qmd.
   ============================================================ */

.cs-hero {
  background: #f4f7fb;  /* Very light blue-grey — lifts the block off the white page */
  border-radius: 12px;
  padding: 40px 48px;
  margin-bottom: 44px;
}

/* The main site title inside the hero block */
.cs-hero h1 {
  margin-top: 0;         /* Removes default heading top margin — sits flush with padding */
  font-size: 2.15rem;
  letter-spacing: -0.03em;
  color: #111827;
}

/* The one-line subtitle beneath the title ("Free statistics education...") */
.hero-tagline {
  font-size: 1.05rem;
  color: #4b5563;
  margin-top: 0.5rem;
  margin-bottom: 0;
  line-height: 1.70;
}

/* ── Status Badges ──────────────────────────────────────────
   Small pill-shaped labels used in topic cards and status
   tables to show content development state.

   Seven variants map to the seven public content states configured in
   _variables.yml:
     .not-started → Not Started (grey)
     .planned     → Planned     (purple)
     .draft       → Draft       (yellow)
     .in-progress → In Progress (orange)
     .review      → In Review   (teal)
     .published   → Published   (green)
     .updating    → Updating    (blue)

   Keep these variants synchronized with the public labels in _variables.yml.
   ─────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 660;
  letter-spacing: 0.05em;
  text-transform: uppercase; /* All caps — makes small text scannable */
  padding: 2px 9px;
  border-radius: 20px;       /* Pill shape — fully rounded ends */
  vertical-align: middle;    /* Aligns badge with surrounding text on the same baseline */
}

/* Seven distinct status states — each with a unique colour */
.status-badge.not-started   { background: var(--status-not-started-bg); color: var(--status-not-started-fg); }
.status-badge.planned       { background: var(--status-planned-bg); color: var(--status-planned-fg); }
.status-badge.draft         { background: var(--status-draft-bg); color: var(--status-draft-fg); }
.status-badge.in-progress   { background: var(--status-in-progress-bg); color: var(--status-in-progress-fg); }
.status-badge.review        { background: var(--status-review-bg); color: var(--status-review-fg); }
.status-badge.published     { background: var(--status-published-bg); color: var(--status-published-fg); }
.status-badge.updating      { background: var(--status-updating-bg); color: var(--status-updating-fg); }


/* ============================================================
   CONTENT CARDS

   Subtle boxed sections used to group related content within
   a page. Less prominent than platform cards — intended for
   body content areas, not navigation.

   Used with class="cs-card" in .qmd files.

   Two accent variants add a coloured left border:
     .accent-blue  → draws attention to important information
     .accent-green → used for completed or positive content
   ============================================================ */

.cs-card {
  border: 1px solid #e8ebef;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
  background: #fafbfc; /* Very slightly off-white — distinguishes card from page background */
}

/* Remove default top margin from headings that start a card —
   the card's padding already provides the top space */
.cs-card h3,
.cs-card h4 {
  margin-top: 0;
}

/* Left accent border variants — adds a 3px coloured stripe on the left edge */
.cs-card.accent-blue  { border-left: 3px solid #1d4e7a; } /* Navy blue */
.cs-card.accent-green { border-left: 3px solid #2d7a4f; } /* Dark green */


/* ============================================================
   FEATURES BLOCK (homepage)

   A responsive grid of small feature tiles used on the homepage
   to highlight platform capabilities ("Free", "Interactive", etc.).

   auto-fill + minmax makes the grid automatically decide how
   many columns fit at each screen width.

   Used with class="features-grid" wrapping class="feature-item" divs.
   ============================================================ */

.features-grid {
  display: grid;
  /* Fills as many 195px-wide columns as fit; last row items stretch to fill gaps */
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
  margin: 20px 0 44px;
}

/* Individual feature tile */
.feature-item {
  padding: 20px 22px;
  border-radius: 10px;
  background: #f8f9fb;
  border: 1px solid #e8eaee;
}

/* Feature title — small and bold */
.feature-item h5 {
  margin: 0 0 6px;
  font-size: 0.875rem;
  font-weight: 640;
  color: #1a2233;
}

/* Feature description — small grey text below the title */
.feature-item p {
  margin: 0;
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.5;
}


/* ============================================================
   PLATFORM SECTION GRID (homepage)

   An older card grid layout for listing platform modules.
   Currently superseded by the Module List (below) but kept
   for potential future use.

   If this component is no longer used in any .qmd file,
   it can safely be deleted.
   ============================================================ */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 15px;
  margin: 24px 0 44px;
}

/* Individual platform section card */
.platform-card {
  border: 1px solid #e0e4ea;
  border-radius: 12px;
  padding: 22px 22px 18px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.035); /* Very faint shadow — lifts card off page */
  text-decoration: none !important; /* Card is a link — suppress underline on the whole block */
  color: inherit !important;        /* Prevent link colour overriding card text colours */
  display: block;
  transition: border-color 0.18s, box-shadow 0.18s; /* Smooth hover effect */
}

/* Hover: blue border + stronger shadow — signals the card is clickable */
.platform-card:hover {
  border-color: #1d4e7a;
  box-shadow: 0 3px 12px rgba(29, 78, 122, 0.1);
  text-decoration: none !important;
}

/* Small uppercase label above card title (e.g. "STATISTICS") */
.platform-card .platform-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #1d5fa0;
  margin-bottom: 7px;
  display: block;
}

/* Card title */
.platform-card h4 {
  margin: 0 0 6px;
  font-size: 0.925rem;
  font-weight: 640;
  color: #111827;
}

/* Card description */
.platform-card p {
  margin: 0;
  font-size: 0.81rem;
  color: #6b7280;
  line-height: 1.48;
}

/* Status line at the bottom of each platform card */
.platform-card .card-status {
  font-size: 0.7rem;
  font-weight: 640;
  margin-top: 12px;
  display: block;
}

/* Status colour variants for card footer text */
.platform-card .card-status.active { color: #166534; } /* Green = live */
.platform-card .card-status.soon   { color: #9ca3af; } /* Grey = coming soon */


/* ============================================================
   MODULE LIST (homepage)

   The main module navigation on the homepage — a vertical list
   of rows, one per course module (Statistics 1, Statistics 2,
   Advanced Statistics, etc.).

   Replaces the older platform grid with a linear, scannable
   layout. Each row is a clickable link.

   Structure:
     .module-list          → the outer container
       .module-item        → one row (link)
         .module-info      → left side: label + title + description
           .module-label   → small uppercase category label
           .module-title   → module name
           .module-desc    → one-line description
         .module-status    → right side: status badge pill

   The left border changes to primary blue on hover to signal
   which row the user is about to click.
   ============================================================ */

/* Outer container — vertical stack with a single shared border */
.module-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e4ea;
  border-radius: 10px;
  overflow: hidden; /* Clips child borders to the container's rounded corners */
  margin: 28px 0 44px;
}

/* One module row — horizontally divided into info (left) and status badge (right) */
.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid #f0f1f3; /* Row divider — very faint */
  border-left: 3px solid transparent; /* Invisible left border — becomes blue on hover */
  text-decoration: none !important;
  color: inherit !important;
  transition: background 0.15s, border-left-color 0.15s;
}

/* Last row has no bottom border — the container's border handles the bottom edge */
.module-item:last-child {
  border-bottom: none;
}

/* Hover: light blue background + blue left border accent */
.module-item:hover {
  background: #f4f7fb;
  border-left-color: #1d4e7a;
  text-decoration: none !important;
}

/* Left side of each row — stacks label, title, description vertically */
.module-info {
  display: flex;
  flex-direction: column;
  gap: 3px; /* Small gap between label/title/description */
}

/* Small uppercase course category label (e.g. "STATISTICS 1") */
.module-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #1d5fa0;
}

/* Module name in medium-bold */
.module-title {
  font-size: 0.96rem;
  font-weight: 640;
  color: #111827;
}

/* Brief description of the module */
.module-desc {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.45;
}

/* Status pill on the right side of each row.
   Colour variants match the same states as .status-badge above.
   Uses the same seven states configured in _variables.yml. */
.module-status {
  font-size: 0.72rem;
  font-weight: 640;
  letter-spacing: 0.03em;
  white-space: nowrap;  /* Prevents badge from wrapping to two lines */
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: 24px;    /* Gap between the module info and the badge */
  flex-shrink: 0;       /* Badge never shrinks — always shows full text */
}

.module-status.not-started   { background: var(--status-not-started-bg); color: var(--status-not-started-fg); }
.module-status.planned       { background: var(--status-planned-bg); color: var(--status-planned-fg); }
.module-status.draft         { background: var(--status-draft-bg); color: var(--status-draft-fg); }
.module-status.in-progress   { background: var(--status-in-progress-bg); color: var(--status-in-progress-fg); }
.module-status.review        { background: var(--status-review-bg); color: var(--status-review-fg); }
.module-status.published     { background: var(--status-published-bg); color: var(--status-published-fg); }
.module-status.updating      { background: var(--status-updating-bg); color: var(--status-updating-fg); }


/* ============================================================
   CENTERED BUTTON ROW

   A simple wrapper that centres one or more buttons horizontally.
   Used on landing pages and the support page.

   Usage in .qmd:
     <div class="btn-center">
       <a href="..." class="dl-btn">Download</a>
     </div>
   ============================================================ */

.btn-center {
  text-align: center;
  margin: 24px 0 32px;
}


/* ============================================================
   DOWNLOADS TABLE (downloads/index_downloads.qmd)

   Styled HTML table for showing available PDF materials per
   topic. Columns: Topic | Theory Sheet | Summary | Exercises | Solutions.
   Cells show a download link when materials are available, or a
   status-badge when they are not yet ready.

   Use class="dl-table" on the <table> element.
   ============================================================ */

.dl-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e4ea;
  border-radius: 10px;
  overflow: hidden;
  margin: 20px 0 40px;
  font-size: 0.875rem;
}

.dl-table thead th {
  background: #f4f7fb;
  padding: 10px 16px;
  text-align: left;
  font-weight: 640;
  font-size: 0.79rem;
  letter-spacing: 0.03em;
  color: #374151;
  border-bottom: 1px solid #e0e4ea;
}

.dl-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
  color: #374151;
}

.dl-table tbody tr:last-child td {
  border-bottom: none;
}

.dl-table tbody td:first-child {
  font-weight: 540;
  color: #111827;
  white-space: nowrap;  /* Prevents topic names from wrapping to two lines */
}

.dl-table tbody tr:hover td {
  background: #f9fafb;
}

/* Centre the download cells (columns 2+) */
.dl-table thead th:not(:first-child),
.dl-table tbody td:not(:first-child) {
  text-align: center;
}

/* Group header row ("Core Materials" / "Extended Practice") spanning
   several columns via colspan. Centred and slightly muted so it reads
   as a category label sitting above the specific column headers. */
.dl-table thead tr:first-child th[colspan] {
  text-align: center;
  color: #6b7280;
  font-size: 0.72rem;
  border-bottom: 1px solid #e8ebef;
}

/* The Topic header spans both header rows via rowspan — vertically
   centre it so it sits evenly alongside the two-row header stack. */
.dl-table thead th[rowspan] {
  vertical-align: middle;
}


/* ============================================================
   CONTENT TABLE (topic pages — Theory, Simulated Example, Summary tabs)

   Applies the same visual treatment as dl-table to all tables
   inside a .panel-tabset (theory, example, summary content).
   Excludes the DT interactive datatable via :not(.dataTable).

   No text-align override here — kable() alignment attributes
   and Markdown pipe table alignment are preserved as-is.
   ============================================================ */

.panel-tabset table:not(.dataTable) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e0e4ea;
  border-radius: 10px;
  overflow: hidden;
  margin: 16px 0 28px;
  font-size: 0.875rem;
}

.panel-tabset table:not(.dataTable) thead th {
  background: #f4f7fb;
  padding: 10px 16px;
  font-weight: 640;
  font-size: 0.79rem;
  letter-spacing: 0.03em;
  color: #374151;
  border: none;
  border-bottom: 1px solid #e0e4ea;
}

.panel-tabset table:not(.dataTable) tbody td {
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
  color: #374151;
}

.panel-tabset table:not(.dataTable) tbody tr:last-child td {
  border-bottom: none;
}

.panel-tabset table:not(.dataTable) tbody tr:hover td {
  background: #f9fafb;
}


/* ============================================================
   LEGACY TOPIC-CARD COMPATIBILITY

   Retained for compatibility with earlier card-based overview markup.
   The current Introduction overview uses .course-sequence, while the
   Downloads page uses the distinct .download-topic-* component family.

   Structure:
     .topic-grid            → outer grid container
       .topic-card          → one card (link)
         .topic-number      → "TOPIC 1" label
         h4                 → topic name
         p                  → description
         .topic-chip        → status badge inside the card

   Status strip: A 3px left border colour indicates status at
   a glance even before reading the badge text:
     .status-complete     → green left border
     .status-in-progress  → amber left border
     .status-coming-soon  → grey left border + dimmed + non-clickable
   ============================================================ */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 16px;
  margin: 28px 0 44px;
}

/* Individual topic card */
.topic-card {
  border: 1px solid #e0e4ea;
  border-radius: 11px;
  padding: 20px 22px 18px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  text-decoration: none !important;
  color: inherit !important;
  display: block;
  position: relative; /* Allows absolute-positioned children inside the card if needed */
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.14s;
}

/* Hover: lifts card 2px and adds blue border — signals interactivity */
.topic-card:hover {
  border-color: #1d4e7a;
  box-shadow: 0 4px 14px rgba(29, 78, 122, 0.11);
  transform: translateY(-2px); /* Subtle upward lift on hover */
  text-decoration: none !important;
}

/* Small uppercase topic number label (e.g. "TOPIC 1") */
.topic-card .topic-number {
  font-size: 0.68rem;
  font-weight: 720;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #1d5fa0;
  margin-bottom: 8px;
  display: block;
}

/* Topic name */
.topic-card h4 {
  margin: 0 0 9px;
  font-size: 0.96rem;
  font-weight: 640;
  line-height: 1.3;
  color: #111827;
}

/* One-line topic description */
.topic-card p {
  margin: 0;
  font-size: 0.835rem;
  color: #6b7280;
  line-height: 1.5;
}

/* ── Status strips — left border colour ──────────────────── */

/* Green left border = topic is complete */
.topic-card.status-complete {
  border-left: 3px solid #2d7a4f;
}

/* Amber left border = topic is in active development */
.topic-card.status-in-progress {
  border-left: 3px solid #b85c00;
}

/* Grey left border = placeholder only; dimmed; not clickable.
   pointer-events: none prevents the card from being clicked.
   transform: none !important prevents the hover lift animation. */
.topic-card.status-coming-soon {
  border-left: 3px solid #d1d5db;
  opacity: 0.65;            /* Visually de-emphasised — signals "not yet available" */
  pointer-events: none;     /* Disables clicking and hover effects entirely */
  transform: none !important;
}

/* Status chip — small pill inside the card below the description */
.topic-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 680;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 10px;
}

.topic-chip.complete  { background: #e6f4ec; color: #166534; } /* Green */
.topic-chip.soon      { background: #f3f4f6; color: #9ca3af; } /* Grey */


/* ============================================================
   SECTION INTRO BLOCK

   A calm introduction block used on organization, branch, overview,
   contact, support, and planned-state pages.

   Used with class="section-intro" in section index files.
   ============================================================ */

.section-intro {
  background: #f4f7fb;   /* Same light blue-grey as the homepage hero */
  border-radius: 10px;
  padding: 28px 36px;
  margin-bottom: 36px;
}

/* When an h1 is placed inside section-intro (landing page, downloads page),
   give it page-title sizing and remove Quarto's default bottom border. */
.section-intro h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #111827;
  margin-top: 0;
  margin-bottom: 0.5rem;
  border-bottom: none;
}

/* Section subheadings inside the intro block get no top margin or border */
.section-intro h2 {
  margin-top: 0;
  border-bottom: none;
}


/* ============================================================
   LEGACY PLACEHOLDER / COMING-SOON NOTICE

   A dashed-border fallback retained for compatibility with earlier
   unavailable-content markup. Current download availability is rendered
   from downloads.yml, and current planned pages use explicit status copy.
   ============================================================ */

.cs-placeholder {
  background: #f8f9fb;
  border: 1px dashed #c8cfd8; /* Dashed border = visually signals "not final" */
  border-radius: 10px;
  padding: 30px 36px;
  margin: 28px 0;
  text-align: center;
  color: #6b7280;
}

/* Text inside the placeholder — slightly muted colour */
.cs-placeholder p {
  color: #6b7280;
}

/* Last paragraph has no bottom margin — padding handles the bottom space */
.cs-placeholder p:last-child {
  margin-bottom: 0;
}

/* Bold text inside placeholder is slightly darker — for titles/headings */
.cs-placeholder strong {
  color: #374151;
}


/* ============================================================
   LEGACY TEXT-ONLY BRAND LOCKUP

   Retained for compatibility with earlier text-only brand markup.
   Canonical navigation and branch cards now use the SVG logo system in
   assets/brand/.

   Usage in .qmd (raw HTML):
     <div class="brand-lockup">
       <span class="brand-mark mark-ratiomera">R</span>
       <span class="brand-wordmark">Ratiomera</span>
     </div>

   Colour variants (one per brand):
     .mark-ratiomera      → navy   (the umbrella)
     .mark-statistics  → blue   (Ratiomera Statistics)
     .mark-mathematics → amber  (Ratiomera Mathematics)
   ============================================================ */

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: -0.02em;
}

.brand-mark.mark-ratiomera      { background: #1d4e7a; }
.brand-mark.mark-statistics  { background: #2e6da4; }
.brand-mark.mark-mathematics { background: #b85c00; }

.brand-wordmark {
  font-weight: 700;
  font-size: 1.1rem;
  color: #111827;
  letter-spacing: -0.02em;
}


/* ============================================================
   BRANCH CARDS (homepage hero, about page)

   Two large, fully-clickable cards for Ratiomera Statistics and
   Ratiomera Mathematics: the "choose your path" moment on the
   homepage. It replaces an earlier organization-chart-style diagram
   with a clearer choice between the two branches, using the same
   identity colours as .brand-mark.

   Structure:
     <div class="branch-cards">
       <a class="branch-card branch-card-statistics" href="...">
         <span class="branch-card-mark">S</span>
         <div class="branch-card-name">Ratiomera Statistics</div>
         <div class="branch-card-tagline">...</div>
         <span class="topic-chip complete">Live now</span>
         <span class="branch-card-cta">Explore Statistics &rarr;</span>
       </a>
       <a class="branch-card branch-card-mathematics" href="...">...</a>
     </div>
   ============================================================ */

.branch-cards {
  margin: 32px 0 12px;
}

/* Pandoc wraps the two <a class="branch-card"> tags in a single <p>
   (they contain only inline-safe children, no blank line between
   them) — the flex layout has to target that <p>, not .branch-cards
   itself. */
.branch-cards > p {
  display: flex;
  gap: 20px;
  margin: 0;
}

.branch-card {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 36px 30px;
  border-radius: 16px;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.branch-card:hover,
.branch-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.24);
  text-decoration: none;
  color: #ffffff;
}

.branch-card-statistics {
  background: linear-gradient(135deg, #3a7cba 0%, #1d4e7a 100%);
}

.branch-card-mathematics {
  background: linear-gradient(135deg, #e69a3d 0%, #b85c00 100%);
}

.branch-card-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.branch-card-name {
  display: block;
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.branch-card-tagline {
  display: block;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.branch-card-cta {
  margin-top: auto;
  padding-top: 16px;
  font-weight: 660;
  font-size: 0.94rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.18s ease;
}

.branch-card:hover .branch-card-cta,
.branch-card:focus-visible .branch-card-cta {
  gap: 11px;
}

@media (max-width: 640px) {
  .branch-cards > p {
    flex-direction: column;
  }
}


/* ============================================================
   LEGACY DONATION-PANEL COMPATIBILITY

   Retained for an earlier donation-status panel. The current Support page
   states in ordinary prose that donations are not accepted yet and explains
   the possible future association framework without a payment component.

   Used with class="donate-panel" wrapping a heading, body text,
   and a placeholder/status-badge for payment details.
   ============================================================ */

.donate-panel {
  background: linear-gradient(135deg, #f4f7fb 0%, #eaf1f9 100%);
  border: 1px solid #d7e3ef;
  border-radius: 12px;
  padding: 30px 34px;
  margin: 24px 0 32px;
}

.donate-panel h3 {
  margin-top: 0;
}

.donate-panel p:last-child {
  margin-bottom: 0;
}

.donate-panel .donate-status {
  margin-top: 16px;
}


/* ============================================================
   TEAM SECTION (contact page)

   A responsive text-only profile layout for named team members on the localized
   contact-ratiomera pages.

   Structure:
     .team-section           → vertical stack of members
       .team-member          → one text-only member card
   ============================================================ */

/* Vertical stack of all team members with generous gap between rows */
.team-section {
  display: flex;
  flex-direction: column;
  gap: 52px;
  margin: 32px 0 56px;
}

/* Text-only member layout */
.team-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

/* Container for name, role, and bio text */
.team-bio {
  padding-top: 4px;
}

/* Team member name */
.team-name {
  font-size: 1.12rem;
  font-weight: 660;
  color: #111827;
  margin-bottom: 4px;
  line-height: 1.3;
}

/* Job title / role */
.team-role {
  font-size: 0.875rem;
  font-weight: 580;
  color: #374151;
  margin-bottom: 2px;
}

/* Brief experience summary (e.g. "8 years teaching statistics") */
.team-experience {
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 16px;
}

/* Full biography paragraph */
.team-text {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.72; /* Generous spacing for longer bio text */
  margin: 0;
}


/* ============================================================
   ROADMAP TABLE (Statistics landing page)

   A status table showing the text-labelled development state of the
   learning sequence, downloads, and counter infrastructure.

   Structure:
     <table class="roadmap-table">
       <tr>
         <th scope="row">Topic name</th>
         <td>Status description</td>
       </tr>

   Current rows use .status-badge labels. The .roadmap-dot variants below
   remain only as compatibility styling for older generated markup.
   ============================================================ */

.roadmap-table {
  width: 100%;
  border-collapse: collapse; /* Removes spacing between table cells */
  font-size: 0.875rem;
  margin: 18px 0 36px;
}

/* Column header row */
.roadmap-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;                  /* Light grey — headers are secondary chrome */
  border-bottom: 2px solid #e5e7eb; /* Slightly heavier rule under header row */
  padding: 8px 10px;
  font-weight: 640;
}

/* Data cell */
.roadmap-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f1f3; /* Very faint row divider */
  vertical-align: middle;
  color: #374151;
}

/* Last row has no bottom border — the table border handles the edge */
.roadmap-table tr:last-child td {
  border-bottom: none;
}

/* Small coloured circle that appears before the milestone name.
   The circle itself has no text — it is a purely visual indicator. */
.roadmap-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;   /* Perfect circle */
  margin-right: 9px;
  vertical-align: middle;
  flex-shrink: 0;       /* Never compressed if the table cell gets narrow */
}

/* Dot colour variants — seven distinct status states */
.roadmap-dot.not-started   { background: var(--status-not-started-fg); }
.roadmap-dot.planned       { background: var(--status-planned-fg); }
.roadmap-dot.draft         { background: var(--status-draft-fg); }
.roadmap-dot.in-progress   { background: var(--status-in-progress-fg); }
.roadmap-dot.review        { background: var(--status-review-fg); }
.roadmap-dot.published     { background: var(--status-published-fg); }
.roadmap-dot.updating      { background: var(--status-updating-fg); }


/* ============================================================
   STATUS LEGEND (homepage Platform Status section)

   A small key/legend block that explains each text-labelled status,
   placed just above the roadmap table on the Statistics landing page.

   The current markup places .status-badge elements directly inside
   .status-legend; .status-legend-item remains compatible with older markup.
   ============================================================ */

.status-legend {
  display: flex;
  flex-wrap: wrap;     /* Items wrap to a second line on narrow screens */
  gap: 10px 24px;      /* Vertical gap 10px, horizontal gap 24px between items */
  margin: 14px 0 22px;
  padding: 14px 18px;
  background: #f8f9fb;
  border: 1px solid #e8eaee;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #374151;
}

/* One legend entry: coloured dot + label text side by side */
.status-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap; /* Prevents "Complete" label from wrapping after the dot */
}


/* ============================================================
   LEGACY SUMMARY-IMAGE COMPATIBILITY

   Retained for earlier embedded infographic markup. Current web summaries
   use structured tables and prose; downloadable summaries use registered
   PNG figures through the document pipeline.
   ============================================================ */

.summary-image {
  text-align: center;
  margin: 30px 0;
}

/* The image itself — capped width, rounded, with subtle shadow */
.summary-image img {
  max-width: 90%;        /* Never overflows on narrow screens */
  border-radius: 11px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.10); /* Soft shadow — lifts image off page */
}

/* Caption below the image — supports both <figcaption> and *italic* Markdown */
.summary-image figcaption,
.summary-image p em {
  display: block;
  margin-top: 10px;
  font-size: 0.83rem;
  color: #9ca3af;      /* Light grey — captions are secondary to the image */
  font-style: normal;  /* Overrides Markdown's default italic for <em> used as caption */
}


/* ============================================================
   DOWNLOAD / CTA BUTTONS

   Styled link buttons used on practice and support pages
   for worksheet downloads and other calls to action.

   Two variants:
     .dl-btn           → solid navy blue (primary action)
     .dl-btn.secondary → outline style (secondary action)

   Usage in .qmd:
     <a href="..." class="dl-btn">Download Worksheet</a>
     <a href="..." class="dl-btn secondary">View Solutions</a>
   ============================================================ */

/* Primary download button — solid navy blue */
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;             /* Gap between icon and text if an icon is added */
  padding: 9px 18px;
  background: #1d4e7a;
  color: #ffffff !important;        /* White text — always visible on navy */
  border-radius: 7px;
  text-decoration: none !important; /* No underline on button text */
  font-weight: 530;
  font-size: 0.875rem;
  margin: 5px 4px;      /* Small margin so adjacent buttons don't touch */
  transition: background 0.16s;
  border: 1.5px solid transparent; /* Invisible border — matches secondary button height */
}

/* Hover: slightly darker navy */
.dl-btn:hover {
  background: #163d60;
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Secondary button — outline style, transparent background */
.dl-btn.secondary {
  background: transparent;
  color: #1d4e7a !important;
  border-color: #1d4e7a; /* Navy border instead of fill */
}

/* Secondary hover: very light blue background fills in */
.dl-btn.secondary:hover {
  background: #eef3f9;
}


/* ============================================================
   LEGACY NUMBERED LEARNING PATH

   An ordered list component where each item gets an automatic
   counter badge (1, 2, 3...) via CSS counters.

   Retained for earlier numbered-list markup. The current Introduction
   overview uses .course-sequence and .course-start.

   The counter approach avoids hard-coding numbers in HTML,
   so adding or removing items automatically renumbers the list.

   Usage in .qmd (raw HTML required):
     <ol class="learning-path">
       <li>Start with Descriptive Statistics</li>
       <li>Then Probability</li>
     </ol>
   ============================================================ */

.learning-path {
  counter-reset: step-counter; /* Resets the CSS counter to 0 at the start of the list */
  list-style: none;            /* Removes default list bullets — we add our own circle */
  padding: 0;
  margin: 18px 0 32px;
}

/* Each list item — padded left to make room for the number circle */
.learning-path li {
  counter-increment: step-counter; /* Adds 1 to the counter for each item */
  position: relative;              /* Allows ::before pseudo-element to be positioned absolutely */
  padding: 12px 16px 12px 52px;   /* Left padding = circle width (24px) + gap */
  margin-bottom: 8px;
  background: #fafbfc;
  border: 1px solid #eaecef;
  border-radius: 8px;
  font-size: 0.91rem;
  color: #374151;
  line-height: 1.55;
}

/* The number circle — generated automatically, positioned on the left */
.learning-path li::before {
  content: counter(step-counter); /* Displays the current counter value (1, 2, 3...) */
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%); /* Vertically centres the circle relative to the row */
  width: 24px;
  height: 24px;
  background: #1d4e7a;
  color: white;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   LEGACY SECTION STATUS TABLE

   Retained for earlier section-status markup. The canonical Statistics
   landing pages now use .roadmap-table with text-labelled statuses.

   Structure:
     <table class="status-table">
       <thead><tr><th>Topic</th><th>Status</th>...</tr></thead>
       <tbody>
         <tr>
           <td><a href="...">1. Descriptive Statistics</a></td>
           <td><span class="status-badge active">Complete</span></td>
         </tr>
   ============================================================ */

.status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 16px 0 32px;
}

/* Header row */
.status-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  font-weight: 640;
  border-bottom: 2px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
}

/* Data cell */
.status-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f0f1f3;
  color: #374151;
  vertical-align: middle;
}

/* No divider on the last row */
.status-table tr:last-child td {
  border-bottom: none;
}

/* Topic link inside the table */
.status-table a {
  font-weight: 500;
  color: #1d5fa0;
}

.status-table a:hover {
  text-decoration: underline;
}


/* ============================================================
   ORAL PRACTICE PROMPT SPACING

   Reduces the bottom margin of callout blocks when they appear
   inside a tabset panel. This prevents excessive white space
   between consecutive oral prompts in the Exercises tab,
   where multiple .callout-note blocks are stacked in a row.
   ============================================================ */

/* Tighter spacing between stacked callouts inside tabset panels */
.panel-tabset .callout {
  margin-bottom: 1rem; /* Overrides the 1.6rem default from custom.scss */
}


/* ============================================================
   FIGURE SPACING (topic page tabs)

   Static ggplot2 output renders inside <figure class="figure">.
   Plotly interactive output renders inside <div class="js-plotly-plot">.
   Neither has built-in vertical breathing room, so they sit too
   close to the preceding paragraph text.

   These rules give both types equal top and bottom clearance,
   matching the visual rhythm of the surrounding prose.
   ============================================================ */

.panel-tabset figure.figure {
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}

.panel-tabset .js-plotly-plot {
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}


/* ============================================================
   DEFINITION LISTS (topic page tabs)

   Used to replace bold-colon label patterns ("**Label:** text")
   in scale-level sections and similar reference blocks.

   Pandoc definition list syntax in .qmd:
     Label
     :   Description text here.

   Renders as <dl><dt>Label</dt><dd>Description</dd></dl>.

   The dt (term) becomes a small uppercase coloured label.
   The dd (definition) sits below with no left indent.
   Scoped to .panel-tabset so it only applies inside topic pages.
   ============================================================ */

.panel-tabset dl {
  margin: 1rem 0 1.25rem;
}

.panel-tabset dl dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1d4e7a;
  margin-top: 1rem;
  margin-bottom: 0.2rem;
}

.panel-tabset dl dt:first-child {
  margin-top: 0;
}

.panel-tabset dl dd {
  margin-left: 0;
  color: #374151;
}


/* ============================================================
   FORMULA DISPLAY (topic page tabs)

   MathJax renders display-mode math ($$...$$) as an mjx-container
   element with display="true". By default it sits flush against
   surrounding text with no visual separation.

   This rule gives display formulas a subtle card treatment —
   light background, thin border, rounded corners — matching the
   visual rhythm of tables and figures on the same page.
   Overflow-x allows horizontal scrolling on narrow screens when
   a formula is wider than the content column.
   ============================================================ */

.panel-tabset mjx-container[display="true"] {
  display: block;
  background: #f8fafc;
  border: 1px solid #e0e6ee;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  margin: 1.5rem auto;
  overflow-x: auto;
}


/* ============================================================
   SECTION HEADINGS WITH BACKGROUND (topic page Theory/Summary tabs)

   Optional styled heading blocks used in Theory and Summary tabs
   to visually group major subsections with a coloured background.

   IMPORTANT — how Quarto applies classes to headings:
     When you write ### Heading {.cs-heading} in a .qmd file,
     Quarto wraps the heading AND its content in a <section>
     element and puts the class on the <section>, not the <h3>.
     That is why the selectors here target
       section.cs-heading > h3
     not just
       h3.cs-heading

   Two levels:
     .cs-heading    → ### level — major section (bold navy border)
     .cs-subheading → #### level — subsection within a section (lighter blue border)
   ============================================================ */

/* Major section heading — dark navy left border + light blue background */
section.cs-heading > h3 {
  background: #eef3f9;       /* Very light blue background block */
  padding: 0.5rem 1rem;
  border-radius: 5px;
  border-left: 4px solid #1d4e7a; /* Bold navy accent bar */
  border-bottom: none;            /* Removes the default h3 bottom border from custom.scss */
  margin-top: 1.5rem;
}

/* Subsection heading — lighter blue border, slightly smaller padding */
section.cs-subheading > h4 {
  background: #f4f7fb;       /* Lighter background than cs-heading */
  padding: 0.38rem 0.9rem;
  border-radius: 4px;
  border-left: 3px solid #7aa5c8; /* Lighter blue bar — visually secondary to cs-heading */
  border-bottom: none;
  margin-top: 1.3rem;
}


/* ============================================================
   PRINT

   Hides navigation chrome when the user prints a topic page.
   Leaves only the main content visible.

   The sidebar, navbar, search bar, and tab buttons are all
   removed from print output. Only the currently visible tab
   content is printed (Quarto/Bootstrap handles this).
   ============================================================ */

@media print {
  /* Hide all navigation and UI chrome */
  .sidebar,
  .navbar,
  .quarto-search,
  .toc-actions,
  .nav-footer,
  .panel-tabset .nav-tabs {
    display: none !important;
  }

  /* Allow content to use full page width when there's no sidebar */
  .quarto-content { max-width: 100%; }

  /* Standard print font sizes */
  body { font-size: 11pt; line-height: 1.6; }
  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; border-bottom: 1px solid #ccc; }
}


/* ============================================================
   RESPONSIVE (screens narrower than 768px — tablets and phones)

   Adjustments for small screens. The primary changes are:
     - Hero and section intro blocks lose their side padding
     - All grids collapse to a single column
     - Team member layout stacks vertically instead of side-by-side

   768px is Bootstrap's standard "medium" breakpoint. Below this
   width, two-column layouts generally become too cramped to read.
   ============================================================ */

@media (max-width: 768px) {

  /* Hero block — reduce padding on small screens */
  .cs-hero {
    padding: 26px 22px;
  }

  /* Hero title — reduce font size so it fits without wrapping too much */
  .cs-hero h1 {
    font-size: 1.65rem;
  }

  /* All grid layouts collapse to a single full-width column */
  .topic-grid,
  .platform-grid,
  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Section intro block — reduce padding on small screens */
  .section-intro {
    padding: 22px 20px;
  }

  /* Learning path list items — reduce left padding on small screens
     (the number circle is smaller so less padding is needed) */
  .learning-path li {
    padding-left: 48px;
  }

}

/* ============================================================
   RATIOMERA DESIGN SYSTEM  v2.3.0

   One shared token and component layer for organization pages,
   both branches, course material, translations, and downloads.
   ============================================================ */

:root {
  --color-canvas: #ffffff;
  --color-surface: #ffffff;
  --color-surface-soft: #f4f7f9;
  --color-surface-muted: #eef3f6;
  --color-ink: #132532;
  --color-text: #263746;
  --color-muted: #5a6976;
  --color-border: #d8e0e6;
  --color-border-strong: #b9c6cf;
  --color-link: #225f8c;
  --color-link-hover: #12344c;
  --color-focus: #0969da;

  --ratiomera-navy: #183b56;
  --ratiomera-navy-dark: #102c40;
  --statistics-blue: #2f6f9f;
  --statistics-blue-dark: #225778;
  --mathematics-copper: #b46124;
  --mathematics-copper-dark: #824314;

  --chart-blue: #2f6f9f;
  --chart-rust: #b7483b;
  --chart-copper: #b46124;
  --chart-green: #39745a;
  --chart-violet: #70558f;
  --chart-teal: #25796e;
  --chart-slate: #66737f;

  --status-not-started-bg: #e8edf1;
  --status-not-started-fg: #435564;
  --status-planned-bg: #f2edf9;
  --status-planned-fg: #5e3b7f;
  --status-draft-bg: #fff4cf;
  --status-draft-fg: #725400;
  --status-in-progress-bg: #fcebdc;
  --status-in-progress-fg: #824314;
  --status-review-bg: #dff2f5;
  --status-review-fg: #145a67;
  --status-published-bg: #e2f1e8;
  --status-published-fg: #1c623c;
  --status-updating-bg: #e3edf8;
  --status-updating-fg: #225778;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 5rem;
  --space-10: 6rem;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-pill: 999px;
  --shadow-subtle: 0 2px 10px rgba(16, 44, 64, 0.06);
  --shadow-elevated: 0 8px 26px rgba(16, 44, 64, 0.1);

  --layout-max: 80rem;
  --prose-measure: 72ch;
  --sidebar-width: 17.5rem;
  --header-offset: 6.75rem;
  --transition-fast: 150ms ease;

  /* Compatibility aliases for components that predate this layer. */
  --ratiomera-heading: var(--color-ink);
  --ratiomera-text: var(--color-text);
  --ratiomera-muted: var(--color-muted);
  --ratiomera-border: var(--color-border);
  --ratiomera-surface: var(--color-surface);
  --ratiomera-surface-soft: var(--color-surface-soft);
  --ratiomera-surface-muted: var(--color-surface-soft);
  --ratiomera-focus: var(--color-focus);
  --ratiomera-card-shadow: var(--shadow-subtle);
  --mathematics-orange: var(--mathematics-copper);
  --mathematics-orange-dark: var(--mathematics-copper-dark);
}

/* --- Global rhythm, typography, and reading width ---------- */

html {
  scroll-padding-top: var(--header-offset);
}

body {
  color: var(--color-text);
  background: var(--color-canvas);
  font-feature-settings: "kern" 1, "liga" 1;
  text-rendering: optimizeLegibility;
}

.quarto-content {
  width: min(100%, var(--layout-max));
  max-width: var(--layout-max);
}

#quarto-content .page-columns {
  gap: clamp(1rem, 2.4vw, 2.5rem);
}

#quarto-document-content > p,
#quarto-document-content > ul,
#quarto-document-content > ol,
#quarto-document-content > blockquote,
#quarto-document-content > section.level2 > p,
#quarto-document-content > section.level2 > ul,
#quarto-document-content > section.level2 > ol,
.landing-prose,
.contact-note,
.platform-cta > p,
.development-panel > p,
.panel-tabset .tab-pane > p,
.panel-tabset .tab-pane > ul,
.panel-tabset .tab-pane > ol {
  max-width: var(--prose-measure);
}

.course-guiding-quote {
  width: min(100%, var(--prose-measure));
  margin: var(--space-5) 0;
  padding: var(--space-4) var(--space-5);
  border-left: 4px solid var(--statistics-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-surface-soft);
}

.course-guiding-quote > blockquote {
  max-width: none;
  margin: 0;
  padding: 0;
  border-left: 0;
}

.course-guiding-quote > blockquote > p {
  margin: 0;
  color: var(--color-ink);
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.6;
}

p,
li,
dd {
  line-height: 1.68;
}

h1,
h2,
h3,
h4 {
  color: var(--color-ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 3.15rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-top: var(--space-7);
  padding-bottom: 0;
  border-bottom: 0;
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-top: var(--space-6);
  font-size: clamp(1.12rem, 1.6vw, 1.3rem);
}

.cs-heading,
.cs-subheading {
  padding: 0 !important;
  border-left: 0 !important;
  background: transparent !important;
}

hr {
  margin: var(--space-7) 0;
  border-color: var(--color-border);
  opacity: 0.8;
}

#quarto-document-content a:not(.nav-link):not(.sidebar-link):not(.dl-btn):not(.module-item):not(.branch-card):not(.text-link-arrow):not(.download-action):not(.download-title):not(.topic-resource-card):not(.topic-resource-format-action) {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}

#quarto-document-content a:hover {
  color: var(--color-link-hover);
}

:where(a, button, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

#quarto-document-content section[id],
#quarto-document-content h2[id],
#quarto-document-content h3[id],
#quarto-document-content .development-panel[id],
#quarto-document-content .download-module[id] {
  scroll-margin-top: var(--header-offset);
}

/* --- Header and logo system -------------------------------- */

.navbar {
  min-height: 4rem;
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 1px 8px rgba(16, 44, 64, 0.05);
}

.navbar-brand,
.navbar .nav-link {
  text-decoration: none !important;
}

.navbar-brand {
  gap: var(--space-2);
  color: var(--ratiomera-navy) !important;
  font-weight: 700;
}

.navbar-logo {
  width: 2rem;
  height: 2rem;
  max-height: 2rem;
  margin-right: var(--space-2);
  object-fit: contain;
}

.navbar-title {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.navbar .nav-link {
  border-radius: var(--radius-sm);
  color: #354958 !important;
  font-size: 0.86rem;
  font-weight: 550;
}

.navbar .nav-link:hover {
  color: var(--ratiomera-navy) !important;
  background: var(--color-surface-soft);
}

.navbar .nav-link.active {
  color: var(--ratiomera-navy) !important;
  font-weight: 680;
}

.navbar .nav-link.active::after {
  display: block;
  width: 100%;
  height: 2px;
  margin-top: 0.2rem;
  background: var(--statistics-blue);
  content: "";
}

.navbar-toggler {
  border-color: var(--color-border-strong);
}

/* --- Hero and landing-page primitives ---------------------- */

.section-intro {
  margin: 0 0 var(--space-7);
  padding: clamp(1.5rem, 4vw, 3.25rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
}

.section-intro h1 {
  max-width: 19ch;
  margin: 0 0 var(--space-4);
}

.section-intro > p {
  max-width: 68ch;
  margin-bottom: var(--space-4);
  color: #3d5060;
  font-size: clamp(1.02rem, 1.5vw, 1.15rem);
  line-height: 1.62;
}

.hero-tagline {
  width: fit-content;
  margin-top: var(--space-5);
  color: var(--ratiomera-navy);
  font-size: 0.84rem;
  font-weight: 680;
  letter-spacing: 0.025em;
}

.hero-actions {
  margin: var(--space-5) 0 0;
}

.section-intro.branch-hero {
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--statistics-blue);
  background: var(--color-surface-soft);
}

.section-intro.branch-hero-mathematics {
  border-left-color: var(--mathematics-copper);
}

.branch-status {
  display: inline-flex;
  width: fit-content;
  margin-bottom: var(--space-3);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--statistics-blue-dark);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  line-height: 1.2;
  text-transform: uppercase;
}

.branch-status-mathematics {
  color: var(--mathematics-copper-dark);
}

.branch-cards,
.branch-cards > p {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  max-width: 72rem;
  margin: var(--space-5) 0 var(--space-7);
}

.branch-cards > p {
  display: contents;
}

.branch-card {
  display: flex;
  min-width: 0;
  min-height: 23rem;
  flex-direction: column;
  gap: var(--space-3);
  padding: clamp(1.35rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--statistics-blue);
  border-radius: var(--radius-lg);
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  box-shadow: var(--shadow-subtle);
  text-decoration: none !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.branch-card-mathematics {
  border-top-color: var(--mathematics-copper);
}

.branch-card:hover,
.branch-card:focus-visible {
  border-color: var(--color-border-strong);
  border-top-color: var(--statistics-blue);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-2px);
}

.branch-card-mathematics:hover,
.branch-card-mathematics:focus-visible {
  border-top-color: var(--mathematics-copper);
}

.branch-card-logo {
  display: block !important;
  width: 2.8rem !important;
  height: 2.8rem !important;
  margin: 0 0 var(--space-2) !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  object-fit: contain;
}

.branch-card-name {
  color: var(--color-ink) !important;
  font-size: 1.3rem;
  font-weight: 720;
}

.branch-card-description,
.branch-card-support,
.branch-card .branch-card-tagline {
  display: block;
  margin: 0;
  color: var(--color-text) !important;
}

.branch-card-description {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.branch-card-support {
  font-size: 0.87rem;
  line-height: 1.62;
}

.branch-card .topic-chip {
  width: fit-content;
  margin-top: var(--space-1);
}

.branch-card-cta {
  margin-top: auto;
  color: var(--color-link) !important;
  font-size: 0.88rem;
  font-weight: 680;
}

.open-access-list > ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--space-3);
  max-width: 66rem;
  margin: var(--space-5) 0 var(--space-7);
  padding: 0;
  list-style: none;
}

.open-access-list li {
  position: relative;
  min-width: 0;
  padding: 0.75rem 0.9rem 0.75rem 2.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 620;
}

.open-access-list li::before {
  position: absolute;
  left: 0.9rem;
  color: var(--status-published-fg);
  font-weight: 800;
  content: "\2713";
}

.platform-cta,
.development-panel,
.downloads-help {
  margin: var(--space-7) 0 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--ratiomera-navy);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
}

.development-panel-mathematics {
  border-left-color: var(--mathematics-copper);
}

.platform-cta h2,
.platform-cta h3,
.development-panel h2,
.development-panel h3,
.downloads-help h2 {
  margin-top: 0;
}

/* --- Buttons, modules, and navigation ---------------------- */

.btn-row,
.btn-row > p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.btn-row {
  margin: var(--space-5) 0 var(--space-7);
}

.btn-row > p {
  margin: 0;
}

.dl-btn {
  display: inline-flex;
  min-height: 2.7rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.7rem 1.05rem;
  border: 1px solid var(--ratiomera-navy);
  border-radius: var(--radius-md);
  background: var(--ratiomera-navy);
  color: #ffffff !important;
  font-size: 0.88rem;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.dl-btn:hover {
  border-color: var(--ratiomera-navy-dark);
  background: var(--ratiomera-navy-dark);
  transform: translateY(-1px);
}

.dl-btn.secondary {
  background: transparent;
  color: var(--ratiomera-navy) !important;
}

.dl-btn.secondary:hover {
  background: var(--color-surface-muted);
}

.dl-btn.mathematics {
  border-color: var(--mathematics-copper-dark);
  background: var(--mathematics-copper-dark);
}

.dl-btn.secondary.mathematics {
  background: transparent;
  color: var(--mathematics-copper-dark) !important;
}

.text-link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-link);
  font-size: 0.87rem;
  font-weight: 660;
  text-decoration: none !important;
}

.text-link-arrow::after {
  content: "\2192";
}

.text-link-arrow.previous::before {
  content: "\2190";
}

.text-link-arrow.previous::after {
  content: none;
}

/* The Introduction overview keeps the normal topic-page content column.
   The sequence must never use a negative-margin breakout: on sidebar pages,
   that can place the left cards beneath Quarto's fixed sidebar and obscure
   the odd-numbered markers. */
.course-sequence-wide {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
}

.course-sequence {
  counter-reset: course-step;
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: var(--space-4);
  max-width: none;
  margin: var(--space-5) 0 var(--space-7);
  padding: 0;
  list-style: none;
}

.course-sequence li {
  counter-increment: course-step;
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 2rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-content: start;
  padding: 1.2rem 1.25rem;
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
  box-shadow: var(--shadow-subtle);
}

.course-sequence li::before {
  display: grid;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  box-sizing: border-box;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  min-height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--statistics-blue-dark);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1;
  content: counter(course-step);
}

.course-sequence p {
  grid-column: 2;
  margin: 0;
}

.course-sequence .course-sequence-title {
  margin-bottom: var(--space-2);
  color: var(--color-ink);
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.35;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.course-sequence .course-sequence-title a {
  color: var(--ratiomera-navy) !important;
  text-decoration-thickness: 0.07em !important;
  text-underline-offset: 0.16em !important;
}

.course-sequence li > p:last-child {
  color: var(--color-text);
  font-size: 0.88rem;
  line-height: 1.62;
}

.course-start {
  display: flex;
  max-width: 72rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin: 0 0 var(--space-7);
  padding: 1.25rem 1.4rem;
  border: 1px solid #bfd0dc;
  border-left: 4px solid var(--statistics-blue);
  border-radius: var(--radius-lg);
  background: #eef5fa;
}

.course-start-copy p {
  margin: 0;
}

.course-start-copy > p:last-child {
  max-width: 48rem;
  color: #354958;
  font-size: 0.9rem;
}

.course-start-eyebrow {
  display: block;
  margin-bottom: 0.2rem !important;
  color: var(--statistics-blue-dark);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.course-start-link {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1.1rem;
  border: 1px solid var(--ratiomera-navy);
  border-radius: var(--radius-md);
  background: var(--ratiomera-navy);
  color: #ffffff !important;
  font-size: 0.86rem;
  font-weight: 690;
  line-height: 1.25;
  text-align: center;
  text-decoration: none !important;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.course-start-link::after {
  margin-left: var(--space-2);
  content: "\2192";
}

.course-start-link:hover {
  border-color: var(--ratiomera-navy-dark);
  background: var(--ratiomera-navy-dark);
  color: #ffffff !important;
  transform: translateY(-1px);
}

@media (max-width: 1279.98px) {
  .course-sequence {
    grid-template-columns: minmax(0, 1fr);
  }

  .course-start {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-4);
  }

  .course-start-link {
    align-self: flex-start;
  }
}

.module-list {
  border-color: var(--color-border);
  border-radius: var(--radius-lg);
}

.module-item {
  min-width: 0;
  padding: 1rem 1.2rem;
  border-left: 3px solid transparent;
}

a.module-item:hover {
  border-left-color: var(--statistics-blue);
  background: var(--color-surface-soft);
}

.module-item-planned {
  cursor: default;
  background: #fafbfc;
}

.module-item-planned .module-title,
.module-item-planned .module-desc {
  color: var(--color-muted);
}

.lesson-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-7) 0 0;
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

/* Pandoc groups consecutive Markdown links in one paragraph. Make that
   generated paragraph the three-column navigation layout so the overview,
   downloads, and next-topic actions occupy distinct positions. */
.lesson-navigation > p {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: var(--space-4);
  margin: 0;
}

.lesson-navigation > p > :first-child {
  justify-self: start;
}

.lesson-navigation > p > :nth-child(2) {
  justify-self: center;
  text-align: center;
}

.lesson-navigation > p > :last-child {
  justify-self: end;
  text-align: right;
}

.planned-topic {
  border-left: 4px solid var(--color-border-strong);
}

.planned-topic .status-badge {
  margin-bottom: var(--space-3);
}

/* --- Sidebars and long lesson content ---------------------- */

.sidebar-navigation {
  padding-top: var(--space-2);
}

.sidebar-title {
  color: var(--ratiomera-navy);
  font-size: 0.72rem;
  font-weight: 740;
  letter-spacing: 0.065em;
}

.sidebar-navigation .sidebar-item-text {
  font-size: 0.84rem;
  line-height: 1.42;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
  text-wrap: pretty;
}

.sidebar-navigation a {
  align-items: flex-start;
  border-radius: var(--radius-sm);
}

.sidebar-navigation a:hover {
  background: var(--color-surface-muted);
}

.sidebar-navigation .active > .sidebar-item-container > a {
  color: var(--statistics-blue-dark);
  font-weight: 680;
}

.panel-tabset {
  margin-top: var(--space-4);
}

.panel-tabset .nav-tabs {
  gap: var(--space-1);
  border-bottom-color: var(--color-border);
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.panel-tabset .nav-tabs .nav-link {
  flex: 0 0 auto;
  min-height: 2.75rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--color-muted);
  font-size: 0.86rem;
  font-weight: 620;
  text-decoration: none !important;
}

.panel-tabset .nav-tabs .nav-link.active {
  color: var(--ratiomera-navy);
}

.panel-tabset .tab-content {
  padding-top: var(--space-3);
}

.panel-tabset,
.panel-tabset .tab-content,
.panel-tabset .tab-pane,
.panel-tabset section {
  min-width: 0;
  max-width: 100%;
}

/* The companion include wraps static lesson tables in this named,
   keyboard-focusable region. The table keeps its natural column width while
   the wrapper owns horizontal scrolling on narrow screens. */
.table-scroll-region {
  max-width: 100%;
  margin: var(--space-4) 0;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

.table-scroll-shell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: var(--space-4) 0;
}

.table-scroll-shell > .table-scroll-region,
.table-scroll-shell > .dataTables_wrapper {
  margin-block: 0;
}

.table-caption-source {
  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;
}

.table-caption-visible {
  width: 100%;
  margin: var(--space-2) 0 0;
}

.table-caption-number {
  font-weight: 700;
}

/* Topic figures with several panels or text-bearing annotations keep a
   readable intrinsic width on small screens. The named, focusable wrapper
   owns horizontal scrolling, so the page itself never overflows and keyboard
   users can reach the same content as touch users. */
.topic-figure-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: var(--space-5) 0;
  border-radius: var(--radius-sm);
}

.topic-figure-scroll:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.horizontal-scroll-hint {
  position: sticky;
  left: 0;
  z-index: 4;
  width: fit-content;
  max-width: calc(100% - 0.5rem);
  margin: 0.25rem 0.25rem 0.5rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #d7e0e8;
  border-radius: var(--radius-sm);
  background: #f7f9fb;
  color: var(--color-muted);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
}

.horizontal-scroll-hint[hidden] {
  display: none;
}

.topic-figure-scroll.has-horizontal-overflow,
.table-scroll-region.has-horizontal-overflow,
.dataTables_wrapper.has-horizontal-overflow {
  scrollbar-color: #7896b0 #edf2f6;
  scrollbar-width: thin;
}

.topic-figure-scroll.has-horizontal-overflow::-webkit-scrollbar,
.table-scroll-region.has-horizontal-overflow::-webkit-scrollbar,
.dataTables_wrapper.has-horizontal-overflow::-webkit-scrollbar {
  height: 0.65rem;
}

.topic-figure-scroll.has-horizontal-overflow::-webkit-scrollbar-track,
.table-scroll-region.has-horizontal-overflow::-webkit-scrollbar-track,
.dataTables_wrapper.has-horizontal-overflow::-webkit-scrollbar-track {
  background: #edf2f6;
  border-radius: 999px;
}

.topic-figure-scroll.has-horizontal-overflow::-webkit-scrollbar-thumb,
.table-scroll-region.has-horizontal-overflow::-webkit-scrollbar-thumb,
.dataTables_wrapper.has-horizontal-overflow::-webkit-scrollbar-thumb {
  border: 2px solid #edf2f6;
  border-radius: 999px;
  background: #7896b0;
}

.dataTables_wrapper[tabindex="0"]:focus-visible,
.table-scroll-region:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.panel-tabset .dataTables_wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.panel-tabset .dataTables_wrapper > table.dataTable {
  width: max-content !important;
  min-width: 100%;
}

.panel-tabset .dataTables_wrapper > table.dataTable th,
.panel-tabset .dataTables_wrapper > table.dataTable td {
  white-space: nowrap;
}

.table-scroll-region > table.table {
  display: table;
  width: max-content;
  min-width: 100%;
  max-width: none;
  margin: 0;
  overflow: visible;
}

/* CSS-only fallback if scripts are unavailable. */
.panel-tabset table.table {
  max-width: 100%;
}

.panel-tabset figure.figure,
.panel-tabset .js-plotly-plot {
  width: 100%;
  max-width: 58rem;
  margin: var(--space-6) auto;
}

.panel-tabset .html-widget,
.panel-tabset .plotly,
.panel-tabset .js-plotly-plot {
  min-width: 0;
  max-width: 100% !important;
}

figcaption,
.figure-caption,
.table-caption,
caption {
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.panel-tabset mjx-container[display="true"] {
  max-width: 100%;
  padding-block: var(--space-2);
  overflow-x: auto;
  overflow-y: hidden;
}

.panel-tabset mjx-container:not([display="true"]) {
  max-width: 100%;
}

/* Quarto callouts share one restrained educational-block grammar. */
.callout {
  margin: var(--space-5) 0;
  border: 1px solid var(--color-border) !important;
  border-left: 4px solid var(--statistics-blue) !important;
  border-radius: var(--radius-md) !important;
  background: var(--color-surface-soft) !important;
  box-shadow: none !important;
}

.callout.callout-warning,
.callout.callout-important {
  border-left-color: var(--mathematics-copper) !important;
}

.callout.callout-note {
  border-left-color: var(--chart-teal) !important;
}

.callout .callout-header {
  background: transparent !important;
  font-size: 0.82rem;
  font-weight: 700;
}

.callout .callout-body {
  padding-top: var(--space-2);
}

.callout .callout-body > :last-child {
  margin-bottom: 0;
}

/* --- Status system and tables ------------------------------ */

.status-badge,
.module-status,
.topic-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.67rem;
  font-weight: 740;
  letter-spacing: 0.035em;
  line-height: 1.25;
  text-transform: uppercase;
}

.status-badge.not-started,
.module-status.not-started { background: var(--status-not-started-bg); color: var(--status-not-started-fg); }
.status-badge.planned,
.module-status.planned { background: var(--status-planned-bg); color: var(--status-planned-fg); }
.status-badge.draft,
.module-status.draft { background: var(--status-draft-bg); color: var(--status-draft-fg); }
.status-badge.in-progress,
.module-status.in-progress,
.topic-chip.current { background: var(--status-in-progress-bg); color: var(--status-in-progress-fg); }
.status-badge.review,
.module-status.review,
.topic-chip.review { background: var(--status-review-bg); color: var(--status-review-fg); }
.status-badge.published,
.module-status.published,
.topic-chip.complete { background: var(--status-published-bg); color: var(--status-published-fg); }
.status-badge.updating,
.module-status.updating { background: var(--status-updating-bg); color: var(--status-updating-fg); }
.topic-chip.soon { background: var(--status-planned-bg); color: var(--status-planned-fg); }

.status-legend,
.status-legend > p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.status-legend {
  width: fit-content;
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.status-legend > p {
  margin: 0;
}

.table-scroll,
.download-table-wrap,
.table-responsive {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  -webkit-overflow-scrolling: touch;
}

.table-scroll:focus-visible {
  outline-offset: 2px;
}

.roadmap-table,
.download-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.roadmap-table th,
.roadmap-table td,
.download-table th,
.download-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e9eef1;
  vertical-align: top;
}

.roadmap-table thead th,
.download-table thead th {
  background: var(--color-surface-soft);
  color: #425563;
  font-size: 0.71rem;
  font-weight: 720;
  letter-spacing: 0.035em;
  text-align: left;
  text-transform: uppercase;
}

.roadmap-table tbody th {
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 520;
  text-align: left;
  text-transform: none;
}

.roadmap-table tbody td:last-child {
  width: 1%;
  white-space: nowrap;
}

.roadmap-table .roadmap-module th,
.roadmap-table .roadmap-module td {
  background: var(--color-surface-soft);
  color: var(--color-ink);
  font-weight: 680;
}

.roadmap-topic-number {
  display: inline-flex;
  width: 1.4rem;
  height: 1.4rem;
  align-items: center;
  justify-content: center;
  margin-right: var(--space-2);
  border-radius: 50%;
  background: var(--color-surface-muted);
  color: var(--ratiomera-navy);
  font-size: 0.68rem;
  font-weight: 720;
}

/* --- Metadata-driven Downloads ----------------------------- */

.downloads-lead {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(17rem, 0.85fr);
  gap: var(--space-6);
  margin: var(--space-6) 0 var(--space-8);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--statistics-blue);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
}

.downloads-lead-copy h2,
.downloads-material-key h3 {
  margin-top: 0;
}

.downloads-lead-copy h2 {
  margin-bottom: var(--space-4);
}

.downloads-lead-copy p:last-child,
.downloads-material-key p:last-child,
.downloads-lead-note p:last-child {
  margin-bottom: 0;
}

.downloads-material-key {
  align-self: start;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.downloads-material-key h3 {
  margin-bottom: var(--space-4);
  font-size: 1rem;
}

.downloads-material-key p {
  margin: 0;
  padding: var(--space-3) 0;
  border-top: 1px solid #e8edf1;
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.downloads-material-key h3 + p {
  padding-top: 0;
  border-top: 0;
}

.downloads-material-key strong {
  color: var(--color-ink);
}

.downloads-lead-note {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.downloads-lead-note p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.downloads-lead-note strong {
  color: var(--color-ink);
}

.download-summary,
.download-summary > p {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.download-summary {
  margin-top: var(--space-5);
}

.download-summary > p {
  display: contents;
}

.download-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.78rem;
}

.download-summary strong {
  color: var(--ratiomera-navy);
  font-size: 1rem;
}

.download-course {
  width: 100%;
  max-width: none;
  margin: var(--space-8) 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.download-course-heading {
  max-width: var(--prose-measure);
  margin-bottom: var(--space-6);
}

.download-course-heading h2,
.download-course-heading p {
  margin-top: 0;
}

.download-course-heading h2 {
  margin-bottom: var(--space-2);
}

.download-course-heading > p:last-child {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.download-course-label {
  margin-bottom: var(--space-2);
  color: var(--statistics-blue-dark);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.download-module {
  margin: var(--space-7) 0;
}

.download-course .download-module:last-child {
  margin-bottom: 0;
}

.download-module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.download-module-heading h2,
.download-module-heading h3 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}

.download-module-heading h3 {
  font-size: clamp(1.08rem, 1.6vw, 1.3rem);
}

.download-module-number {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-surface-muted);
  color: var(--statistics-blue-dark);
  font-size: 0.78rem;
  font-weight: 750;
}

.download-table-wrap {
  margin-bottom: 0;
}

.download-table {
  min-width: 0;
  table-layout: fixed;
}

.download-table tbody th {
  color: var(--color-ink);
  font-size: 0.86rem;
  font-weight: 650;
  text-align: left;
}

.download-course-table tbody th {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--color-ink);
  font-size: 0.86rem;
  font-weight: 650;
  text-align: left;
}

.download-table td {
  color: var(--color-text);
  font-size: 0.8rem;
}

/* On compact layouts the semantic table becomes a set of topic cards. A
   desktop override below restores the true table so eight topics remain easy
   to scan without producing a very long wall of repeated cards. */
.download-course .download-table-wrap {
  overflow: visible;
  border: 0;
  background: transparent;
}

.download-course-table,
.download-course-table tbody,
.download-course-table tr,
.download-course-table th,
.download-course-table td {
  display: block;
  width: 100%;
}

.download-course-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.download-course-table tbody {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--space-5);
}

.download-course-table tr {
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-subtle);
}

.download-course-table tbody th {
  min-height: 4.5rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
  background: #f3f7fa;
}

.download-course-table tbody td {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 0;
  border-bottom: 1px solid #e8edf1;
}

.download-course-table tbody td:last-child {
  border-bottom: 0;
}

.download-course-table tbody td::before {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--color-ink);
  font-size: 0.76rem;
  font-weight: 720;
  letter-spacing: 0.025em;
  content: attr(data-label);
}

.download-topic-title {
  min-width: 0;
  line-height: 1.45;
}

.download-title {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.download-note {
  display: block;
  margin-top: 0.35rem;
  color: var(--color-muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.45;
}

.file-format,
.file-size,
.file-version {
  display: block;
}

.file-format {
  font-weight: 700;
}

.file-size,
.file-version {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.download-action {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--statistics-blue);
  border-radius: var(--radius-md);
  color: var(--statistics-blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none !important;
}

.download-action:hover {
  background: var(--color-surface-muted);
}

.download-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.download-course-table .download-action-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.download-material-count {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: var(--space-3);
  color: var(--color-muted);
}

.download-primary-package {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(15rem, 0.65fr);
  align-items: center;
  gap: var(--space-6);
  margin: var(--space-7) 0 var(--space-8);
  padding: clamp(1.15rem, 2.4vw, 1.8rem);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--statistics-blue);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
}

.download-primary-package-copy h3,
.download-primary-package-copy p {
  margin-top: 0;
}

.download-primary-package-copy h3 {
  margin-bottom: var(--space-3);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.download-primary-package-copy > p:last-child {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.download-primary-package > .download-bundle-card {
  min-height: 0;
  justify-content: center;
  padding: var(--space-4);
  border-left-width: 1px;
  background: var(--color-surface);
  box-shadow: none;
}

.download-primary-package > .download-bundle-card .download-bundle-copy {
  display: none;
}

.download-primary-package > .download-bundle-card .download-action-group {
  width: 100%;
}

.download-primary-package > .download-bundle-card .download-action {
  width: 100%;
}

.download-topic-packages {
  margin: var(--space-8) 0;
}

.download-topic-packages-heading {
  max-width: var(--prose-measure);
  margin-bottom: var(--space-5);
}

.download-topic-packages-heading h3,
.download-topic-packages-heading p {
  margin-top: 0;
}

.download-topic-packages-heading h3 {
  margin-bottom: var(--space-2);
}

.download-topic-packages-heading > p:last-child {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.download-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-5);
}

.download-topic-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-subtle);
}

.download-topic-card-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.download-topic-card-heading h4 {
  min-width: 0;
  margin: 0;
  color: var(--color-ink);
  font-size: 1rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.download-topic-package-description {
  margin: 0 0 var(--space-4);
  color: var(--color-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.download-topic-card > .download-action-group {
  width: 100%;
}

.download-topic-card > .download-action-group .download-action {
  width: 100%;
}

.download-package-count {
  min-height: 1.25rem;
}

.download-topic-files {
  width: 100%;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.download-topic-files summary,
.download-secondary-bundles > summary {
  width: fit-content;
  max-width: 100%;
  color: var(--statistics-blue-dark);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
  cursor: pointer;
}

.download-topic-files summary:focus-visible,
.download-secondary-bundles > summary:focus-visible {
  border-radius: var(--radius-sm);
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.download-topic-file-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.download-material-option {
  min-width: 0;
  padding-top: var(--space-3);
  border-top: 1px solid #e8edf1;
}

.download-material-option:first-child {
  padding-top: 0;
  border-top: 0;
}

.download-material-option h4 {
  margin: 0 0 var(--space-2);
  color: var(--color-ink);
  font-size: 0.8rem;
  line-height: 1.4;
}

.download-material-option .download-action {
  flex: 1 1 8rem;
}

.download-secondary-bundles {
  margin-top: var(--space-8);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-soft);
}

.download-secondary-bundles > p {
  max-width: var(--prose-measure);
  margin: var(--space-3) 0 var(--space-5);
  color: var(--color-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.download-bundles {
  margin-top: var(--space-8);
  padding-top: var(--space-7);
  border-top: 1px solid var(--color-border);
}

.download-bundles-heading {
  max-width: 48rem;
  margin: 0 auto var(--space-5);
  text-align: center;
}

.download-bundles-heading h3,
.download-bundles-heading p {
  margin-top: 0;
}

.download-bundles-heading h3 {
  margin-bottom: var(--space-2);
}

.download-bundles-heading > p:last-child {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.download-bundle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--space-4);
}

.download-bundle-card {
  display: flex;
  min-width: 0;
  min-height: 12rem;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--statistics-blue);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-subtle);
}

.download-bundle-copy h4 {
  margin: 0 0 var(--space-2);
  color: var(--color-ink);
  font-size: 1rem;
}

.download-bundle-copy p {
  margin: 0 0 var(--space-4);
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.download-bundle-card .download-action-group {
  margin-top: auto;
}

.download-bundle-count {
  margin-top: var(--space-3);
}

.downloads-overview-cta {
  max-width: 48rem;
  margin: var(--space-9) auto 0;
  padding: var(--space-7) var(--space-5) 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.downloads-overview-cta h2,
.downloads-overview-cta p {
  margin-top: 0;
}

.downloads-overview-cta p {
  color: var(--color-muted);
}

.downloads-overview-link {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-2);
  padding: 0.6rem 1rem;
  border: 1px solid var(--statistics-blue);
  border-radius: var(--radius-md);
  color: var(--statistics-blue-dark) !important;
  font-size: 0.84rem;
  font-weight: 720;
  text-decoration: none !important;
}

.downloads-overview-link::after {
  margin-left: var(--space-2);
  content: "\2192";
}

.downloads-overview-link:hover {
  background: var(--color-surface-muted);
}

.downloads-overview-link:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.download-count-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}

@media (min-width: 1280px) {
  .download-course .download-table-wrap {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-subtle);
  }

  .download-course-table {
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
  }

  .download-course-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .download-course-table tbody {
    display: table-row-group;
  }

  .download-course-table tr {
    display: table-row;
    width: auto;
    height: auto;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: var(--color-surface);
    box-shadow: none;
  }

  .download-course-table th,
  .download-course-table td {
    display: table-cell;
    width: auto;
    padding: 0.9rem;
    border: 0;
    border-right: 1px solid #e8edf1;
    border-bottom: 1px solid #e8edf1;
    vertical-align: top;
  }

  .download-course-table thead th {
    background: #edf3f7;
    color: var(--color-ink);
    font-size: 0.74rem;
    font-weight: 740;
    line-height: 1.35;
    text-align: left;
  }

  .download-course-table thead th:first-child,
  .download-course-table tbody th {
    width: 43%;
  }

  .download-course-table thead th:not(:first-child),
  .download-course-table tbody td {
    width: 19%;
  }

  .download-course-table tr > :last-child {
    border-right: 0;
  }

  .download-course-table tbody tr:last-child > * {
    border-bottom: 0;
  }

  .download-course-table tbody th {
    display: table-cell;
    min-height: 0;
    padding: 1rem 0.9rem;
    background: #f7f9fb;
    vertical-align: top;
    white-space: nowrap;
  }

  .download-course-table tbody td {
    margin: 0;
    padding: 1rem 0.9rem;
  }

  .download-course-table tbody td:last-child {
    border-bottom: 1px solid #e8edf1;
  }

  .download-course-table tbody tr:last-child > * {
    border-bottom: 0;
  }

  .download-course-table tbody td::before {
    display: none;
    content: none;
  }

  .download-course-table .download-action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .download-course-table .download-action {
    min-width: 0;
    padding-inline: 0.45rem;
    white-space: nowrap;
    text-align: center;
  }
}

/* Topic pages reuse the canonical Downloads registry for their two practice
   files. The entire card is one generous link target, while the title and
   action remain independently understandable in every locale. */
.topic-download-resources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  max-width: 52rem;
  margin: var(--space-5) 0;
}

.topic-summary-resources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  max-width: 52rem;
  margin: var(--space-5) 0;
}

.topic-resource-card {
  display: flex;
  min-width: 0;
  min-height: 7.25rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--statistics-blue);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-subtle);
  text-decoration: none !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.topic-resource-card-grouped {
  min-height: 11.5rem;
  justify-content: flex-start;
}

.topic-resource-card-grouped:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-subtle);
  transform: none;
}

.topic-resource-copy h4 {
  margin: 0 0 var(--space-2);
}

.topic-resource-copy p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.topic-resource-format-actions {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
}

.topic-resource-format-action {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.65rem;
  border: 1px solid var(--statistics-blue);
  border-radius: var(--radius-md);
  color: var(--statistics-blue-dark) !important;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none !important;
}

.topic-resource-format-action:hover {
  background: var(--color-surface-muted);
}

.topic-resource-format-action:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.topic-resource-count {
  width: 100%;
  margin-top: var(--space-3);
}

.topic-resource-card:hover {
  border-color: var(--statistics-blue);
  color: var(--color-text);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

.topic-resource-card:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.topic-resource-title {
  color: var(--color-ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

.topic-resource-action {
  color: var(--statistics-blue-dark);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
}

.topic-resources-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  font-size: 0.86rem;
}

.download-count-cell {
  font-variant-numeric: tabular-nums;
}

.usage-counter {
  display: inline-flex;
  align-items: center;
  color: #4d5f6c;
  font-size: 0.71rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.counter-fallback {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32rem;
}

.counter-label {
  font-weight: 590;
}

.counter-label::after {
  content: ":";
}

.counter-value {
  min-width: 1ch;
  color: #4d5f6c;
  font-weight: 650;
  text-align: right;
}

.download-empty {
  padding: var(--space-4) var(--space-5);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: #fafbfc;
}

.download-empty p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.86rem;
}

/* --- Language selector and solution blocks ---------------- */

.language-switcher {
  display: flex;
  width: fit-content;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0 0 var(--space-5);
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
}

.language-switcher a {
  min-height: 2.2rem;
  padding: 0.48rem 0.8rem;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none !important;
}

.language-switcher a:hover {
  color: var(--ratiomera-navy);
  background: var(--color-surface);
}

.language-switcher a.active,
.language-switcher a[aria-current="page"] {
  background: var(--ratiomera-navy);
  color: #ffffff !important;
}

.solution-list {
  display: grid;
  gap: var(--space-3);
  max-width: 54rem;
  margin: var(--space-5) 0;
}

.solution-block {
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--chart-green);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.solution-block summary {
  padding: 0.85rem 1rem;
  color: var(--color-ink);
  font-size: 0.88rem;
  font-weight: 680;
  cursor: pointer;
}

.solution-block[open] summary {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.solution-body {
  padding: 0.9rem 1rem 1rem;
}

.solution-body > :last-child {
  margin-bottom: 0;
}

/* --- Contact, team, and support ----------------------------- */

.contact-grid,
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0 var(--space-7);
}

.contact-card,
.support-card {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-subtle);
}

.contact-card h3,
.support-card h3 {
  margin-top: 0;
}

.contact-address {
  display: block;
  margin-top: var(--space-2);
  color: var(--ratiomera-navy);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 620;
  overflow-wrap: anywhere;
}

.contact-label,
.placeholder-label {
  display: inline-flex;
  width: fit-content;
  padding: 0.2rem 0.48rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  font-size: 0.63rem;
  font-weight: 720;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.contact-note {
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--statistics-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--color-surface-soft);
  color: var(--color-muted);
}

.team-section,
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0 var(--space-7);
}

.team-member,
.team-card {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-content: start;
  padding: 1.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-subtle);
}

.team-bio {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.team-name {
  color: var(--color-ink);
  font-size: 1.03rem;
  font-weight: 720;
}

.team-role {
  color: var(--statistics-blue-dark);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.4;
}

.team-tags,
.branch-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: var(--space-2) 0;
  padding: 0;
}

.team-experience {
  margin-bottom: var(--space-2);
  color: var(--color-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.team-text {
  margin: 0;
  color: var(--color-text);
  font-size: 0.84rem;
  line-height: 1.58;
}

.team-tag,
.branch-tag {
  display: inline-flex;
  width: fit-content;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.team-tag.statistics,
.branch-tag.statistics {
  border-color: #bcd1e0;
  background: #e7f0f6;
  color: var(--statistics-blue-dark);
}

.team-tag.mathematics,
.branch-tag.mathematics {
  border-color: #e2c4a8;
  background: #faf0e7;
  color: var(--mathematics-copper-dark);
}

.team-tag.ratiomera,
.branch-tag.ratiomera {
  border-color: #c4d0d9;
  background: #eaf0f4;
  color: var(--ratiomera-navy);
}

/* --- Footer ------------------------------------------------ */

.nav-footer {
  margin-top: var(--space-9);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-soft);
}

.nav-footer,
.nav-footer a {
  color: #4d5f6c;
  font-size: 0.78rem;
}

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

.nav-footer-right .footer-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.8rem;
  margin: 0;
}

.nav-footer-right .footer-visit-item {
  display: flex;
  align-items: center;
}

.page-visit-counter {
  opacity: 1;
}

.footer-language-selector {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.25rem;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 680;
  letter-spacing: 0.04em;
}

.footer-language-selector a,
.footer-language-selector .active {
  display: inline-flex;
  min-width: 2rem;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
}

.footer-language-selector a:hover {
  background: #e7eef3;
  color: var(--ratiomera-navy);
}

.footer-language-selector .active {
  color: var(--ratiomera-navy);
  font-weight: 780;
  box-shadow: inset 0 -2px 0 var(--statistics-blue);
}

.footer-language-selector .separator {
  color: var(--color-border-strong);
  font-weight: 500;
}

/* --- Responsive behavior ---------------------------------- */

@media (max-width: 1024px) {
  :root {
    --header-offset: 6rem;
  }

  .navbar .nav-link {
    font-size: 0.82rem;
  }

  .branch-card {
    min-height: 0;
  }

}

/* Quarto is configured to collapse the header below 1200px so the longest
   localized and branch-specific navigation stays clear on compact laptops. */
@media (max-width: 1199.98px) {
  .navbar-collapse {
    margin-top: var(--space-2);
    padding: var(--space-2) 0 var(--space-3);
    border-top: 1px solid var(--color-border);
  }

  .navbar .nav-link {
    min-height: 2.65rem;
    display: flex;
    align-items: center;
    padding-inline: var(--space-3);
  }

  .navbar .nav-link.active::after {
    display: none;
  }

  /* At compact-laptop widths the two Quarto sidebars leave a narrower
     reading column than the viewport suggests. Multi-panel figures keep
     their instructional width here and scroll inside their named,
     keyboard-focusable region instead of compressing labels together. */
  .topic-figure-scroll-wide,
  .topic-figure-scroll-extra-wide {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 0 var(--space-2);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .topic-figure-scroll-wide > .cell {
    width: 54rem;
    min-width: 54rem;
  }

  .topic-figure-scroll-extra-wide > .cell {
    width: 62rem;
    min-width: 62rem;
  }

  .topic-figure-scroll-wide figure.figure,
  .topic-figure-scroll-extra-wide figure.figure {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --header-offset: 5rem;
  }

  .navbar {
    min-height: 3.7rem;
  }

  .navbar-logo {
    width: 1.8rem;
    height: 1.8rem;
    max-height: 1.8rem;
  }

  .section-intro {
    padding: 1.35rem;
  }

  .downloads-lead,
  .downloads-lead-note {
    grid-template-columns: minmax(0, 1fr);
  }

  .downloads-lead {
    gap: var(--space-5);
    padding: 1.25rem;
  }

  .downloads-lead-note {
    gap: var(--space-3);
  }

  .branch-cards,
  .branch-cards > p {
    grid-template-columns: minmax(0, 1fr);
  }

  .course-sequence {
    grid-template-columns: minmax(0, 1fr);
  }

  .course-start {
    align-items: stretch;
    flex-direction: column;
    gap: var(--space-4);
  }

  .course-start-link {
    align-self: flex-start;
  }

  .contact-grid,
  .support-grid,
  .team-section,
  .team-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-tabset .nav-tabs {
    flex-wrap: nowrap;
    padding-bottom: 1px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .topic-download-resources,
  .topic-summary-resources {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-tabset .nav-tabs .nav-link {
    white-space: nowrap;
  }

  .topic-figure-scroll {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 0 var(--space-2);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .topic-figure-scroll > .cell {
    width: 46rem;
    min-width: 46rem;
  }

  .topic-figure-scroll-wide > .cell {
    width: 54rem;
    min-width: 54rem;
  }

  .topic-figure-scroll-extra-wide > .cell {
    width: 62rem;
    min-width: 62rem;
  }

  .topic-figure-scroll figure.figure {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .panel-tabset table.table:not(.dataTable) {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .panel-tabset .table-scroll-region > table.table:not(.dataTable) {
    display: table;
    width: max-content;
    min-width: 100%;
    max-width: none;
    overflow: visible;
  }

  .panel-tabset mjx-container:not([display="true"]) {
    display: inline-block;
    overflow-x: auto;
    overflow-y: hidden;
    vertical-align: middle;
  }

  .download-course-table tbody {
    grid-template-columns: minmax(0, 1fr);
  }

  .download-bundle-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .download-primary-package {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .download-topic-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .download-action {
    width: 100%;
  }

  .download-material-count {
    margin-top: var(--space-2);
  }

  .download-course-table {
    min-width: 0;
  }

  .nav-footer-right .footer-items {
    justify-content: center;
  }
}

@media (max-width: 540px) {
  h1 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
  }

  h2 {
    font-size: 1.4rem;
  }

  .section-intro,
  .platform-cta,
  .development-panel,
  .downloads-help,
  .contact-card,
  .support-card {
    padding: 1rem;
  }

  .downloads-lead {
    padding: 1rem;
  }

  .download-primary-package,
  .download-topic-card,
  .download-secondary-bundles {
    padding: 1rem;
  }

  .btn-row,
  .btn-row > p,
  .btn-row .dl-btn {
    width: 100%;
  }

  .course-sequence li {
    column-gap: 0.55rem;
    padding: 1rem;
  }

  .course-start-link {
    width: 100%;
  }

  .branch-card {
    padding: 1.2rem;
  }

  .team-member,
  .team-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 1rem;
  }

  .lesson-navigation {
    flex-direction: column;
    align-items: flex-start;
  }

  .lesson-navigation > p {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .lesson-navigation > p > :first-child,
  .lesson-navigation > p > :nth-child(2),
  .lesson-navigation > p > :last-child {
    width: 100%;
    justify-self: stretch;
    text-align: left;
  }

  .lesson-navigation .text-link-arrow {
    min-height: 2.5rem;
  }

  .download-module-heading {
    align-items: flex-start;
  }

  .download-module-heading h2 {
    font-size: 1.2rem;
  }

  .roadmap-table {
    table-layout: fixed;
  }

  .roadmap-table th:first-child,
  .roadmap-table td:first-child {
    width: 58%;
  }

  .roadmap-table th:last-child,
  .roadmap-table td:last-child {
    width: 42%;
  }

  .roadmap-table th,
  .roadmap-table td {
    padding: 0.6rem 0.45rem;
    overflow-wrap: anywhere;
  }

  .roadmap-table .status-badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .language-switcher {
    width: 100%;
  }

  .language-switcher a {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Four lesson tabs remain easy to scan throughout the compact layout without
   a horizontal-scroll affordance. At these widths the Quarto sidebars leave a
   narrower reading column than the viewport suggests, so a two-by-two grid
   keeps every localized label visible from the first paint. Natural wrapping
   is allowed only at spaces, and the existing Bootstrap roles remain
   unchanged. */
@media (max-width: 1199.98px) {
  .panel-tabset .nav-tabs {
    /* Quarto applies display:flex !important to visible nav lists from the
       tablet breakpoint upward, so this compact lesson layout must override
       that single property explicitly. */
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--space-2);
    padding: 0 0 var(--space-2);
    overflow-x: visible;
    border-bottom: 1px solid var(--color-border);
    scrollbar-gutter: auto;
  }

  .panel-tabset .nav-tabs .nav-item {
    min-width: 0;
  }

  .panel-tabset .nav-tabs .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 3.15rem;
    padding: 0.5rem 0.45rem;
    border: 1px solid var(--color-border) !important;
    border-bottom-width: 3px !important;
    border-radius: var(--radius-sm) !important;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
  }

  .panel-tabset .nav-tabs .nav-link:hover {
    border-color: #9ab4cc !important;
  }

  .panel-tabset .nav-tabs .nav-link.active {
    border-color: var(--statistics-blue) !important;
    background: var(--color-surface-soft) !important;
  }
}

/* Interactive figures resize to the real reading column. Static teaching
   diagrams retain their deliberate intrinsic width and the visible scroll
   treatment above when their labels need more room. */
@media (max-width: 1199.98px) {
  .panel-tabset .topic-figure-scroll:has(.plotly) > .cell {
    width: 100%;
    min-width: 0;
  }

  /* A 1024px viewport still leaves a much narrower lesson column beside the
     two Quarto sidebars. Preserve useful column widths there and let the
     named wrapper scroll, instead of squeezing German compounds, numbers,
     and coefficient headings into vertical fragments. */
  .panel-tabset .table-scroll-region > table.table th,
  .panel-tabset .table-scroll-region > table.table td {
    max-width: 18rem;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
  }

  .panel-tabset .table-scroll-region > table.table:has(tr > :nth-child(3)) {
    min-width: 36rem;
  }

  .panel-tabset .table-scroll-region > table.table:has(tr > :nth-child(4)) {
    min-width: 42rem;
  }

  .panel-tabset .table-scroll-region > table.table:has(tr > :nth-child(5)) {
    min-width: 48rem;
  }

  .panel-tabset .table-scroll-region > table.table:has(tr > :nth-child(7)) {
    min-width: 56rem;
  }

  .panel-tabset .table-scroll-region > table.table:has(tr > :nth-child(9)) {
    min-width: 62rem;
  }

  .panel-tabset .dataTables_wrapper > table.dataTable th,
  .panel-tabset .dataTables_wrapper > table.dataTable td {
    max-width: none;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
  }
}

@media (max-width: 768px) {
  /* DataTables calculates compact column widths before a hidden lesson tab is
     first revealed. Long localized headings must therefore establish their
     own readable width and wrap inside the header cell; otherwise the text can
     visually run into the next heading even though the table itself scrolls. */
  #tbl-simulated-planning-data table.dataTable th,
  #tbl-regression-raw-data table.dataTable th {
    min-width: 8.5rem !important;
    white-space: normal !important;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    line-height: 1.25;
    vertical-align: bottom;
  }

  #tbl-simulated-planning-data table.dataTable th:nth-child(3),
  #tbl-simulated-planning-data table.dataTable th:nth-child(4),
  #tbl-regression-raw-data table.dataTable th:nth-child(2),
  #tbl-regression-raw-data table.dataTable th:nth-child(3) {
    min-width: 11rem !important;
  }

  /* Let the outer named table region be the sole horizontal-scroll owner for
     equations. A wider intrinsic table keeps every term visible at its right
     endpoint instead of nesting a second MathJax scroller inside a cell. */
  #tbl-multiple-full-interaction-equations table.table {
    min-width: 80rem;
  }

  #tbl-multiple-full-interaction-equations mjx-container:not([display="true"]) {
    max-width: none;
    overflow: visible;
  }

  .panel-tabset .table-scroll-region > table.table th,
  .panel-tabset .table-scroll-region > table.table td,
  .panel-tabset .dataTables_wrapper > table.dataTable th,
  .panel-tabset .dataTables_wrapper > table.dataTable td {
    max-width: 13rem;
    padding: 0.55rem 0.65rem;
  }
}

@media (max-width: 340px) {
  .download-course-table .download-action-group {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  .navbar-brand-container {
    max-width: calc(100% - 3rem);
    margin-left: 0 !important;
  }

  .navbar-title {
    font-size: 0.82rem;
  }

  .status-legend {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in,
  .slide-up {
    opacity: 1;
    transform: none;
  }

  .branch-card:hover,
  .branch-card:focus-visible,
  .dl-btn:hover {
    transform: none;
  }
}
