/* =====================================================
   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, desktop dropdown)
   7.   Footer
   8.   Sidebar
   9.   Blog intro (heading box)
   10.  Blog cards
   11.  Blog detail (single article)
   11a. Breadcrumb (blog detail)
   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 */

  /* --- 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) */
  --search-space: 3rem;        /* space around the search field: top, left and right are the same */

  /* --- Shape --- */
  --radius-pill: 10rem;        /* fully rounded ends for category badges and tags */

  /* --- Menu motion (phone) --- */
  --menu-transition: 0.2s ease;   /* speed of the chevron turn AND the submenu fade: change here to change both */

  /* --- 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 */

  --shadow-dropdown: 0 0.4rem 1.6rem rgba(38, 38, 38, 0.08);   /* soft, subtle shadow instead of a border line */}


/* ---------- 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%;
}

/* 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 */
.site-logo {
  flex: 1;   /* grow to fill all space left over, so the buttons stay on the right */
}

.logo-text {
  display: flex;
  flex-flow: column;
  line-height: 1;
  padding: 2.4rem 0;
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 600;
  display: block;
  width: 100%;
}

.logo-tagline {
  font-size: 1.3rem;
  font-weight: normal;
  display: block;
  width: 100%;
}

/* 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 */
}

/* 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 */
}

.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;
  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 */
}

/* Space around the search field, under the top bar.
   Phone: the field stays at the top, with the SAME space above, left and right (--search-space).
   Tablet and desktop center it (see section 18). */
.search-drawer-body {
  width: 100%;
  max-width: 72rem;              /* the field does not stretch too wide on big screens */
  margin: 0 auto;                /* centered when the screen is wider than 72rem */
  padding: var(--search-space);  /* same space on all four sides: top, left, right and bottom */
}

/* While a drawer is open, the page behind it must not scroll (JavaScript adds this class) */
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). */

/* 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 fade) */
}

/* 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: hidden until its parent has .open.
   It fades and slides down a little when it opens, and fades out when it closes.
   "display" is also in the transition list (allow-discrete), so the list stays visible
   until the fade-out is finished. Older browsers without this feature simply show it instantly. */
.header-nav .submenu {
  display: none;                   /* closed: not shown and not reachable with the Tab key */
  flex-direction: column;          /* one link per row */
  gap: 0.4rem;                     /* same space between items as the main list */
  padding: 0.4rem 0 0.4rem 1.6rem; /* indent: each level moves a little to the right */
  opacity: 0;                      /* closed: fully see-through */
  transform: translateY(-0.4rem);  /* closed: a little higher than its final place */
  transition:
    opacity var(--menu-transition),
    transform var(--menu-transition),
    display var(--menu-transition) allow-discrete;   /* keeps "display: flex" until the fade-out ends */
}

.header-nav .menu-item.open > .submenu {
  display: flex;                   /* open: shown */
  opacity: 1;                      /* open: fully visible */
  transform: none;                 /* open: in its normal place */
}

/* Starting look of the opening animation: the list begins see-through and a little higher.
   (A list that was "display: none" has no "before" state, so we tell the browser where to start.) */
@starting-style {
  .header-nav .menu-item.open > .submenu {
    opacity: 0;
    transform: translateY(-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;
}


/* ---------- 7. Footer ---------- */
.footer-nav {
  background-color: var(--color-surface);   /* white footer */
}

.footer-menu {
  display: flex;
  justify-content: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 1.5rem;
  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);
}

.blog-intro-title {
  font-size: 2.8rem;
  line-height: 1.2;
}

.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);
}


/* ---------- 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;
}


/* ---------- 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;
  }

  /* 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 */
    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;
  }

  /* 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;
  }

  /* Search drawer: the search field is centered, horizontally AND vertically.
     The body grows to fill all the space under the top bar, and its content sits in the middle.
     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 */
    padding-bottom: calc(var(--search-space) + var(--drawer-top-height));   /* balances the top bar */
  }

  .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 */
  }

  /* --- 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 fade/slide is switched off here: the desktop boxes use their own fade (submenu-in) below */
  .header-nav .submenu {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* 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-surface);
    border-radius: var(--dropdown-radius);       /* same rounded corners as the cards */
    box-shadow: var(--shadow-dropdown);          /* soft shadow instead of a border line */
  }

  /* 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 grey 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-btn-bg);
    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: slightly larger text */
  .breadcrumb-list {
    font-size: 1.6rem;
  }

  /* 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));
  }

  /* 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 appear without fading, the dropdown boxes appear without fading,
   and the chevron turns without animation. */
@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 {
    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 */
}