/* =====================================================
   TABLE OF CONTENTS
   1.   Variables
   1b.  Dark theme
   2.   Reset
   3.   Base elements
   3b.  Utilities (visually hidden text)
   4.   Layout (container, page grid)
   5.   Icons (SVG sprite)
   6.   Header (logo, search button, theme button, toggle button, search field)
   6b.  Drawers (menu and search slide in from the right, full width)
   6c.  Submenus (levels 2, 3 and 4: phone accordion with smooth height, desktop dropdown)
   6d.  CTA buttons (primary, outline, bold text; left aligned on the phone, right side on desktop)
   7.   Footer
   8.   Sidebar
   9.   Blog intro (heading box)
   10.  Blog cards
   10b. Pagination (previous / next links and page numbers)
   11.  Blog detail (single article)
   11a. Breadcrumb (blog detail)
   11b. Post navigation (previous / next article)
   11c. Related posts (grid of cards under the article)
   12.  Article content (rich text)
   13.  Tags (blog cards and article)
   14.  Author profile (base, main content, sidebar)
   15.  Post meta (author photo + name + date)
   16.  Author box (end of article, for later)
   17.  Authors index (grid of author cards)
   17b. Dark mode overrides (stronger selectors)
   18.  Tablet  (768px and wider)
   19.  Desktop (1024px and wider)
   19b. Reduced motion
   20.  Full width layout override (must stay last)
   ===================================================== */


:root {
  /* --- Wagtail light theme palette (official Wagtail design tokens) --- */
  --color-primary: #2e1f5e;       /* Wagtail purple: branding, panels, headings, buttons */
  --color-primary-200: #261a4e;   /* darker purple accent */

  --color-secondary: #007d7e;     /* Wagtail teal: action links, primary buttons */
  --color-secondary-600: #004345; /* hover for two-tone buttons */
  --color-secondary-400: #005b5e; /* hover states */
  --color-secondary-100: #00b0b1; /* highlights over dark backgrounds */
  --color-secondary-75: #80d7d8;  /* highlights over dark text */
  --color-secondary-50: #f2fcfc;  /* light backgrounds, highlighted fields */

  --color-white: #ffffff;         /* page and panel backgrounds, button text */
  --color-grey-600: #262626;      /* body copy */
  --color-grey-400: #5c5c5c;      /* help text, meta text */
  --color-grey-200: #929292;      /* dividers, button borders */
  --color-grey-150: #c8c8c8;      /* field borders */
  --color-grey-100: #e0e0e0;      /* dividers, panel borders */
  --color-grey-50: #f6f6f8;       /* panel backgrounds, row highlights */

  --color-info: #1d7792;          /* information messages */
  --color-info-bg: #e2f5fc;
  --color-positive: #1b8666;      /* success messages */
  --color-positive-bg: #e0fbf4;
  --color-warning: #faa500;       /* warnings */
  --color-warning-bg: #fff5d8;
  --color-critical: #ca3b3b;      /* errors, dangerous actions */
  --color-critical-bg: #fef0f0;

  /* --- Roles: use these in the rules below, so one change updates the whole site --- */
  --color-text: var(--color-grey-600);         /* main text */
  --color-text-muted: var(--color-grey-400);   /* dates, small meta text */
  --color-bg: var(--color-grey-50);            /* page background: lightest Wagtail grey */
  --color-surface: var(--color-white);         /* cards and widgets */
  --color-border: var(--color-grey-100);       /* lines between sections */
  --color-link: var(--color-secondary);        /* links */
  --color-link-hover: var(--color-secondary-400);
  --color-heading: var(--color-primary);       /* titles inside cards and widgets */
  --color-badge-bg: var(--color-primary);      /* category badge background */
  --color-badge-hover: var(--color-secondary); /* category badge hover background */
  --color-icon-muted: var(--color-grey-200);   /* breadcrumb chevrons and similar small icons */
  --color-btn-bg: #e6e6ec;                     /* subtle grey circle behind the round header buttons (light mode) */
  --color-btn-bg-hover: #d8d8e0;               /* slightly darker grey on hover */
  --color-cta-bg: var(--color-secondary);          /* filled CTA button */
  --color-cta-bg-hover: var(--color-secondary-400);/* filled CTA button on hover */
  --color-cta-text: var(--color-white);            /* text on the filled CTA button */

  /* --- Dropdown box colors: same as the cards in light mode, dark mode changes them (section 1b) --- */
  --color-dropdown-bg: var(--color-surface);          /* background of every dropdown box */
  --color-dropdown-item-hover: var(--color-btn-bg);   /* hover background of one dropdown item */

  /* --- Layout and spacing --- */
  --card-space: 1.6rem;        /* one spacing value used everywhere in cards */
  --page-width: 120rem;        /* one width used by header AND content */
  --page-width-full: 100%;
  --page-top-space: 3rem;      /* one top space used by left content AND sidebar */

  /* --- Drawers (menu and search) --- */
  --drawer-top-height: 7.2rem; /* height of the drawer top bar (logo + close button) AND of the header logo area: 4.4rem image + 1.4rem above and below */
  --search-space: 3rem;        /* space above the search field (and the base for the space below it) */
  --search-space-side: 4rem;   /* space at the LEFT and RIGHT of the search field: change this number to make it wider or narrower */

  /* --- Shape --- */
  --radius-pill: 10rem;        /* fully rounded ends for category badges and tags */

  /* --- Menu motion (phone) --- */
  --menu-duration: 0.25s;                          /* ONE speed for the chevron turn, the submenu fade AND the submenu height */
  --menu-transition: var(--menu-duration) ease;    /* the same speed with the easing, ready to use in transitions */

  /* --- Desktop dropdown (submenu) --- */
  --dropdown-width: 24rem;     /* minimum width of every dropdown box */
  --dropdown-space: 0.8rem;    /* space inside every dropdown box, around the items */
  --dropdown-gap: 0.8rem;      /* space between a dropdown box and the box that opens beside it */
  --dropdown-radius: 1.2rem;   /* rounded corners of every box (same as the cards) */
  --dropdown-item-radius: 0.8rem;   /* rounded corners of one item inside a box */
  --shadow-dropdown: 0 0.4rem 1.6rem rgba(38, 38, 38, 0.08);   /* soft, subtle shadow instead of a border line */
}

/* ---------- 1b. Dark theme ---------- */
/* Colors follow Wagtail's own dark look (grey scale + light teal).
   Only applies when JavaScript sets data-theme="dark" on <html>.
   It overrides the roles, so every rule using them changes automatically. */
[data-theme="dark"] {
  color-scheme: dark;                          /* dark scrollbars and form controls */

  --color-text: #ffffff;                       /* main text: white, like Wagtail dark */
  --color-text-muted: #c8c8c8;                 /* dates and small meta text (Wagtail grey-150) */
  --color-bg: #1a1a1a;                         /* page background: darker than the cards */
  --color-surface: #262626;                    /* cards, header, footer, widgets (Wagtail grey-600) */
  --color-border: #404040;                     /* thin lines between sections */
  --color-link: var(--color-secondary-75);     /* light teal (#80d7d8): readable on dark */
  --color-link-hover: #ffffff;                 /* white on hover */
  --color-heading: #ffffff;                    /* white titles */
  --color-badge-bg: var(--color-secondary);    /* teal badge (#007d7e) with white text */
  --color-badge-hover: var(--color-secondary-400);   /* slightly darker teal on hover */
  --color-icon-muted: #929292;                 /* chevrons stay visible on dark */
  --color-btn-bg: #333333;                     /* subtle dark circle, just lighter than the #262626 header */
  --color-btn-bg-hover: #404040;               /* a little lighter on hover */

  /* Dropdown on dark: a black shadow cannot be seen on a dark page,
     so the box is LIGHTER than the header and has a faint light edge */
  --color-dropdown-bg: #303030;                /* lighter than the #262626 header, so the box stands out */
  --color-dropdown-item-hover: #3d3d3d;        /* lighter than the box, so the hover is still visible */

  --shadow-dropdown:
    0 0 0 1px rgba(255, 255, 255, 0.05),       /* barely visible light edge: only hints the box shape on dark */
    0 0.4rem 2.4rem rgba(0, 0, 0, 0.25);       /* soft, wide and light shadow (was a strong 0.6): smooth and subtle */
}


/* ---------- 2. Reset ---------- */
*,
*::before,
*::after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;   /* padding and border stay inside the width */
}


/* ---------- 3. Base elements ---------- */
/* 62.5% of the browser's 16px = 10px, so 1rem = 10px (easy math: 1.8rem = 18px).
   A percentage (not px) keeps the user's browser font-size setting working. */
html {
  font-size: 62.5%;
  interpolate-size: allow-keywords;   /* lets the browser animate "height: 0" to "height: auto" (phone submenu).
                                         Browsers without this feature just open the submenu instantly. */
}

/* Stops the left/right scrollbar: anything wider than the screen is cut off */
html,
body {
  overflow-x: clip;
}

body {
  font-family: "Source Sans 3", sans-serif;
  font-size: 1.8rem;
  color: var(--color-text);              /* Wagtail body copy color */
  background-color: var(--color-bg);     /* page background */
}

a {
  text-decoration: none;
  color: var(--color-text);
}

a:hover {
  color: var(--color-text-muted);
}

li {
  list-style-type: none;   /* no bullets by default */
}


/* ---------- 3b. Utilities ---------- */
/* Hides text from the eyes but keeps it for screen readers.
   Used for the label of the search field. display:none would hide it from screen readers too. */
.visually-hidden {
  position: absolute;          /* take it out of the layout, so it uses no space */
  width: 1px;                  /* 1px box: not zero, so screen readers still read it */
  height: 1px;
  margin: -1px;                /* pull the 1px box back, so it cannot push anything */
  padding: 0;
  overflow: hidden;            /* nothing can spill out of the tiny box */
  clip-path: inset(50%);       /* cut away everything that is still visible */
  white-space: nowrap;         /* keeps the text on one line, so it is read correctly */
  border: 0;
}


/* ---------- 4. Layout ---------- */
.site-container {
  width: 100%;
}

/* Header content: same width and centering as .page-layout */
.inner {
  max-width: var(--page-width-full);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Page with sidebar (phone: one column) */
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* phone: one column */
  gap: 2.4rem;
  width: 100%;
  max-width: var(--page-width);   /* same as .inner */
  margin: 0 auto;
  padding: var(--page-top-space) 2rem 0;   /* top space is set HERE only */
}

.page-main {
  min-width: 0;   /* stops wide content from pushing the sidebar out */
}

/* The first item on the left and the first item in the sidebar
   have no top margin, so both start at exactly the same height */
.page-main > :first-child,
.sidebar > :first-child {
  margin-top: 0;
}


/* ---------- 5. Icons (SVG sprite) ---------- */
/* Drawn by includes/icon.html from static/icons/sprite.svg.
   Size follows the text around it, so one icon fits every heading and paragraph. */
.icon {
  display: inline-block;
  width: 1.2em;               /* width scales with the font size around the icon */
  height: 1.2em;              /* same as width, so the icon stays square */
  flex-shrink: 0;             /* never squeezed inside a flex row */
  vertical-align: -0.2em;     /* sits slightly below the baseline, level with the text */
  fill: none;                 /* Lucide icons are outlines, not filled shapes */
  stroke: currentColor;       /* line color = text color, so hover colors work automatically */
  stroke-width: 2;            /* Lucide's normal line thickness */
  stroke-linecap: round;      /* rounded line ends */
  stroke-linejoin: round;     /* rounded corners */
}


/* ---------- 6. Header ---------- */
.site-header {
  background-color: var(--color-surface);   /* white header */
}

/* Logo */
/* Layout: [image] [text on top / tagline below].
   The image is on the left. The text and the tagline are stacked in one column on the right.
   Any of the three can be missing (hidden in the admin), and the rest still lines up. */
.site-logo {
  flex: 1;   /* grow to fill all space left over, so the buttons stay on the right */
}

/* The whole logo is one link: image + text group */
.logo-link {
  display: inline-flex;       /* image and text group side by side; the link is only as wide as the logo */
  align-items: center;        /* image and text group share the same middle line */
  gap: 0.8rem;                /* space between the image and the text group (was 1.2rem) */
  max-width: 100%;            /* a very long text can never be wider than the header */
  padding: 1.4rem 0;          /* space above and below: with the 4.4rem image the header is 7.2rem high, same as the drawer top bar */
  min-height: var(--drawer-top-height);   /* the header is ALWAYS this high, even when the image is smaller (no tagline) or missing */
  color: var(--color-text);   /* text color follows the theme */
}

/* Logo image: fixed height, width follows the real proportions */
.logo-image {
  display: block;             /* removes the small gap that images have under them */
  flex-shrink: 0;             /* never squeezed by a long text */
  width: auto;                /* keep the real proportions of the logo */
  height: 4.4rem;             /* same on phone and desktop (the image file is 60px high, so it stays sharp). Without a tagline it gets smaller, see below */
  object-fit: contain;        /* never cropped or stretched */
}

/* Dark logo: both logo images are in the HTML, CSS shows only one.
   By default (light theme) the dark logo is hidden.
   It comes after .logo-image, so it wins (same strength, later rule). */
.logo-image--dark {
  display: none;
}

/* Dark theme AND a dark logo was uploaded: hide the light logo.
   :has() checks that the logo link contains a dark image, so if no dark logo
   exists, the light logo stays visible in both themes. */
[data-theme="dark"] .logo-link:has(.logo-image--dark) .logo-image--light {
  display: none;
}

/* Dark theme: show the dark logo (display: block, same as .logo-image) */
[data-theme="dark"] .logo-link .logo-image--dark {
  display: block;
}

/* Text group: logo text on top, tagline below */
.logo-body {
  display: flex;
  flex-direction: column;     /* one line under the other */
  gap: 0;                     /* no extra space between the logo text and the tagline (was 0.4rem) */
  min-width: 0;               /* lets a long text wrap instead of pushing the buttons out */
  line-height: 1.05;          /* tight lines, so the two texts sit close together (was 1.1) */
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 600;
  overflow-wrap: anywhere;    /* a very long word wraps instead of breaking the layout */
}

.logo-tagline {
  font-size: 1.3rem;
  font-weight: normal;
  overflow-wrap: anywhere;
}

/* NO TAGLINE (hidden in the admin): the image gets smaller and the logo text gets bigger.
   :has() looks if the link contains a tagline. The header stays the same height,
   because .logo-link has a minimum height. A browser that does not know :has() ignores
   these two rules and simply shows the normal logo. */
.logo-link:not(:has(.logo-tagline)) .logo-image {
  height: 3.2rem;             /* smaller image (normal: 4.4rem) */
}

.logo-link:not(:has(.logo-tagline)) .logo-title {
  font-size: 2.4rem;          /* bigger text (normal: 2.2rem) */
}

/* Toggle button (hamburger icon, mobile only) */
.toggle-btn {
  flex: 0 0 auto;                 /* do not grow or shrink, size comes from min-width */
  display: flex;
  align-items: center;            /* icon in the vertical middle */
  justify-content: flex-end;      /* icon on the right edge */
  min-width: 4.4rem;              /* easy to tap with a finger (44px) */
  min-height: 4.4rem;
  padding: 0;                     /* buttons have default padding, remove it */
  border: 0;                      /* buttons have a default border, remove it */
  background: none;               /* buttons have a grey background, remove it */
  color: var(--color-text);       /* icon color follows this (currentColor) */
  font: inherit;                  /* use the site font, not the browser button font */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;   /* removes the colored flash when tapping */
}

/* Clear outline for keyboard users (Tab key) */
.toggle-btn:focus-visible {
  outline: 2px solid var(--color-link);   /* light teal in dark mode, so focus stays visible */
  outline-offset: 0.4rem;
  border-radius: 0.4rem;
}

/* Icon size: a bit bigger than the normal .icon size.
   Two classes make this rule stronger than the single .icon rule above. */
.toggle-btn .toggle-icon {
  width: 2.8rem;
  height: 2.8rem;
}

/* Round header buttons = search button + theme button + search submit button
   (visible on every screen size). They share these rules, so they always look the same. */
.search-btn,
.theme-btn,
.search-submit {
  display: flex;
  align-items: center;            /* icon in the vertical middle of the circle */
  justify-content: center;        /* icon in the horizontal middle of the circle */
  align-self: center;             /* circle sits in the vertical middle of the header row */
  flex: 0 0 auto;                 /* keep its own size, never squeezed */
  width: 3.5rem;                  /* fixed width, so the shape is a true circle */
  height: 3.5rem;                 /* same as width */
  padding: 0;                     /* remove the default padding (buttons have some) */
  border: 0;                      /* remove the default border (buttons have one) */
  border-radius: 50%;             /* fully round */
  background-color: var(--color-btn-bg);      /* subtle grey (light) or subtle dark (dark) */
  color: var(--color-text);       /* icon color follows this (currentColor) */
  font: inherit;                  /* use the site font, not the browser button font */
  cursor: pointer;
  transition: background-color 0.2s ease;     /* smooth hover color change */
  -webkit-tap-highlight-color: transparent;   /* removes the colored flash when tapping */
}

/* Search button only: space between the search circle and the theme circle */
.search-btn {
  margin-right: 0.8rem;
}

/* Slightly stronger background on hover.
   "color" is set here too, so the icon never turns grey. */
.search-btn:hover,
.theme-btn:hover,
.search-submit:hover {
  background-color: var(--color-btn-bg-hover);
  color: var(--color-text);
}

/* Clear outline for keyboard users (Tab key) */
.search-btn:focus-visible,
.theme-btn:focus-visible {
  outline: 2px solid var(--color-link);   /* light teal in dark mode, so focus stays visible */
  outline-offset: 0.2rem;                 /* small gap, because the circle is already a clear shape */
}

/* Icon size: smaller than the menu icon */
.search-btn .search-icon,
.theme-btn .theme-icon,
.search-submit .search-submit-icon {
  width: 2rem;
  height: 2rem;
}

/* Light mode (default, no data-theme): show the moon, hide the sun */
.theme-btn .theme-icon-sun {
  display: none;
}

/* Dark mode (JavaScript sets data-theme="dark" on <html>): swap the icons */
[data-theme="dark"] .theme-btn .theme-icon-moon {
  display: none;
}

[data-theme="dark"] .theme-btn .theme-icon-sun {
  display: inline-block;
}

/* While the search drawer is open, the search button keeps the "hover" background
   (JavaScript sets aria-expanded="true" on it) */
.search-btn[aria-expanded="true"] {
  background-color: var(--color-btn-bg-hover);
}

/* The search form: full width of the drawer body */
.search-form {
  position: relative;   /* the submit button is placed inside this box */
  display: flex;
  width: 100%;
}

/* The search field */
.search-input {
  flex: 1;                                    /* fill the whole form width */
  min-width: 0;                               /* allow the field to shrink on small screens */
  height: 4.4rem;                             /* easy to tap with a finger (44px) */
  padding: 0 5.2rem 0 1.6rem;                 /* right space is for the submit button */
  border: 1px solid var(--color-border);      /* soft line, changes in dark mode */
  border-radius: var(--radius-pill);          /* fully rounded, like the round buttons */
  background-color: var(--color-bg);          /* slightly different from the drawer background */
  color: var(--color-text);
  font: inherit;                              /* use the site font */
  font-size: 1.6rem;                          /* 16px: stops phones from zooming in on focus */
  -webkit-appearance: none;                   /* remove the default phone/Safari search style */
  appearance: none;
}

.search-input::placeholder {
  color: var(--color-text-muted);   /* the "Search..." hint text */
  opacity: 1;                       /* Firefox makes placeholders lighter by default */
}

.search-input:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* Submit button: the search icon on the right side of the field.
   It already has the round button look from the shared rule above. */
.search-submit {
  position: absolute;           /* sits on top of the field */
  top: 50%;
  right: 0.5rem;                /* small gap from the right edge of the field */
  transform: translateY(-50%);  /* exact vertical middle */
}

.search-submit:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.1rem;
}


/* ---------- 6b. Drawers (menu and search slide in from the right, full width) ---------- */
/* Mobile first: the menu drawer and the search drawer share the same rules.
   Each waits outside the screen, then slides in when JavaScript adds .open.
   Tablet and desktop turn the menu back into a normal row of links (see section 18).
   The search drawer stays a full-width slider at every screen size. */
.header-nav,
.search-drawer {
  position: fixed;               /* fixed to the screen, so it does not move when the page scrolls */
  top: 0;
  right: 0;                      /* attached to the right edge, so it slides in from the right */
  z-index: 1000;                 /* above the page content */
  display: flex;
  flex-direction: column;        /* top bar first, then the content below it */
  width: 100%;                   /* full screen width: no space at the left */
  height: 100vh;                 /* fallback for older browsers */
  height: 100dvh;                /* real visible height on phones (the address bar is not counted) */
  overflow-y: auto;              /* long content scrolls inside the drawer */
  background-color: var(--color-surface);   /* white in light mode, dark grey in dark mode */
  transform: translateX(100%);   /* pushed fully outside the screen = closed */
  visibility: hidden;            /* closed content cannot be reached with the Tab key */
  transition:
    transform 0.3s ease,
    visibility 0s linear 0.3s;   /* hide the drawer after the slide-out ends */
}

/* Open state (JavaScript adds .open) */
.header-nav.open,
.search-drawer.open {
  transform: translateX(0);      /* slides in to its normal place */
  visibility: visible;
  transition:
    transform 0.3s ease,
    visibility 0s linear 0s;     /* show immediately, so the slide-in is visible */
}

/* The search drawer is the TOP layer: higher than the menu (1000), so the menu links
   are always BEHIND it while it slides in. No waiting, no hiding needed.
   NEW: its height now follows the CSS variable --search-vh (JavaScript sets it to the
   visible height in px when the phone keyboard opens or closes), and the height change
   is animated, so the search field glides to the new middle instead of jumping. */
.search-drawer {
  z-index: 1100;
  height: 100vh;                         /* fallback for older browsers */
  height: var(--search-vh, 100dvh);      /* JavaScript sets --search-vh in px; before that, 100dvh is used */
  transition:
    transform 0.3s ease,                 /* keep the slide-in and slide-out from the right */
    height 0.25s ease,                   /* NEW: smooth height change when the keyboard opens or closes */
    visibility 0s linear 0.3s;           /* keep: hide the drawer after the slide-out ends */
}

/* Open state of the search drawer: the same list, but visibility shows immediately.
   It must be repeated here, because ".search-drawer.open" in the earlier rule
   would otherwise remove the height transition while the drawer is open. */
.search-drawer.open {
  transition:
    transform 0.3s ease,
    height 0.25s ease,                   /* NEW: the same smooth height change */
    visibility 0s linear 0s;             /* show immediately, so the slide-in is visible */
}

/* Drawer top bar: logo on the left, close button on the right */
.drawer-top {
  display: flex;
  align-items: center;             /* logo and button share the same middle line */
  justify-content: space-between;  /* logo far left, button far right */
  gap: 1.6rem;
  min-height: var(--drawer-top-height);   /* about the same height as the header */
  padding: 0 2rem;                 /* same side space as .inner */
}

/* The shared logo inside the drawer top bar: it may shrink, so a long text
   wraps and never pushes the close button out of the screen */
.drawer-top .logo-link {
  min-width: 0;
}

.drawer-logo {
  display: flex;
  align-items: center;
  min-width: 0;                    /* lets a long logo text shrink instead of pushing the button */
  color: var(--color-text);
}

.drawer-logo-image {
  display: block;
  width: auto;                     /* keep the real proportions of the logo */
  max-width: 100%;
  height: 4rem;                    /* matches height-40 in the template */
}

.drawer-logo-title {
  font-size: 2.2rem;               /* same size as .logo-title in the header */
  font-weight: 600;
}

/* Close button (x icon) */
.drawer-close {
  display: flex;
  align-items: center;
  justify-content: flex-end;       /* icon on the right edge, same as the hamburger and the chevron buttons */
  flex: 0 0 auto;                  /* never squeezed by a long logo */
  width: 4.4rem;                   /* easy to tap with a finger (44px) */
  height: 4.4rem;
  margin-left: auto;               /* always pushed to the right edge, even when there is no logo (search drawer) */
  padding: 0;                      /* remove the default button padding */
  border: 0;                       /* remove the default button border */
  background: none;                /* remove the default button background */
  color: var(--color-text);        /* icon color follows this (currentColor) */
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;   /* removes the colored flash when tapping */
}

.drawer-close .drawer-close-icon {
  width: 2.8rem;                   /* same size as the menu icon */
  height: 2.8rem;
  margin-right: -0.2rem;           /* the drawing inside the bigger X icon has 0.2rem more empty space on its right than the small chevron: this pulls the lines of the X back to the same edge */
}

/* Clear outline for keyboard users (Tab key) */
.drawer-close:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
  border-radius: 0.4rem;
}

/* Links list inside the menu drawer: one column, same space between every item */
.header-nav .nav-menu {
  display: flex;
  flex-direction: column;          /* one link per row */
  gap: 0.4rem;                     /* the ONE space between items: change this number to adjust all of them */
  padding: 1.6rem 2rem 3rem;       /* space around the whole list */
}

/* The item itself has no space and no line: the list gap does the work */
.header-nav .menu-item {
  display: block;
  margin: 0;
}

/* The whole row is clickable and tall enough for a finger */
.header-nav .item-link {
  display: block;
  padding: 0.5rem 0;               /* same space above and below the text for every link */
  font-size: 1.8rem;
  line-height: 1.3;                /* same line height for every link, so rows are equal */
}

/* The search field area, under the top bar.
   The body fills all the height left under the top bar and puts the field in the MIDDLE,
   on the phone, tablet and desktop (the same rules for every screen size).
   Space at the left and right is --search-space-side (see section 1).
   The extra bottom space is the height of the top bar, so the field is in the middle of the
   whole screen and not only in the middle of the space under the top bar. */
.search-drawer-body {
  flex: 1;                           /* fill all the height left under the top bar */
  display: flex;
  flex-direction: column;            /* stack the content, so we can center it up and down */
  justify-content: center;           /* vertical middle */
  width: 100%;
  max-width: 72rem;                  /* the field does not stretch too wide on big screens */
  margin: 0 auto;                    /* centered left and right when the screen is wider than 72rem */
  padding:
    var(--search-space)                                      /* top */
    var(--search-space-side)                                 /* right */
    calc(var(--search-space) + var(--drawer-top-height))     /* bottom: balances the top bar */
    var(--search-space-side);                                /* left */
}

/* While a drawer is open, the page behind it must not scroll (JavaScript adds this class) */
body.menu-open {
  overflow: hidden;
}

/* html has its own overflow (section 3: overflow-x: clip), so the browser ignores the body rule above
   for the window scrollbar. This locks the html element too: no page scrollbar while a drawer is open.
   :has() checks if the body has the menu-open class (JavaScript adds it when a drawer opens). */
html:has(body.menu-open) {
  overflow: hidden;
}


/* ---------- 6c. Submenus (levels 2, 3 and 4) ---------- */
/* Mobile first: plain text, no borders, no lines. Every submenu level has the SAME text size.
   JavaScript adds .open to the <li class="menu-item"> to show its submenu.
   Tablet and desktop turn levels 2, 3 and 4 into dropdown boxes (see section 18).

   SMOOTH OPENING: the list is always in the page, but its height is 0 while closed.
   When it opens, the height grows from 0 to its real size (height: auto), so the items
   below it slide down smoothly and do not jump. It also fades in and out. */

/* A parent item: link and chevron button in one row */
.header-nav .menu-row {
  display: flex;
  align-items: center;             /* text and chevron share the same middle line */
  justify-content: space-between;  /* text on the left, chevron on the far right (like the hamburger) */
  gap: 0.8rem;
}

/* The link inside a parent row takes all the free space, so the chevron stays on the right */
.header-nav .menu-row .item-link {
  flex: 1;
  min-width: 0;                    /* a long title wraps instead of pushing the chevron out */
}

/* The chevron button (used next to a link) */
.header-nav .submenu-toggle {
  display: flex;
  align-items: center;             /* icon in the vertical middle */
  justify-content: flex-end;       /* icon on the right edge, same as the hamburger */
  flex: 0 0 auto;                  /* keep its own size, never squeezed */
  width: 4.4rem;                   /* easy to tap with a finger (44px) */
  height: 4.4rem;
  margin: -0.5rem 0;               /* pulls the tall button back, so the row is not taller than a plain link */
  padding: 0;                      /* remove the default button padding */
  border: 0;                       /* remove the default button border */
  background: none;                /* remove the default button background */
  color: var(--color-text);        /* icon color follows this (currentColor) */
  font: inherit;                   /* use the site font, not the browser button font */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;   /* removes the colored flash when tapping */
}

/* Button used as the whole row (parent without its own link): text left, icon right */
.header-nav .submenu-toggle--text {
  flex: 1;                         /* fill the whole row */
  width: 100%;
  height: auto;
  margin: 0;                       /* no pull-back needed: the padding gives the height */
  padding: 0.5rem 0;               /* same space as a normal link */
  justify-content: space-between;  /* text on the left, icon on the right */
  text-align: left;                /* buttons center their text by default */
  font-size: 1.8rem;               /* same size as .item-link */
  line-height: 1.3;
}

/* Icon: smaller than the hamburger, because it sits next to text */
.header-nav .submenu-icon {
  width: 2rem;
  height: 2rem;
  transition: transform var(--menu-transition);   /* smooth turn when the submenu opens (same speed as the submenu) */
}

/* Open submenu: chevron turns upside down (down becomes up) */
.header-nav .menu-item.open > .menu-row .submenu-icon {
  transform: rotate(180deg);
}

/* Clear outline for keyboard users (Tab key) */
.header-nav .submenu-toggle:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
  border-radius: 0.4rem;
}

/* The submenu list, CLOSED: height 0, see-through, and hidden from the Tab key.
   "visibility" waits until the fade-out is finished (the delay), so the list does not vanish too early. */
.header-nav .submenu {
  display: flex;                   /* always a flex column: the HEIGHT hides it, not "display: none" */
  flex-direction: column;          /* one link per row */
  gap: 0.4rem;                     /* same space between items as the main list */
  height: 0;                       /* closed: no height at all */
  padding: 0 0 0 1.6rem;           /* indent only (left). No top or bottom padding, because padding cannot shrink below 0 height */
  overflow: clip;                  /* nothing shows outside the 0 height box */
  overflow-clip-margin: 0.4rem;    /* a little room, so keyboard focus outlines are not cut off */
  opacity: 0;                      /* closed: fully see-through */
  visibility: hidden;              /* closed: not reachable with the Tab key */
  transition:
    height var(--menu-transition),
    opacity var(--menu-transition),
    visibility 0s linear var(--menu-duration);   /* hide AFTER the close animation ends */
}

/* The submenu list, OPEN: grows to its real height and fades in */
.header-nav .menu-item.open > .submenu {
  height: auto;                    /* grows from 0 to the real height (animated thanks to interpolate-size in section 3) */
  opacity: 1;                      /* open: fully visible */
  visibility: visible;             /* open: reachable with the Tab key */
  transition:
    height var(--menu-transition),
    opacity var(--menu-transition),
    visibility 0s linear 0s;       /* show immediately, so the opening is visible */
}

/* Space above the first item and under the last item of a list.
   It sits on the items (not on the list), so it grows and shrinks together with the height. */
.header-nav .submenu > .menu-item:first-child {
  padding-top: 0.4rem;
}

.header-nav .submenu > .menu-item:last-child {
  padding-bottom: 0.4rem;
}

/* Text size: ONE size for every submenu level (2, 3 and 4), a little smaller than the main links (1.8rem).
   Change this one number to change all dropdown text on the phone. */
.header-nav .submenu .item-link,
.header-nav .submenu .submenu-toggle--text {
  font-size: 1.6rem;
}

/* Icons in submenus: a little smaller too */
.header-nav .submenu .submenu-icon {
  width: 1.8rem;
  height: 1.8rem;
}


/* ---------- 6d. CTA buttons ---------- */
/* Mobile first: the buttons sit at the bottom of the drawer, on the LEFT, one under the other.
   Each button is only as wide as its text (not stretched to 100%).
   Tablet and desktop put them in a row, on the right of the menu links (see section 18).
   Style comes from the admin (the value saved by the Style dropdown):
   .cta-button--primary (filled), .cta-button--outline (line only)
   or .cta-button--bold_text (bold text, no button). */
.header-nav .cta-menu {
  display: flex;
  flex-direction: column;          /* one button per row */
  align-items: flex-start;         /* buttons stay on the left and keep their own width (no stretching) */
  gap: 1.2rem;                     /* space between the two buttons */
  padding: 0 2rem 3rem;            /* same side space as the menu list */
}

.cta-button {
  display: inline-flex;
  align-items: center;             /* text in the vertical middle */
  justify-content: center;         /* text in the horizontal middle */
  width: auto;                     /* only as wide as the text (was 100%) */
  max-width: 100%;                 /* a very long text can never be wider than the drawer */
  min-height: 4.4rem;              /* easy to tap with a finger (44px) */
  padding: 0 2.4rem;
  border: 2px solid transparent;   /* both styles have a 2px border, so they have the same size */
  border-radius: var(--radius-pill);   /* fully rounded, like the search field */
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;   /* smooth hover */
  -webkit-tap-highlight-color: transparent;   /* removes the colored flash when tapping */
}

/* Primary: filled. "a:hover" would turn the text grey, so the hover color is set here too */
.cta-button--primary {
  background-color: var(--color-cta-bg);
  border-color: var(--color-cta-bg);
  color: var(--color-cta-text);
}

.cta-button--primary:hover {
  background-color: var(--color-cta-bg-hover);
  border-color: var(--color-cta-bg-hover);
  color: var(--color-cta-text);
}

/* Outline: only a line. Light teal in dark mode, because --color-link changes with the theme */
.cta-button--outline {
  background-color: transparent;
  border-color: var(--color-link);
  color: var(--color-link);
}

.cta-button--outline:hover {
  background-color: var(--color-link);
  color: var(--color-surface);     /* card color for the text: readable in both themes (same as the tags) */
}

/* Bold text: bold text only, no button (no background, no line).
   The class name must match the value saved by the admin dropdown: "bold_text".
   It has no side padding, so on the phone its text lines up with the menu links on the left.
   The hover color is the same grey as the menu links. */
.cta-button--bold_text {
  padding: 0;                      /* no button shape, so no side space */
  background-color: transparent;
  border-color: transparent;       /* keeps the same 2px size as the other styles, but invisible */
  color: var(--color-text);        /* normal text color (white in dark mode) */
  font-size: 1.8rem;               /* same size as the menu links on the phone */
  font-weight: 700;                /* bold */
}

.cta-button--bold_text:hover {
  background-color: transparent;
  color: var(--color-text-muted);  /* same grey hover as the menu links */
}

/* Clear outline for keyboard users (Tab key) */
.cta-button:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
}


/* ---------- 7. Footer ---------- */
.footer-nav {
  background-color: var(--color-surface);   /* white footer */
}

/* Mobile first: a smaller footer menu.
   Smaller text, less space around it, and a small gap between the rows when the links wrap.
   Tablet puts the original sizes back (see section 18). */
.footer-menu {
  display: flex;
  justify-content: center;
  gap: 0.6rem 1.6rem;           /* row gap (between wrapped lines) 0.6rem, column gap (between links) 1.6rem */
  list-style: none;
  margin: 0;
  padding: 1.2rem 1.5rem;       /* less space above and below than before (was 1.5rem) */
  font-size: 1.6rem;            /* a little smaller than desktop (1.8rem) on the phone */
  line-height: 1.3;             /* tight lines, so wrapped rows sit close together */
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
}

.footer-link {
  text-decoration: none;
  color: inherit;
}

.footer-text {
  text-align: center;
  padding: 1.5rem;
  font-size: 1.6rem;
  opacity: 0.8;
}


/* ---------- 8. Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 2.4rem;               /* same space between every widget */
  margin: 0 0 3rem;        /* same outer space as the blog cards */
}

.sidebar-widget {
  padding: 2rem;
  background-color: var(--color-surface);                         /* white, like your cards */
  border-radius: 1.2rem;
}

/* Widget title: heading color with a bottom border, no background */
.sidebar-widget-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  color: var(--color-heading);                     /* purple in light mode, white in dark mode */
  padding-bottom: 1.2rem;                          /* space between text and border */
  border-bottom: 1px solid var(--color-border);    /* soft line under the title */
  margin-bottom: var(--card-space);                /* space between border and content */
}


/* ---------- 9. Blog intro (heading box) ---------- */
/* Used by the blog index, categories, tags and authors headings */
.blog-intro {
  display: flex;
  flex-direction: column;                   /* mobile: image on top, text below */
  gap: var(--card-space);
  margin: 3rem 0;
  padding: 2rem;
  background-color: var(--color-surface);   /* white background */
  border-radius: 1.2rem;                    /* rounded corners */
}

.blog-intro-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.8rem;
}

.blog-intro-text {
  display: flex;
  flex-direction: column;
  gap: var(--card-space);
}

/* The title looks like the breadcrumb:  [icon] Category  >  Title
   It is still an <h1> in the HTML (good for SEO and screen readers), only the look is small.
   The whole heading is bold. The label ("Category") is muted grey, the title is the normal text color. */
.blog-intro-title {
  display: flex;
  flex-wrap: wrap;           /* wraps to a new line on small screens, like the breadcrumb */
  align-items: center;       /* icon, label, chevron and title share the same middle line */
  gap: 0.6rem;               /* same space between the parts as in the breadcrumb */
  font-size: 1.4rem;         /* same as .breadcrumb-list on the phone */
  font-weight: 600;          /* bold for the WHOLE heading: label, separator and title (same bold as .breadcrumb-current) */
  line-height: 1.2;
}

/* Label: icon + word (Category, Tag, Author), bold like the rest, with the muted color of .breadcrumb-link */
.blog-intro-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text-muted);
}

/* The icon box: never squeezed, so a long title cannot shrink the icon */
.blog-intro-icon {
  display: flex;
  flex-shrink: 0;
}

/* Chevron between the label and the title: light grey, same as .breadcrumb-separator */
.blog-intro-separator {
  display: flex;
  color: var(--color-icon-muted);
}

/* The title text: bold, normal text color (same as .breadcrumb-current).
   A long title wraps to a new line instead of pushing the box wider */
.blog-intro-title-text {
  min-width: 0;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.blog-intro-description {
  line-height: 1.6;
}

/* Space between rich text paragraphs (the reset removed all margins) */
.blog-intro-description p + p {
  margin-top: var(--card-space);
}


/* ---------- 10. Blog cards ---------- */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
  margin: 3rem 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--card-space);          /* same space between every item in the card */
  padding: 2rem;
  background-color: var(--color-surface);
  border-radius: 1.2rem;
}

/* Category badges (also used on the blog detail page) */
.card-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.card-category {
  display: inline-block;                    /* keeps padding even when it is a link */
  background-color: var(--color-badge-bg);
  color: var(--color-white);
  font-size: 1.3rem;
  line-height: 1.4;
  padding: 0.4rem 1.4rem;
  border-radius: var(--radius-pill);        /* fully rounded (pill) */
  transition: background-color 0.2s ease;   /* smooth hover color change */
}

/* Category is now a link: keep the text white on hover (a:hover would turn it grey) */
.card-category:hover {
  color: var(--color-white);
  background-color: var(--color-badge-hover);   /* uses the role, so dark mode can differ */
}

/* Featured image (16:9 ratio) */
.card-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.8rem;
}

/* Title and excerpt (the date is now .post-date in section 15) */
.card-title {
  font-size: 2.4rem;
  line-height: 1.3;
}

.card-excerpt {
  line-height: 1.6;
}

/* Read more link (margin-top: auto keeps it at the bottom of the card) */
.card-link {
  color: var(--color-link);
  font-weight: 600;
  margin-top: auto;
}

.card-link:hover {
  color: var(--color-link-hover);
}


/* ---------- 10b. Pagination ---------- */
/* Used by includes/pagination.html on the blog index, categories, tags, authors and search pages.
   Mobile first: ONE row in one box (same look as .breadcrumb):  (‹)  1 2 3 4  (›)
   Previous and Next are round arrow buttons on the phone; their words stay in the HTML for
   screen readers. Tablet and desktop show the words "Previous" and "Next" (see section 18). */
.pagination {
  display: flex;
  align-items: center;                      /* arrows and numbers share the same middle line */
  justify-content: space-between;           /* arrows on the edges, numbers in the middle */
  gap: 0.8rem;                              /* space between the arrows and the numbers */
  margin: 0 0 3rem;                         /* the card list above already has 3rem below it, so only space BELOW is needed */
  padding: var(--card-space) 1.2rem;        /* a little less side space than .breadcrumb, so more numbers fit on a small phone */
  background-color: var(--color-surface);   /* white (light) or dark grey (dark), like the cards */
  border-radius: 1.2rem;                    /* same rounded corners as the cards */
}

/* The list of page numbers: takes all the space between the two arrows */
.pagination-list {
  flex: 1 1 auto;                           /* fill the free space */
  min-width: 0;                             /* lets the list shrink instead of pushing the arrows out */
  display: flex;
  flex-wrap: wrap;                          /* a long list wraps instead of overflowing the screen */
  justify-content: center;                  /* numbers in the middle */
  align-items: center;
  gap: 0.4rem;                              /* tight space between the numbers */
}

/* No Previous link (page 1): the list is the FIRST element in the nav, so the numbers start at the left edge.
   No Next link (last page): the list is the LAST element in the nav, so the numbers end at the right edge.
   On every other page both arrows exist, so the numbers stay in the middle. */
.pagination > .pagination-list:first-child {
  justify-content: flex-start;
}

.pagination > .pagination-list:last-child {
  justify-content: flex-end;
}

/* Previous and Next: a round outlined button with an arrow on the phone */
.pagination-link {
  display: inline-flex;
  align-items: center;                      /* arrow in the vertical middle */
  justify-content: center;                  /* arrow in the horizontal middle */
  flex: 0 0 auto;                           /* keep its own size, never squeezed */
  width: 3.6rem;                            /* same size as a number ... */
  height: 3.6rem;                           /* ... so the row stays level, and the shape is a true circle */
  padding: 0;
  border: 2px solid var(--color-link);      /* light teal in dark mode, because --color-link changes with the theme */
  border-radius: var(--radius-pill);        /* fully rounded */
  color: var(--color-link);
  font-size: 2.4rem;                        /* a clear arrow */
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease;   /* smooth hover */
  -webkit-tap-highlight-color: transparent; /* removes the colored flash when tapping */
}

/* The arrow character: aria-hidden in the HTML, so screen readers skip it */
.pagination-link-arrow {
  display: block;
  line-height: 1;
  transform: translateY(-0.1rem);           /* the arrow glyph sits a little low: this centers it optically */
}

/* The words "Previous" / "Next": hidden from the eyes on the phone, kept for screen readers
   (same technique as .visually-hidden; tablet shows them again, see section 18) */
.pagination-link-text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Hover and keyboard focus: fill with the link color, card color for the text
   (a:hover would turn the text grey, so the color is set here too) */
.pagination-link:hover,
.pagination-link:focus-visible {
  background-color: var(--color-link);
  color: var(--color-surface);              /* readable in both themes (same as the tags) */
}

/* Clear outline for keyboard users (Tab key) */
.pagination-link:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
}

/* One page number (a link, or the current page as plain text) */
.pagination-number {
  display: inline-flex;
  align-items: center;                      /* number in the vertical middle */
  justify-content: center;                  /* number in the horizontal middle */
  min-width: 3.6rem;                        /* smaller on the phone, so more numbers fit in one row */
  height: 3.6rem;                           /* same as min-width: a round shape for one digit */
  padding: 0 0.6rem;                        /* a number with two or three digits grows wider */
  border: 2px solid transparent;            /* invisible, so the current page (filled) has the same size */
  border-radius: var(--radius-pill);        /* fully rounded */
  color: var(--color-link);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;   /* smooth hover */
  -webkit-tap-highlight-color: transparent; /* removes the colored flash when tapping */
}

/* Hover and keyboard focus on a number link: outline in the link color */
a.pagination-number:hover,
a.pagination-number:focus-visible {
  border-color: var(--color-link);
  color: var(--color-link);                 /* a:hover would turn the text grey */
}

/* Clear outline for keyboard users (Tab key) */
a.pagination-number:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
}

/* The page you are on: filled, so it is clearly different from the links */
.pagination-number--current {
  background-color: var(--color-link);
  border-color: var(--color-link);
  color: var(--color-surface);              /* card color for the text: readable in both themes */
}

/* The "…" between skipped pages: muted text, not a link */
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 3.6rem;                           /* same height as the numbers, so the row stays level */
  color: var(--color-text-muted);
  font-size: 1.6rem;
}


/* ---------- 11. Blog detail (single article) ---------- */
.article {
  display: flex;
  flex-direction: column;
  gap: var(--card-space);
  margin: 3rem 0;
  padding: 2rem;
  background-color: var(--color-surface);
  border-radius: 1.2rem;
}

.article-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.8rem;
}

.article-title {
  font-size: 3.2rem;
  line-height: 1.3;
}

/* Back link */
.article-back {
  color: var(--color-link);
  font-weight: 600;
}

.article-back:hover {
  color: var(--color-link-hover);
}


/* ---------- 11a. Breadcrumb (blog detail) ---------- */
/* Same box as .blog-intro: white surface, 1.2rem rounded corners, 2rem side space.
   Sits above the article, so the bottom space matches the 2.4rem gap between cards. */
.breadcrumb {
  margin: 0 0 2.4rem;
  padding: var(--card-space) 2rem;
  background-color: var(--color-surface);
  border-radius: 1.2rem;
}

/* The list: one row, wraps to a new line on small screens */
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.4rem;   /* same size as .post-date on mobile */
}

/* One step: link + chevron side by side */
.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Link: house icon (Home only) and text on one line */
.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text-muted);
}

/* Teal on hover and keyboard focus (a:hover would turn it grey) */
.breadcrumb-link:hover,
.breadcrumb-link:focus-visible {
  color: var(--color-link);
}

/* Chevron between steps: light grey so it does not compete with the text */
.breadcrumb-separator {
  display: flex;
  color: var(--color-icon-muted);   /* uses the role, so dark mode can differ */
}

/* Current page: normal text color, bold, long titles wrap */
.breadcrumb-current {
  min-width: 0;
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

/* The article has its own 3rem top margin; the breadcrumb already supplies the space */
.breadcrumb + .article {
  margin-top: 0;
}


/* ---------- 11b. Post navigation (previous / next article) ---------- */
/* Sits under the article card on the blog detail page.
   Previous and Next are TWO separate boxes (cards), not one box with two links inside.
   The wrapper only does the layout: it has no background, no padding and no border.
   Mobile first: the two boxes are stacked (previous on top, next below).
   Tablet and desktop put them side by side (see section 18). */
.post-navigation {
  display: flex;
  flex-direction: column;                   /* phone: one box under the other */
  gap: 2.4rem;                              /* same space as between the blog cards */
  margin: 0 0 3rem;                         /* the article above already has 3rem below it, so only space BELOW is needed */
}

/* One box: the whole card is clickable. Same look as the other cards, no border line */
.post-navigation-link {
  display: flex;
  flex-direction: column;                   /* label on top, title below */
  gap: 0.4rem;                              /* tight space between label and title */
  padding: 2rem;                            /* same inner space as .card and .article */
  background-color: var(--color-surface);   /* white (light) or dark grey (dark), like the cards */
  border-radius: 1.2rem;                    /* same rounded corners as the cards */
  color: var(--color-text);                 /* a:hover would turn the text grey, so the color is set here too */
  transition: background-color 0.2s ease;   /* smooth hover */
  -webkit-tap-highlight-color: transparent; /* removes the colored flash when tapping */
}

/* Next box: text aligned to the right, so it feels like a "forward" link.
   This is in the base styles, so it also works on the phone. */
.post-navigation-link--next {
  text-align: right;
}

/* Hover and keyboard focus: the box gets the same subtle background as the round header buttons */
.post-navigation-link:hover,
.post-navigation-link:focus-visible {
  background-color: var(--color-btn-bg);
  color: var(--color-text);                 /* text stays readable, only the background changes */
}

/* Clear outline for keyboard users (Tab key) */
.post-navigation-link:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
}

/* Small direction text: "Previous post" / "Next post" */
.post-navigation-label {
  font-size: 1.4rem;                        /* same size as .post-date */
  color: var(--color-text-muted);
}

/* The title of the other post: bold, link color on hover */
.post-navigation-title {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;                  /* a very long word wraps instead of breaking the layout */
}

.post-navigation-link:hover .post-navigation-title,
.post-navigation-link:focus-visible .post-navigation-title {
  color: var(--color-link);                 /* teal title when the box is hovered */
}


/* ---------- 11c. Related posts (blog detail) ---------- */
/* Sits under the post navigation on the blog detail page.
   The cards are the normal .card from section 10, so they already have the white background,
   the rounded corners, the badges, the image, the meta, the excerpt and the "Read more" link.
   This section only adds the heading and the grid.
   Mobile first: one column. Tablet: two columns. Desktop: three columns (see sections 18 and 19). */
.related-posts {
  display: flex;
  flex-direction: column;       /* heading on top, grid below */
  gap: var(--card-space);       /* same space as inside the cards */
  margin: 0 0 3rem;             /* the post navigation above already has 3rem below it, so only space BELOW is needed */
}

/* Section heading: "Related posts" */
.related-posts-title {
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-heading);  /* purple in light mode, white in dark mode */
}

/* The grid: one column on the phone.
   minmax(0, 1fr) lets a column shrink, so a long word can never push the page wider. */
.related-posts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* phone: one column */
  gap: 2.4rem;                             /* same space as between the blog cards */
}

/* Smaller title than the 2.4rem of the big cards, so three cards fit side by side.
   Two classes make this rule stronger than the single .card-title rule in section 10. */
.related-posts .card-title {
  font-size: 2rem;
  overflow-wrap: anywhere;      /* a very long word wraps instead of breaking the layout */
}

/* Title link: link color on hover and keyboard focus (a:hover would turn it grey) */
.related-posts .card-title a:hover,
.related-posts .card-title a:focus-visible {
  color: var(--color-link);
}

/* Clear outline for keyboard users (Tab key) */
.related-posts .card-title a:focus-visible,
.related-posts .card-link:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 0.2rem;
}


/* ---------- 12. Article content (rich text) ---------- */
/* The reset removed margins and list bullets,
   so we add them back only inside the article. */
.article-content {
  line-height: 1.7;
}

.article-content > * + * {
  margin-top: var(--card-space);   /* same space between every block */
}

.article-content h2 {
  font-size: 2.6rem;
  line-height: 1.3;
  margin-top: 3.2rem;
}

.article-content h3 {
  font-size: 2.1rem;
  line-height: 1.3;
  margin-top: 2.4rem;
}

.article-content ul,
.article-content ol {
  padding-left: 2.4rem;
}

.article-content ul li {
  list-style-type: disc;
}

.article-content ol li {
  list-style-type: decimal;
}

.article-content a {
  color: var(--color-link);
  text-decoration: underline;
}

.article-content a:hover {
  color: var(--color-link-hover);
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.8rem;
}


/* ---------- 13. Tags (blog cards and article) ---------- */
/* Row of tags under a card or article (wraps on small screens) */
.card-tags,
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;                              /* tight space between tags */
}

/* One tag pill (outlined, fully rounded) */
.card-tag,
.article-tag {
  display: inline-block;
  font-size: 1.2rem;
  line-height: 1.4;
  padding: 0.2rem 1rem;
  border: 1px solid var(--color-link);
  border-radius: var(--radius-pill);        /* fully rounded (pill) */
  color: var(--color-link);
  transition: background-color 0.2s ease, color 0.2s ease;   /* smooth hover */
}

/* Hover and keyboard focus: fill with the link color, card color for the text */
.card-tag:hover,
.card-tag:focus-visible,
.article-tag:hover,
.article-tag:focus-visible {
  color: var(--color-surface);              /* text uses the card color, readable in both themes */
  background-color: var(--color-link);
}


/* ---------- 14. Author profile ---------- */
/* Shared base (mobile: image on top, text below) */
.author-profile {
  padding: 2rem;
  background-color: var(--color-surface);
  border-radius: 1.2rem;
}

.author-profile-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-heading);   /* purple in light mode, white in dark mode */
  margin-bottom: var(--card-space);
}

.author-profile-body {
  display: flex;
  flex-direction: column;
  gap: var(--card-space);
}

.author-photo {
  display: block;
  width: 100%;
  max-width: 16rem;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 0.8rem;
}

.author-profile-text {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.author-name {
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.author-description {
  line-height: 1.6;
}

.author-link {
  color: var(--color-link);
  font-weight: 600;
}

.author-link:hover {
  color: var(--color-link-hover);
}

/* In the main content (home page) */
.page-main .author-profile {
  margin: 3rem 0;   /* same outer space as the blog cards */
}

/* In the sidebar: title gets a bottom border, same as the other sidebar widgets */
.sidebar .author-profile-title {
  padding-bottom: 1.2rem;                          /* space between text and border */
  border-bottom: 1px solid var(--color-border);    /* soft line under the title */
}

/* everything centered: round image, name, bio, link */
.sidebar .author-profile-body {
  align-items: center;
  text-align: center;
}

.sidebar .author-photo {
  width: 14rem;
  border-radius: 50%;   /* round image */
}

.sidebar .author-profile-text {
  align-items: center;
}


/* ---------- 15. Post meta (author photo + name + date) ---------- */
/* Used on every post card (blog index, categories, tags, authors)
   and on the blog detail page.
   One row at every screen size: [photo] Name · Date */
.post-meta {
  display: flex;
  flex-wrap: wrap;            /* wraps only if the row runs out of space */
  align-items: center;        /* photo, name and date share the same middle line */
  gap: 0.8rem;
}

/* Author chip: photo + name (a link when the Authors page exists) */
.post-author {
  display: flex;
  align-items: center;        /* photo and name on the same line */
  gap: 0.8rem;                /* space between photo and name */
}

/* Small round avatar with a teal border */
.post-author-photo {
  display: block;
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;                              /* never squeeze the photo in the flex row */
  object-fit: cover;                           /* crop instead of stretching */
  border: 2px solid var(--color-secondary);    /* 2px Wagtail teal (#007d7e) border */
  border-radius: 50%;                          /* round image, same as the sidebar author */
}

.post-author-name {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text);   /* normal text color, not muted */
}

/* Hover and keyboard focus anywhere on the chip: teal name (a:hover would turn it grey) */
a.post-author:hover .post-author-name,
a.post-author:focus-visible .post-author-name {
  color: var(--color-link);
}

.post-date {
  font-size: 1.4rem;
  color: var(--color-text-muted);
}

/* Dot between author and date; only shows when an author exists */
.post-author + .post-date::before {
  content: "·";               /* middle dot separator */
  margin-right: 0.8rem;       /* space between the dot and the date */
}


/* ---------- 16. Author box (end of article, for later) ---------- */
/* Not used yet: kept for when the author box is added back under the post */
/* Mobile: photo on top, text below. The row layout is in the tablet section. */
.author-box {
  display: flex;
  flex-direction: column;
  gap: var(--card-space);                   /* the article gap already adds space above */
  padding: 2rem;
  background-color: var(--color-bg);        /* light grey box inside the white article */
  border-radius: 0.8rem;
}

.author-box-photo {
  display: block;
  width: 9.6rem;
  height: 9.6rem;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 50%;                       /* round image */
}

.author-box-body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.author-box-label {
  font-size: 1.3rem;
  color: var(--color-text-muted);
}

.author-box-name {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-heading);              /* purple in light mode, white in dark mode */
}

.author-box-bio {
  line-height: 1.6;
}

.author-box-link {
  color: var(--color-link);
  font-weight: 600;
}

.author-box-link:hover {
  color: var(--color-link-hover);
}


/* ---------- 17. Authors index (grid of author cards) ---------- */
/* Authors index (/authors/): grid of author cards.
   The page heading uses .blog-intro, the same as categories and tags. */
.author-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);    /* mobile: one column */
  gap: 2.4rem;                              /* same space as .card-list */
  margin: 3rem 0;
}

.author-card {
  display: flex;
  flex-direction: column;
  align-items: center;                      /* everything centered */
  text-align: center;
  gap: 0.8rem;
  padding: 2rem;
  background-color: var(--color-surface);
  border-radius: 1.2rem;
}

.author-card-photo {
  display: block;
  width: 9.6rem;
  height: 9.6rem;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 0.8rem;                    /* extra room under the photo */
}

.author-card-name {
  font-size: 2.2rem;
  line-height: 1.3;
}

.author-card-count {
  font-size: 1.4rem;
  color: var(--color-text-muted);           /* "3 posts" like a date */
}


/* ---------- 17b. Dark mode overrides (stronger selectors) ---------- */
/* No longer depends on one class name. Any heading inside the sidebar,
   or any element whose class contains "title", gets the heading color.
   [data-theme="dark"] + .sidebar + the element = more weight than a normal
   one-class rule, even one that loads later (for example from block.css). */
[data-theme="dark"] .sidebar h1,
[data-theme="dark"] .sidebar h2,
[data-theme="dark"] .sidebar h3,
[data-theme="dark"] .sidebar h4,
[data-theme="dark"] .sidebar h5,
[data-theme="dark"] .sidebar h6,
[data-theme="dark"] .sidebar [class*="title"],
[data-theme="dark"] .page-main .author-profile-title {
  color: var(--color-heading);                     /* white */
  border-bottom-color: var(--color-border);        /* soft dark line, not bright white */
}

/* Any horizontal line inside the sidebar uses the soft border color */
[data-theme="dark"] .sidebar hr {
  border-color: var(--color-border);
  background-color: var(--color-border);
}

/* Titles of the posts in the "Latest Posts" widget stay in the normal text color */
[data-theme="dark"] .sidebar a {
  color: var(--color-text);
}

[data-theme="dark"] .sidebar a:hover {
  color: var(--color-link);
}


/* =====================================================
   MEDIA QUERIES (all small-screen styles are above)
   ===================================================== */

/* ---------- 18. Tablet (768px and wider) ---------- */
@media screen and (min-width: 768px) {

  /* Header */
  .site-logo {
    flex-basis: auto;
  }

  /* Footer menu: back to the normal size and spacing on tablet and desktop */
  .footer-menu {
    gap: 2rem;
    padding: 1.5rem;
    font-size: 1.8rem;
    line-height: normal;
  }

  /* Logo: no change on tablet and desktop. It keeps the same size and spacing as on the phone
     (4.4rem image, 1.4rem above and below), so the header is 7.2rem high at every screen size. */

  /* The menu drawer becomes a normal row of links in the header again.
     The search drawer is not touched: it stays a full-width slider. */
  .header-nav {
    position: static;           /* back in the normal page flow */
    z-index: auto;              /* IMPORTANT: inside a flex row, z-index works even on a static item,
                                   so the phone value (1000) would make the menu a top layer that can
                                   paint over the search drawer. "auto" puts the menu back in the normal layer. */
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    height: auto;
    overflow: visible;          /* the dropdown must be allowed to leave the header */
    background-color: transparent;   /* the header already has its own background */
    transform: none;            /* no more sliding */
    visibility: visible;
    transition: none;
  }

  /* While the search drawer is open, the menu links, the CTA buttons and the dropdowns
     are hidden, so they can never show in front of the search drawer.
     Two rules do the same job, so it works even if one way is not available:
     1) JavaScript adds body.menu-open when a drawer opens.
     2) :has() looks if an open search drawer exists inside the header (no JavaScript needed).
     They are separate rules on purpose: if a browser does not know :has(), it must not break rule 1. */
  body.menu-open .header-nav {
    visibility: hidden;                      /* hidden: cannot be seen or reached with the Tab key */
    transition: visibility 0s linear 0.3s;   /* wait 0.3s (the drawer slide time), then hide with no fade */
  }

  .site-header:has(.search-drawer.open) .header-nav {
    visibility: hidden;                      /* same as above, without JavaScript */
    transition: visibility 0s linear 0.3s;
  }

  /* In the menu, the top bar is only for the phone drawer.
     The search drawer keeps its own top bar at every screen size. */
  .header-nav .drawer-top {
    display: none;
  }

  /* The search field is already centered in the base styles (section 6b),
     so it needs nothing here. */

  .header-nav .nav-menu {
    display: flex;
    flex-direction: row;        /* links side by side again */
    gap: 0;                     /* the drawer gap is not needed: the items have a left margin */
    padding: 0;                 /* remove the drawer spacing */
    overflow: visible;
  }

  .header-nav .menu-item {
    display: inline-block;
    margin: 0 0 0 2rem;         /* space between links */
  }

  .header-nav .item-link {
    display: inline;            /* back to a normal text link */
    padding: 0;
    font-size: inherit;         /* same size as the body text */
    line-height: inherit;
  }

  .toggle-btn {
    display: none;      /* no button on desktop */
  }

  /* CTA buttons: a row on the right of the menu links */
  .header-nav .cta-menu {
    flex-direction: row;         /* side by side */
    align-items: center;         /* same middle line as the menu links */
    gap: 2rem;
    margin-left: 2rem;           /* same space as between the menu links */
    padding: 0;                  /* remove the drawer spacing */
  }

  .cta-button {
    width: auto;                 /* only as wide as the text */
    min-height: 3.5rem;          /* same height as the round search and theme buttons */
    padding: 0 1.6rem;
    white-space: nowrap;         /* a button text never wraps to two lines */
  }

  /* Bold text style on desktop: same size as the menu links, no side space
     (it comes after the rule above, so it wins over its padding) */
  .cta-button--bold_text {
    padding: 0;
    font-size: inherit;
  }

  /* --- Submenus on desktop ---
     Level 2 = a dropdown box under the menu item.
     Level 3 = its OWN box that opens beside the level 2 box.
     Level 4 = its OWN box that opens beside the level 3 box.
     JavaScript adds .menu-item--flip when a box would leave the screen on the right. */

  /* The phone height animation is switched off here: on desktop the box is "display: none"
     when closed and "display: flex" when open (rule below), with its own fade (submenu-in) */
  .header-nav .submenu {
    display: none;               /* closed: not shown */
    height: auto;                /* no fixed height on desktop */
    overflow: visible;           /* the box shadow and nested boxes must be allowed to show */
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }

  .header-nav .menu-item.open > .submenu {
    display: flex;               /* open: shown */
    transition: none;            /* undo the phone transition */
  }

  /* The phone spacing on the first and last item is not needed in the boxes
     (the box has its own padding) */
  .header-nav .submenu > .menu-item:first-child,
  .header-nav .submenu > .menu-item:last-child {
    padding: 0;
  }

  /* Level 1, 2 and 3 items: their boxes are placed relative to them */
  .header-nav .menu-item--level-1,
  .header-nav .menu-item--level-2,
  .header-nav .menu-item--level-3 {
    position: relative;
  }

  /* Level 1 row: text and chevron side by side, close together */
  .header-nav .menu-row {
    display: inline-flex;
    justify-content: flex-start;   /* no more "far right": the chevron sits next to the text */
    gap: 0.2rem;
  }

  .header-nav .menu-row .item-link {
    flex: 0 1 auto;                /* the link is only as wide as its text */
  }

  /* Chevron button: small square next to the text */
  .header-nav .submenu-toggle {
    justify-content: center;       /* icon in the middle of the square */
    width: 2.4rem;
    height: 2.4rem;
    margin: 0;                     /* no pull-back needed on desktop */
    border-radius: 0.4rem;
  }

  /* Level 1 parent without a link: the whole button is "Text + chevron" in one line */
  .header-nav .menu-item--level-1 > .menu-row > .submenu-toggle--text {
    flex: 0 1 auto;
    width: auto;
    height: auto;
    justify-content: flex-start;
    gap: 0.4rem;                   /* space between text and chevron */
    padding: 0;
    font-size: inherit;
    line-height: inherit;
  }

  /* Hover on a level 1 text button: same grey as links */
  .header-nav .menu-item--level-1 > .menu-row > .submenu-toggle--text:hover {
    color: var(--color-text-muted);
  }

  /* Chevron size on desktop level 1 */
  .header-nav .submenu-icon {
    width: 1.6rem;
    height: 1.6rem;
  }

  /* All dropdown boxes (level 2, 3 and 4) look exactly the same:
     same space inside, same radius, same shadow, NO border line */
  .header-nav .submenu--level-2,
  .header-nav .submenu--level-3,
  .header-nav .submenu--level-4 {
    position: absolute;                          /* floats over the page, beside or under its parent */
    z-index: 50;                                 /* above the page content */
    min-width: var(--dropdown-width);
    padding: var(--dropdown-space);              /* same space on all four sides */
    gap: 0.2rem;                                 /* small gap between items */
    background-color: var(--color-dropdown-bg);  /* same as the cards in light mode, lighter grey in dark mode */
    border-radius: var(--dropdown-radius);       /* same rounded corners as the cards */
    box-shadow: var(--shadow-dropdown);          /* soft shadow (light) or soft edge + deep shadow (dark) */
  }

  /* Level 2 box: under its parent, left edges lined up */
  .header-nav .submenu--level-2 {
    top: calc(100% + 1.6rem);                    /* small gap under the menu text */
    left: 0;                                     /* starts at the left edge of the parent */
  }

  /* Level 3 and level 4 boxes: beside the box of their parent item, on the right.
     100% = width of the parent item, + the box padding, + the gap between the two boxes.
     The negative top moves it up, so its first item lines up with the parent item. */
  .header-nav .submenu--level-3,
  .header-nav .submenu--level-4 {
    top: calc(var(--dropdown-space) * -1);
    left: calc(100% + var(--dropdown-space) + var(--dropdown-gap));
  }

  /* FLIP (class added by JavaScript when the box does not fit on the right):
     level 2 box lines up with the RIGHT edge of its parent and grows to the left */
  .header-nav .menu-item--level-1.menu-item--flip > .submenu--level-2 {
    left: auto;
    right: 0;
  }

  /* FLIP: level 3 and level 4 boxes open on the LEFT side of the box of their parent item */
  .header-nav .menu-item--level-2.menu-item--flip > .submenu--level-3,
  .header-nav .menu-item--level-3.menu-item--flip > .submenu--level-4 {
    left: auto;
    right: calc(100% + var(--dropdown-space) + var(--dropdown-gap));
  }

  /* Smooth fade when a box opens */
  .header-nav .menu-item--level-1.open > .submenu--level-2,
  .header-nav .menu-item--level-2.open > .submenu--level-3,
  .header-nav .menu-item--level-3.open > .submenu--level-4 {
    animation: submenu-in 0.2s ease;
  }

  @keyframes submenu-in {
    from {
      opacity: 0;
      transform: translateY(-0.4rem);   /* starts a little higher */
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  /* Items inside the boxes (level 2, 3 and 4): block rows with the same space and radius */
  .header-nav .submenu .menu-item {
    display: block;                /* undo the inline-block of the top row */
    margin: 0;                     /* undo the left margin of the top row */
  }

  .header-nav .submenu .menu-row {
    display: flex;                 /* full-width row, so the chevron can sit on the right */
    justify-content: space-between;
    gap: 0.4rem;
  }

  .header-nav .submenu .menu-row .item-link {
    flex: 1;                       /* the link fills the row */
  }

  .header-nav .submenu .item-link {
    display: block;
    padding: 0.8rem 1.2rem;        /* same space for every dropdown item */
    border-radius: var(--dropdown-item-radius);
    font-size: 1.6rem;             /* one size for every level inside the boxes on desktop */
    line-height: 1.4;
    transition: background-color 0.2s ease;
  }

  /* Parent without a link inside a box: full-width button, text left, chevron right */
  .header-nav .submenu .submenu-toggle--text {
    flex: 1;
    width: 100%;
    height: auto;
    margin: 0;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    border-radius: var(--dropdown-item-radius);
    font-size: 1.6rem;
    line-height: 1.4;
  }

  /* Chevron button next to a link inside a box: a little bigger to click.
     It has NO background (not even on hover): the base rule already sets "background: none". */
  .header-nav .submenu .menu-row > .submenu-toggle:not(.submenu-toggle--text) {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: var(--dropdown-item-radius);
  }

  /* Hover on a dropdown item (link or text button): subtle background, text stays readable.
     The chevron-only button is NOT in this rule, so it gets no hover background. */
  .header-nav .submenu .item-link:hover {
    background-color: var(--color-dropdown-item-hover);   /* light grey (light) or lighter grey (dark) */
    color: var(--color-text);
  }

  /* Round buttons move after the menu, on the right side */
  .search-btn,
  .theme-btn {
    order: 1;                    /* the menu has order 0, so these come after it */
  }

  /* Same space as between menu items, so it does not touch "Contact" */
  .search-btn {
    margin-left: 2rem;
  }

  /* The 0.8rem gap already comes from the search button */
  .theme-btn {
    margin-left: 0;
  }

  /* Blog intro: image left, text right */
  .blog-intro {
    flex-direction: row;
    align-items: center;
  }

  .blog-intro-image {
    flex: 0 0 40%;
    width: 40%;
  }

  .blog-intro-text {
    flex: 1;
  }

  /* Breadcrumb and blog intro title: slightly larger text (always the same size as each other) */
  .breadcrumb-list,
  .blog-intro-title {
    font-size: 1.6rem;
  }

  /* Post navigation: previous box on the left, next box on the right */
  .post-navigation {
    flex-direction: row;                    /* the two boxes side by side */
    justify-content: space-between;         /* previous at the left edge, next at the right edge */
  }

  .post-navigation-link {
    flex: 1 1 0;                            /* both boxes share the width equally */
    max-width: calc(50% - 1.2rem);          /* a single box never stretches over the full width (1.2rem = half of the 2.4rem gap) */
  }

  /* Previous box: always at the left edge (also when there is no next box) */
  .post-navigation-link--previous {
    margin-right: auto;
  }

  /* Next box: always at the right edge (also when there is no previous box).
     The right-aligned text comes from the base styles. */
  .post-navigation-link--next {
    margin-left: auto;
  }

  /* Related posts: two columns on tablet */
  .related-posts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Pagination: [Previous]  1 2 3 4 5  [Next]  (the words come back, the arrows go away) */
  .pagination {
    gap: 2rem;                   /* more space between the links and the numbers */
    padding: var(--card-space) 2rem;   /* same side space as .breadcrumb */
  }

  .pagination-list {
    gap: 0.6rem;
  }

  /* The round arrow button becomes a pill with the word inside */
  .pagination-link {
    width: auto;                 /* as wide as the word */
    height: auto;
    min-height: 4.4rem;          /* easy to tap with a finger (44px) */
    padding: 0 2.4rem;           /* roomier pill */
    font-size: 1.6rem;           /* normal text size, not the big arrow size */
  }

  .pagination-link-arrow {
    display: none;               /* the arrow is only for the phone */
  }

  /* Show the word again: undo every line of the "hidden for the eyes" technique */
  .pagination-link-text {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip-path: none;
    white-space: nowrap;         /* the word never breaks into two lines */
  }

  .pagination-number {
    min-width: 4.4rem;           /* easy to tap with a finger (44px) */
    height: 4.4rem;
  }

  .pagination-ellipsis {
    height: 4.4rem;              /* same height as the numbers */
  }

  /* Author profile in main content: image left, name + bio + link right */
  .page-main .author-profile-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .page-main .author-photo {
    flex: 0 0 16rem;
    width: 16rem;
  }

  .page-main .author-profile-text {
    flex: 1;
  }

  /* Author box: photo left, text right */
  .author-box {
    flex-direction: row;
    align-items: flex-start;
  }

  /* Authors index: two columns */
  .author-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* ---------- 19. Desktop (1024px and wider) ---------- */
@media screen and (min-width: 1024px) {

  /* Content on the left, 300px sidebar on the right (sidebar is NOT sticky) */
  .page-layout {
    grid-template-columns: minmax(0, 1fr) 30rem;
  }

  /* Authors index: three columns */
  .author-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Related posts: three columns on desktop */
  .related-posts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Author box: a little more space on large screens */
  .author-box {
    padding: 2.4rem;
  }
}


/* ---------- 19b. Reduced motion ---------- */
/* For people who set "reduce motion", the drawers appear without sliding,
   the submenus open without animation, the dropdown boxes appear without fading,
   the chevron turns without animation, and the CTA buttons, pagination links
   and post navigation links change color without fading. */
@media (prefers-reduced-motion: reduce) {
  .header-nav,
  .header-nav.open,
  .search-drawer,
  .search-drawer.open {
    transition: none;
  }

  .header-nav .submenu-icon {
    transition: none;
  }

  .header-nav .submenu,
  .header-nav .menu-item.open > .submenu {
    transition: none;
  }

  .cta-button,
  .pagination-link,
  .pagination-number,
  .post-navigation-link {
    transition: none;
  }

  .header-nav .menu-item--level-1.open > .submenu--level-2,
  .header-nav .menu-item--level-2.open > .submenu--level-3,
  .header-nav .menu-item--level-3.open > .submenu--level-4 {
    animation: none;
  }
}


/* ---------- 20. Full width layout (home page, no sidebar) ---------- */
/* Keep this at the very end so it wins over the desktop rule above */
.page-layout.page-layout--full {
  grid-template-columns: minmax(0, 1fr);   /* always one column */
}