/* CryptoBlog public site: Sahifa-style news magazine theme (SPEC 11), our own code.
   Boxed page on a subtly patterned background, dark menu bar and footer, condensed Oswald labels and
   section titles with a hatched rule, white boxes with a 1px border and a soft shadow, amber where Sahifa
   uses orange. Public Sans for UI, headlines and body text; Newsreader for the post subtitle and quotes.
   Rules: colours only from tokens.css (the theme variables below map to tokens). --accent is a fill behind
   --on-accent text; text links use --link. Hover feedback animates opacity or transform only.
   Mobile first. Breakpoints: 640, 768 (tablet), 1024 (desktop, sidebar beside the content), 1200. */

/* ============================================================== theme variables */

:root {
  --page: var(--surface-2);            /* page background around the box */
  --page-pattern: var(--bg);           /* lighter checks of the background pattern */
  --box: var(--surface);               /* the boxed page and its white boxes */
  --chrome: var(--on-accent);          /* dark menu bar and footer (stone 900) */
  --chrome-2: var(--text-2);           /* a step lighter: buttons on the dark bars */
  --chrome-line: var(--text-2);        /* dividers on the dark bars */
  --on-chrome: var(--surface);         /* text on the dark bars (17:1) */
  --on-chrome-2: var(--border-strong); /* quieter text on the dark bars (11.7:1) */
  --overlay: var(--on-accent);         /* image overlays, near-black in both themes */
  --on-overlay: var(--surface);
  --on-danger: var(--surface);         /* text on --danger, --info, --success fills (each >= 5:1) */
  --on-info: var(--surface);
  --on-success: var(--surface);
  --share-linkedin: var(--on-info-soft);
  --on-share-linkedin: var(--surface);
  --hatch: repeating-linear-gradient(-45deg, var(--border-strong) 0 1px, transparent 1px 4px);
  --r: 2px;                            /* Sahifa's near-square corners */
  --pad: clamp(16px, 2.5vw, 24px);     /* side padding inside the box */
  --gap: 32px;                         /* between the content column and the sidebar */
  --nav-h: 48px;
  --sidebar: 340px;
}

:root[data-theme="dark"] {
  --page: var(--bg);
  --page-pattern: var(--surface);
  --chrome: var(--bg);
  --chrome-2: var(--surface-3);
  --chrome-line: var(--border);
  --on-chrome: var(--text);
  --on-chrome-2: var(--text-2);
  --on-overlay: var(--text);
  --on-danger: var(--on-accent);
  --on-info: var(--on-accent);
  --on-success: var(--on-accent);
  --on-share-linkedin: var(--on-accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: var(--bg);
    --page-pattern: var(--surface);
    --chrome: var(--bg);
    --chrome-2: var(--surface-3);
    --chrome-line: var(--border);
    --on-chrome: var(--text);
    --on-chrome-2: var(--text-2);
    --on-overlay: var(--text);
    --on-danger: var(--on-accent);
    --on-info: var(--on-accent);
    --on-success: var(--on-accent);
    --on-share-linkedin: var(--on-accent);
  }
}

/* ============================================================== base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--page);
  /* The menu bar is sticky: keep jump targets clear of it. */
  scroll-padding-top: calc(var(--nav-h) + 4px + var(--space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--page);
  background-image:
    linear-gradient(45deg, var(--page-pattern) 25%, transparent 25%, transparent 75%, var(--page-pattern) 75%),
    linear-gradient(45deg, var(--page-pattern) 25%, transparent 25%, transparent 75%, var(--page-pattern) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

img,
svg,
iframe {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--link-hover);
}

button,
input {
  font: inherit;
  color: inherit;
}

button,
summary {
  cursor: pointer;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  text-wrap: balance;
}

p,
figure,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: var(--ring-offset);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

mark {
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 0.12em;
}

/* The hidden attribute always wins over component display rules (tab panels, headings, panels). */
[hidden] {
  display: none !important;
}

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

/* ============================================================== frame */

.site-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--container);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  border-top: 3px solid var(--accent);
  background: var(--box);
}

.container {
  width: 100%;
  padding-inline: var(--pad);
}

.site-main {
  flex: 1 0 auto;
  outline: none;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7) var(--gap);
  padding-block: var(--space-5) var(--space-8);
}

.page-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-6);
  min-width: 0;
}

/* White box with a hairline border and a soft shadow (Sahifa's content boxes). */
.box {
  border: 1px solid var(--border);
  background: var(--box);
  box-shadow: var(--shadow-sm);
}

/* Condensed uppercase section title with a hatched rule running to the right. */
.box-title,
.widget-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: nowrap;
}

.box-title::after,
.widget-title::after {
  content: '';
  flex: 1 1 auto;
  min-width: var(--space-6);
  height: 10px;
  background-image: var(--hatch);
}

.box-title a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: inherit;
  text-decoration: none;
}

/* 44px hit area without a taller title. */
.box-title a::after {
  content: '';
  position: absolute;
  inset: -6px -4px;
}

.box-title a:hover {
  color: var(--link);
}

.widget-title {
  font-size: 1.1875rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: var(--space-1);
  color: var(--text-3);
  font-size: 0.8125rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.meta .icon {
  flex-shrink: 0;
  margin-right: 5px;
}

.meta__sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 0.6em;
  border-radius: 50%;
  background: currentColor;
}

.meta a {
  color: var(--text-2);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.2em;
}

.meta a:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* State layer: hover and press feedback animate opacity only. */
.button::before,
.nav-tool::before,
.main-nav__home::before,
.main-nav__menu::before,
.main-nav__link::before,
.nav-more__link::before,
.topbar__submit::before,
.ticker__btn::before,
.social-tile::before,
.share-btn::before,
.share-bar__label::before,
.cat-box__more::before,
.tag::before,
.tag-cloud__link::before,
.tabs__tab::before,
.cat-list__link::before,
.pagination__num::before,
.pagination__link::before,
.post-nav__link::before,
.nav-search__submit::before,
.search-form__submit::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}

.button:hover::before,
.nav-tool:hover::before,
.main-nav__home:hover::before,
.main-nav__menu:hover::before,
.main-nav__link:hover::before,
.nav-more__link:hover::before,
.topbar__submit:hover::before,
.ticker__btn:hover::before,
.social-tile:hover::before,
.share-btn:hover::before,
.cat-box__more:hover::before,
.tag:hover::before,
.tag-cloud__link:hover::before,
.tabs__tab:hover::before,
.cat-list__link:hover::before,
.pagination__num:hover::before,
.pagination__link:hover::before,
.post-nav__link:hover::before,
.nav-search__submit:hover::before,
.search-form__submit:hover::before {
  opacity: 0.1;
}

.button:active::before,
.nav-tool:active::before,
.main-nav__link:active::before,
.ticker__btn:active::before,
.social-tile:active::before,
.share-btn:active::before,
.cat-box__more:active::before,
.pagination__num:active::before,
.pagination__link:active::before {
  opacity: 0.18;
}

.share-bar__label::before {
  display: none;
}

/* ============================================================== skip link */

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--on-accent);
}

/* ============================================================== buttons and tags */

.button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--box);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
}

.button:hover {
  color: var(--text);
}

.button--accent {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
}

.button--accent:hover {
  color: var(--on-accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
}

.tag {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  touch-action: manipulation;
}

.tag:hover {
  color: var(--text);
}

.tag .icon {
  color: var(--text-3);
}

/* 44px hit area for touch; the 8px gaps keep neighbours apart. */
.tag::after,
.tag-cloud__link::after {
  content: '';
  position: absolute;
  inset: -4px 0;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-block: var(--space-2);
  list-style: none;
}

.tag-cloud__link {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  touch-action: manipulation;
}

.tag-cloud__link:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.tag-cloud__link .icon {
  color: var(--text-3);
}

.tag-cloud__link--topic {
  background: var(--surface-2);
  color: var(--text);
}

.tag-cloud--large .tag-cloud__link {
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

/* ============================================================== top bar */

.topbar {
  display: none;
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding-left: var(--pad);
}

.topbar__date {
  flex-shrink: 0;
  padding-right: var(--space-3);
  border-right: 1px solid var(--border);
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__links {
  display: flex;
  list-style: none;
}

.topbar__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text-2);
  font-size: 0.8125rem;
  text-decoration: none;
  white-space: nowrap;
}

.topbar__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.topbar__link .icon {
  color: var(--text-3);
}

.topbar__social {
  display: none;
  margin-left: auto;
  list-style: none;
}

.topbar__social-link {
  display: grid;
  place-items: center;
  width: 36px;
  height: 44px;
  color: var(--text-3);
}

.topbar__social-link:hover {
  color: var(--text);
}

.topbar__search {
  display: flex;
  flex-shrink: 0;
  align-items: stretch;
  margin-left: auto;
}

.topbar__social + .topbar__search {
  margin-left: var(--space-2);
}

.topbar__input {
  width: 150px;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.875rem;
  -webkit-appearance: none;
  appearance: none;
}

.topbar__input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

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

.topbar__submit {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
}

.topbar__submit:focus-visible {
  outline-offset: -4px;
  outline-color: var(--on-accent);
}

/* ============================================================== header */

.header-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  padding: var(--space-4) var(--pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.brand__name {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}

.mark__tile {
  fill: var(--accent);
}

.mark__c {
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 4;
}

.mark__dot {
  fill: var(--on-accent);
}

.header-tagline {
  display: none;
  max-width: 26em;
  color: var(--text-2);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: right;
  text-wrap: balance;
}

.ad-slot {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
}

.ad-slot img {
  max-width: 100%;
  height: auto;
}

.ad-slot__label {
  margin-bottom: var(--space-2);
  color: var(--text-3);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot--header {
  flex: 1 1 100%;
}

/* ============================================================== main menu */

.main-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 4px solid var(--accent);
  background: var(--chrome);
  color: var(--on-chrome);
  --ring: var(--accent);
}

.main-nav__bar {
  display: flex;
  align-items: stretch;
  min-height: var(--nav-h);
  padding-right: var(--space-1);
}

.main-nav__home {
  position: relative;
  isolation: isolate;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
}

.main-nav__home:hover {
  color: var(--on-accent);
}

.main-nav__home:focus-visible {
  outline-color: var(--on-accent);
  outline-offset: -5px;
}

.main-nav__menu {
  position: relative;
  isolation: isolate;
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--nav-h);
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--on-chrome);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  touch-action: manipulation;
}

.main-nav__menu:hover {
  color: var(--on-chrome);
}

.js .main-nav__menu:not(.main-nav__menu--link),
html:not(.js) .main-nav__menu--link {
  display: inline-flex;
}

.menu-toggle__close,
.menu-toggle[aria-expanded="true"] .menu-toggle__open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__close {
  display: block;
}

.main-nav__list {
  display: none;
}

.main-nav__item {
  position: relative;
  display: flex;
}

.main-nav__link {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--nav-h);
  padding: 0 14px;
  color: var(--on-chrome);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.main-nav__link:hover {
  color: var(--on-chrome);
}

.main-nav__item + .main-nav__item > .main-nav__link,
.main-nav__item + .main-nav__item .nav-more__toggle {
  box-shadow: inset 1px 0 var(--chrome-line);
}

.main-nav__link[aria-current],
.nav-more__toggle.is-current {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

.main-nav__link[aria-current]:focus-visible,
.nav-more__toggle.is-current:focus-visible {
  outline-color: var(--on-accent);
}

.main-nav__link:focus-visible {
  outline-offset: -4px;
}

/* "More" menu: a disclosure (<details>), so it opens with a tap, a click, Enter or Space even without
   JavaScript; site.js closes it on Escape, an outside click or when focus leaves. */
.nav-more {
  position: relative;
  display: flex;
}

.nav-more__toggle {
  list-style: none;
}

.nav-more__toggle::-webkit-details-marker {
  display: none;
}

.nav-more__chevron {
  transition: transform var(--dur) var(--ease-out);
}

.nav-more[open] .nav-more__chevron {
  transform: rotate(180deg);
}

/* Right-aligned: "More" is the last item of the bar, so the menu opens towards the content, never past the edge. */
.nav-more__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 1;
  min-width: 220px;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--chrome);
  box-shadow: var(--shadow-lg);
}

.nav-more__link {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  color: var(--on-chrome);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  text-transform: uppercase;
}

.nav-more__link:hover {
  color: var(--on-chrome);
}

.nav-more__link[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

.nav-more__link:focus-visible {
  outline-offset: -3px;
}

.main-nav__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding-left: var(--space-2);
}

.nav-tool {
  position: relative;
  isolation: isolate;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--on-chrome);
  text-decoration: none;
  touch-action: manipulation;
}

.nav-tool:hover {
  color: var(--on-chrome);
}

/* JS-only controls: theme.js adds .js to <html> before first paint. */
.js .theme-toggle,
.js .nav-tool--search,
html:not(.js) .nav-tool--search-link {
  display: inline-grid;
}

.nav-tool--search-link[aria-current] {
  background: var(--chrome-2);
}

.theme-toggle__sun,
.search-toggle__close,
.nav-tool--search[aria-expanded="true"] .search-toggle__open {
  display: none;
}

.nav-tool--search[aria-expanded="true"] .search-toggle__close {
  display: block;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle__moon {
    display: none;
  }
}

/* Search panel under the bar (search toggle) */
.nav-search {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: var(--space-3) var(--pad);
  background: var(--chrome);
  box-shadow: var(--shadow-lg);
}

.nav-search[hidden] {
  display: none;
}

.nav-search__form {
  display: flex;
  gap: var(--space-2);
  max-width: 44rem;
  margin: 0 auto;
}

.nav-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--box);
  color: var(--text);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

.nav-search__input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.nav-search__submit {
  position: relative;
  isolation: isolate;
  flex-shrink: 0;
  min-width: 96px;
  height: 48px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

/* Mobile menu drawer */
.site-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--nav-h) - 4px);
  max-height: calc(100dvh - var(--nav-h) - 4px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--chrome);
  color: var(--on-chrome);
  box-shadow: var(--shadow-lg);
}

.site-menu[hidden] {
  display: none;
}

.site-menu:not([hidden]) {
  animation: menu-in var(--dur) var(--ease-out);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.site-menu__inner {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5) var(--pad) var(--space-6);
}

.site-menu__label {
  margin-bottom: var(--space-2);
  color: var(--on-chrome-2);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-menu__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-5);
  list-style: none;
}

.site-menu__list a {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--chrome-line);
  color: var(--on-chrome);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
}

.site-menu__list a:hover {
  color: var(--on-chrome);
  text-decoration: underline;
}

.site-menu__list a[aria-current] {
  color: var(--accent);
}

/* ============================================================== ticker */

.ticker {
  padding: var(--space-4) var(--pad) 0;
}

.ticker__inner {
  display: flex;
  align-items: stretch;
  height: 46px;
  border: 1px solid var(--border);
  background: var(--box);
  box-shadow: var(--shadow-sm);
}

.ticker__label {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  max-width: 40%;
  padding: 0 10px;
  overflow: hidden;
  background: var(--danger);
  color: var(--on-danger);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ticker__list {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 var(--space-3);
  overflow: hidden;
  list-style: none;
}

.ticker__item {
  display: none;
  height: 100%;
  align-items: center;
}

html:not(.js) .ticker__item:first-child,
.js .ticker__item.is-active {
  display: flex;
}

.js .ticker__item.is-active {
  animation: ticker-in var(--dur-slow) var(--ease-out);
}

@keyframes ticker-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.ticker__link {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 44px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.ticker__link:focus-visible {
  outline-offset: -3px;
}

.ticker__controls {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  border-left: 1px solid var(--border);
}

.js .ticker__controls {
  display: flex;
}

.ticker__btn {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-2);
  touch-action: manipulation;
}

.ticker__btn:hover {
  color: var(--text);
}

.ticker__btn:focus-visible {
  outline-offset: -3px;
}

.ticker__btn--prev,
.ticker__play-icon,
.ticker.is-paused .ticker__pause-icon {
  display: none;
}

/* Phones: the label may wrap to two short lines so the headline keeps room on one line. */
@media (max-width: 639.98px) {

  .ticker__label {
    max-width: 84px;
    padding: 0 8px;
    font-size: 0.8125rem;
    line-height: 1.1;
    white-space: normal;
  }

  .ticker__list {
    padding: 0 var(--space-2);
  }

  .ticker__btn {
    width: 40px;
  }
}

.ticker.is-paused .ticker__play-icon {
  display: block;
}

/* ============================================================== home mosaic */

.mosaic {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Image and text stacked in one grid cell; the text block sits at the bottom. The title link is
   stretched over the whole tile. */
.tile {
  position: relative;
  isolation: isolate;
  display: grid;
  overflow: hidden;
  background: var(--chrome);
}

.tile__media,
.tile__body {
  grid-area: 1 / 1;
}

.tile__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.tile:hover .tile__img {
  transform: scale(1.04);
}

.tile .placeholder {
  background-color: var(--chrome);
}

/* The dark gradient grows with the text: at least 80% overlay behind every line, which keeps white text
   above 7:1 even on a white image, then a 56px fade above it. */
.tile__body {
  align-self: end;
  z-index: 1;
  min-width: 0;
  padding: 56px var(--space-4) var(--space-4);
  background: linear-gradient(to top, var(--overlay), transparent);
  background: linear-gradient(to top,
    color-mix(in srgb, var(--overlay) 94%, transparent),
    color-mix(in srgb, var(--overlay) 80%, transparent) calc(100% - 56px),
    transparent);
  color: var(--on-overlay);
}

.tile__cat {
  display: inline-block;
  margin-bottom: var(--space-2);
  padding: 3px 8px;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.tile__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--on-overlay);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tile__title {
  margin-top: var(--space-1);
  color: var(--on-overlay);
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.tile__link {
  color: inherit;
  text-decoration: none;
}

.tile__link:hover {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

.tile__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
}

.tile__link:focus-visible {
  outline: none;
}

/* Amber ring with a dark inner band: visible on any image. */
.tile__link:focus-visible::after {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 6px var(--overlay);
}

/* Phones: the first tile stays large, the others become thumbnail rows. */
@media (max-width: 767.98px) {
  .tile:not(:first-of-type) {
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    overflow: visible;
    background: transparent;
  }

  .tile:not(:first-of-type) + .tile {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
  }

  .tile:not(:first-of-type) .tile__media,
  .tile:not(:first-of-type) .tile__body {
    grid-area: auto;
  }

  .tile:not(:first-of-type) .tile__media {
    aspect-ratio: 4 / 3;
  }

  .tile:not(:first-of-type) .tile__body {
    align-self: center;
    padding: 0;
    background: none;
    color: var(--text);
  }

  .tile:not(:first-of-type) .tile__cat {
    display: none;
  }

  .tile:not(:first-of-type) .tile__meta {
    color: var(--text-3);
    font-weight: 400;
  }

  .tile:not(:first-of-type) .tile__title {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.3;
  }

  .tile:not(:first-of-type) .placeholder {
    background-color: var(--surface-2);
  }

  .tile:not(:first-of-type) .tile__link:focus-visible::after {
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ============================================================== home category boxes */

.cat-boxes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6) var(--space-5);
}

.cat-box {
  --box-color: var(--accent);
  --on-box-color: var(--on-accent);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cat-box--c1 {
  --box-color: var(--info);
  --on-box-color: var(--on-info);
}

.cat-box--c2 {
  --box-color: var(--success);
  --on-box-color: var(--on-success);
}

.cat-box--c3 {
  --box-color: var(--danger);
  --on-box-color: var(--on-danger);
}

.cat-box__inner {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--border);
  border-bottom: 4px solid var(--box-color);
  background: var(--box);
  box-shadow: var(--shadow-sm);
}

.cat-box__lead {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-4);
}

.cat-box__media {
  width: 100%;
  margin-bottom: var(--space-2);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.cat-box__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.cat-box__lead:hover .cat-box__img {
  transform: scale(1.04);
}

.cat-box__title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.cat-box__link {
  color: var(--text);
  text-decoration: none;
}

.cat-box__link:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

.cat-box__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cat-box__link:focus-visible {
  outline: none;
}

.cat-box__link:focus-visible::after {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: -4px;
}

.cat-box__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.cat-box__more {
  position: relative;
  isolation: isolate;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 40px;
  margin-top: var(--space-2);
  padding: 0 10px 0 14px;
  border-radius: var(--r);
  background: var(--box-color);
  color: var(--on-box-color);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
}

.cat-box__more:hover {
  color: var(--on-box-color);
}

/* 44px hit area: the button is 40px tall. */
.cat-box__more::after {
  content: '';
  position: absolute;
  inset: -2px 0;
}

.cat-box__list {
  list-style: none;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.cat-box__list > li + li {
  border-top: 1px solid var(--border);
}

.cat-box__list .mini-post {
  padding: var(--space-3) var(--space-4);
}

/* ============================================================== post lists */

.post-list__box {
  padding: 0 var(--space-4);
}

.row-post {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
  padding-block: var(--space-4);
}

.post-list__box > * + *,
.results > .result + .result {
  border-top: 1px solid var(--border);
}

.results {
  list-style: none;
}

.row-post__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.row-post__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.row-post:hover .row-post__img {
  transform: scale(1.04);
}

.row-post__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.row-post__cat {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--link);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
}

.row-post__cat::after {
  content: '';
  position: absolute;
  inset: -10px -4px;
}

.row-post__cat:hover {
  text-decoration: underline;
}

.row-post__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.row-post__link {
  color: var(--text);
  text-decoration: none;
}

.row-post__link:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

.row-post__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.row-post__link:focus-visible {
  outline: none;
}

.row-post__link:focus-visible::after {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 2px;
}

.row-post__excerpt {
  display: none;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.6;
  text-wrap: pretty;
}

/* Search results keep their highlighted snippet on phones. */
.result .row-post__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* ============================================================== small posts (widgets, boxes, footer) */

.mini-list {
  list-style: none;
}

.mini-list > li + li {
  border-top: 1px solid var(--border);
}

.mini-post {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  padding-block: var(--space-3);
}

.mini-post--small {
  grid-template-columns: 72px minmax(0, 1fr);
}

.mini-post__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.mini-post__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-post__body {
  min-width: 0;
}

.mini-post__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: pretty;
}

.mini-post__link {
  color: var(--text);
  text-decoration: none;
}

.mini-post__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.mini-post__link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.mini-post__link:focus-visible {
  outline: none;
}

.mini-post__link:focus-visible::after {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 2px;
}

.mini-post__meta {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
}

/* ============================================================== cards (related posts, 404) */

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  min-width: 0;
}

.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

.card:hover .card__img {
  transform: scale(1.04);
}

.card__body {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

.card__link {
  color: var(--text);
  text-decoration: none;
}

.card__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card__link:focus-visible {
  outline: none;
}

.card__link:focus-visible::after {
  outline: var(--ring-width) solid var(--ring);
  outline-offset: 4px;
}

.card__excerpt {
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.card .placeholder__text {
  font-size: 0.875rem;
}

/* Stand-in for posts without a cover */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: 100%;
  padding: var(--space-3);
  background-color: var(--surface-2);
  background-image: var(--hatch);
  color: var(--text-3);
  text-align: center;
}

.placeholder__mark {
  width: 40px;
  height: 40px;
}

.placeholder--small .placeholder__mark {
  width: 24px;
  height: 24px;
}

.placeholder__text {
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* ============================================================== sidebar */

.sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-6);
  min-width: 0;
}

.widget {
  min-width: 0;
}

.widget__body {
  padding: var(--space-4);
  border-bottom: 3px solid var(--accent);
}

.widget--tabs {
  border-bottom: 3px solid var(--accent);
}

.tabs__list {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.tabs__list[hidden] {
  display: none;
}

.tabs__tab {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: transparent;
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 600;
  touch-action: manipulation;
}

.tabs__tab:hover {
  color: var(--text);
}

.tabs__tab[aria-selected="true"] {
  border-color: var(--border);
  background: var(--box);
  color: var(--text);
  box-shadow: inset 0 3px 0 var(--accent);
}

.tabs__tab:focus-visible {
  outline-offset: -3px;
}

.tabs__panel {
  padding: var(--space-1) var(--space-4) var(--space-2);
}

.tabs__panel[hidden] {
  display: none;
}

.tabs__panel:focus-visible {
  outline-offset: -3px;
}

/* Without JavaScript the panels show one after the other, each with its heading. */
.tabs__panel + .tabs__panel {
  border-top: 1px solid var(--border);
}

.tabs__heading {
  margin: var(--space-4) 0 var(--space-1);
  font-size: 1.0625rem;
}

.social-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
}

.social-tile {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  background: var(--chrome);
  color: var(--on-chrome);
  text-decoration: none;
  touch-action: manipulation;
}

.social-tile:hover {
  color: var(--on-chrome);
}

.social-tile--rss {
  background: var(--accent);
  color: var(--on-accent);
}

.social-tile--rss:hover {
  color: var(--on-accent);
}

.social-tile--telegram {
  background: var(--info);
  color: var(--on-info);
}

.social-tile--telegram:hover {
  color: var(--on-info);
}

.social-tile--youtube {
  background: var(--danger);
  color: var(--on-danger);
}

.social-tile--youtube:hover {
  color: var(--on-danger);
}

.cat-list {
  list-style: none;
}

.cat-list > li + li {
  border-top: 1px solid var(--border);
}

.cat-list__link {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.cat-list__link:hover {
  color: var(--text);
}

.cat-list__link:hover .cat-list__name {
  text-decoration: underline;
}

.cat-list__count {
  min-width: 30px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.widget--cats .widget__body {
  padding-block: var(--space-1);
}

.ad-slot--sidebar {
  padding: var(--space-4);
  border: 1px solid var(--border);
  background: var(--box);
}

/* ============================================================== page headers and breadcrumb */

.archive-header {
  padding: var(--space-4) var(--space-4) var(--space-5);
  border-bottom: 3px solid var(--accent);
}

.archive-header .breadcrumb {
  margin-bottom: var(--space-4);
}

.archive-header__kicker {
  margin-bottom: var(--space-1);
  color: var(--link);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-header__title {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.022em;
}

.page-header__hash {
  margin-right: 0.04em;
  color: var(--text-3);
  font-weight: 600;
}

.archive-header__desc {
  max-width: 40em;
  margin-top: var(--space-3);
  color: var(--text-2);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.archive-header__meta {
  margin-top: var(--space-3);
  font-size: 0.875rem;
}

.archive-header--search .search-form {
  margin-top: var(--space-4);
}

.breadcrumb {
  min-width: 0;
}

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  color: var(--text-3);
  font-size: 0.875rem;
  list-style: none;
}

.breadcrumb__list li {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* The second declaration hides the separator from screen readers where alt text for content is supported. */
.breadcrumb__list li + li::before {
  content: '/';
  content: '/' / '';
  margin: 0 0.55em;
  color: var(--text-3);
}

.breadcrumb a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--text-2);
  text-decoration: none;
}

/* 44px hit area without a taller row. */
.breadcrumb a::after {
  content: '';
  position: absolute;
  inset: -6px -4px;
}

.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumb__home {
  color: var(--text-3);
}

.breadcrumb__current {
  flex: 0 1 auto;
}

.breadcrumb__current span {
  display: block;
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================== post */

.post-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  min-width: 0;
  margin-bottom: calc(-1 * var(--space-3));
}

.post-top .breadcrumb {
  flex: 1 1 auto;
}

.admin-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.admin-edit:hover {
  color: var(--on-accent);
}

.post {
  min-width: 0;
}

.post-cover {
  background: var(--surface-2);
}

.post-cover__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  padding: var(--space-5) var(--space-4) var(--space-6);
}

.post-header {
  display: grid;
  gap: var(--space-3);
}

.post-title {
  color: var(--text);
  font-size: clamp(1.75rem, 1.25rem + 2.1vw, 2.625rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.024em;
}

/* SPEC 11.1: the source video's title as a dek under the title. */
.post-subtitle {
  color: var(--text-2);
  font-family: var(--font-serif);
  font-size: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.post-meta {
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-1);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.post-meta__item {
  display: inline-flex;
  align-items: center;
}

.post-meta__item .icon {
  margin-right: 6px;
}

/* A block flex item would trim the space before the channel link, so the text sits in its own span. */
.post-meta__source {
  flex-basis: 100%;
}

/* Share bar */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-bottom: 3px solid var(--accent);
  background: var(--surface-2);
}

.share-bar__label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.share-bar__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
}

.share-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: var(--chrome);
  color: var(--on-chrome);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  touch-action: manipulation;
}

.share-btn:hover {
  color: var(--on-chrome);
}

.share-btn--telegram,
.share-btn--telegram:hover {
  background: var(--info);
  color: var(--on-info);
}

.share-btn--reddit,
.share-btn--reddit:hover {
  background: var(--danger);
  color: var(--on-danger);
}

.share-btn--linkedin,
.share-btn--linkedin:hover {
  background: var(--share-linkedin);
  color: var(--on-share-linkedin);
}

.share-btn--copy,
.share-btn--copy:hover {
  border: 1px solid var(--border-strong);
  background: var(--box);
  color: var(--text);
}

/* Phones: one row of icon buttons; the names stay readable by screen readers. */
.share-btn__text,
.share-bar__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.share-bar__copy {
  display: none;
}

.js .share-bar__copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.share-btn__done,
.share-btn--copy.is-done .share-btn__icon {
  display: none;
}

.share-btn--copy.is-done .share-btn__done {
  display: block;
}

.share-bar__status {
  color: var(--text-2);
  font-size: 0.875rem;
}

.share-bar__status:empty {
  display: none;
}

/* Phones: the label shrinks to its icon and the buttons sit closer, so the bar stays one row. */
@media (max-width: 639.98px) {
  .share-bar,
  .share-bar__list {
    gap: 4px;
  }

  .share-bar {
    padding: 4px;
  }

  .share-bar__label {
    justify-content: center;
    width: 44px;
    padding: 0;
  }
}

/* Key takeaways */
.takeaways {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
}

.takeaways__title,
.video-card__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
}

.takeaways__title {
  margin-bottom: var(--space-3);
}

.takeaways__list {
  display: grid;
  gap: var(--space-2);
  list-style: none;
}

.takeaways__list li {
  position: relative;
  padding-left: 22px;
  font-size: 1rem;
  line-height: 1.55;
}

.takeaways__list li::before {
  content: '';
  position: absolute;
  top: 0.55em;
  left: 2px;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

/* Source video */
.video-card {
  display: grid;
  gap: var(--space-3);
}

.video-card__label .icon {
  color: var(--danger);
}

.video-embed {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--overlay);
}

.video-embed__link {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--on-accent);
  text-decoration: none;
}

.video-embed__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}

.video-embed__link:hover .video-embed__thumb {
  transform: scale(1.02);
  opacity: 0.85;
}

.video-embed__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 0 var(--space-5) 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform var(--dur) var(--ease-out);
}

.video-embed__link:hover .video-embed__play {
  transform: translate(-50%, -50%) scale(1.05);
}

.video-embed__link:focus-visible {
  outline-color: var(--accent);
  outline-offset: -4px;
}

.video-embed__button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.video-embed__button .icon {
  margin-left: 3px;
  fill: currentColor;
}

.video-embed__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-card__meta {
  font-size: 0.875rem;
}

/* Contents */
.toc {
  border: 1px solid var(--border);
  background: var(--box);
}

.toc__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 52px;
  padding: 0 var(--space-4);
  background: var(--surface-2);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  list-style: none;
  text-transform: uppercase;
}

.toc__summary::-webkit-details-marker {
  display: none;
}

.toc__summary:focus-visible {
  outline-offset: -3px;
}

.toc__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.toc__chevron {
  color: var(--text-3);
  transition: transform var(--dur) var(--ease-out);
}

.toc[open] .toc__chevron {
  transform: rotate(180deg);
}

.toc__list {
  padding: var(--space-3) var(--space-4) var(--space-4);
  list-style: none;
}

.toc__item a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0 8px var(--space-3);
  border-left: 2px solid var(--border);
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
}

.toc__item--h3 a {
  padding-left: var(--space-6);
  font-size: 0.875rem;
}

.toc__item a:hover {
  border-left-color: var(--text-3);
  color: var(--text);
}

.toc__item a[aria-current] {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

/* ============================================================== article body */

.prose {
  color: var(--text);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
}

.prose > * + * {
  margin-top: 1.2em;
}

.prose p,
.prose li {
  text-wrap: pretty;
}

/* Drop cap on the first paragraph of the article (SPEC 11). */
.post-body > p:first-of-type::first-letter {
  float: left;
  margin: 0.08em 0.1em 0 0;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 3.5em;
  font-weight: 700;
  line-height: 0.8;
}

.prose h2 {
  margin-top: 1.9em;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.prose h3 {
  margin-top: 1.6em;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
}

.prose h4 {
  margin-top: 1.5em;
  font-size: 1rem;
  font-weight: 700;
}

.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.6em;
}

.prose > :first-child {
  margin-top: 0;
}

.prose a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.prose a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

.prose strong,
.prose b {
  font-weight: 700;
}

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose li + li {
  margin-top: 0.45em;
}

.prose li::marker {
  color: var(--text-3);
}

.prose blockquote {
  margin: 1.8em 0;
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 4px solid var(--accent);
  color: var(--text-2);
  font-family: var(--font-serif);
  font-size: 1.3125rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.45;
}

.prose blockquote > * + * {
  margin-top: 0.8em;
}

.prose code {
  padding: 0.12em 0.36em;
  border-radius: var(--r);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.prose pre {
  overflow-x: auto;
  padding: var(--space-4);
  background: var(--surface-2);
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose hr {
  margin: 2.4em 0;
  border: 0;
  border-top: 1px dotted var(--border-strong);
}

.prose .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 0.65em 0.9em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--surface-2);
  font-weight: 700;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose .align-left {
  text-align: left;
}

/* The sitemap page for people (/sitemap/). */
.sitemap-page__intro {
  margin: 0.4em 0 0;
  color: var(--text-2);
  font-size: var(--text-base);
}

.prose .sitemap-jump ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 1.6em;
  padding: 0;
  list-style: none;
}

.prose .sitemap-jump li { margin: 0; }

.prose .sitemap-jump a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

.prose .sitemap-jump a:hover { border-color: var(--accent-strong); color: var(--text); }

.prose.sitemap-page__body h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.prose.sitemap-page__body h2 a { color: inherit; text-decoration: none; }
.prose.sitemap-page__body h2 a:hover { color: var(--link); text-decoration: underline; }

.prose .sitemap-count {
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
}

.prose .sitemap-posts { padding-left: 1.1em; }
.prose .sitemap-posts li { margin: 0.45em 0; }

.prose .sitemap-date {
  color: var(--text-3);
  font-size: var(--text-sm);
  white-space: nowrap;
}

.prose .sitemap-more { margin-top: 0.4em; font-weight: 600; }

.prose .sitemap-links,
.prose .sitemap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 0;
  list-style: none;
}

.prose .sitemap-links li,
.prose .sitemap-tags li { margin: 0; }

/* Charts (Chart.php): inline SVG coloured through classes, so dark mode follows the tokens. */
.prose .chart {
  margin: 2em 0;
  padding: 1em 1.1em 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.prose .chart-title {
  margin: 0 0 0.75em;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--leading-snug);
  color: var(--text);
}

.prose .chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}

/* The compact drawing replaces the wide one on phones, so chart text keeps a readable size. */
.prose .chart-svg-narrow { display: none; }

@media (max-width: 560px) {
  .prose .chart { padding: 0.9em 0.8em 0.7em; }
  .prose .chart-svg-wide { display: none; }
  .prose .chart-svg-narrow { display: block; }
}

.chart-bar { fill: var(--accent); }
.chart-bar-neg { fill: var(--danger); }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--text-2); font-size: 13px; font-weight: 600; }
.chart-value { fill: var(--text); font-size: 13px; font-weight: 700; }
.chart-tick { fill: var(--text-3); font-size: 12px; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.chart-series-1 { stroke: var(--accent-strong); }
.chart-line.chart-series-2 { stroke: var(--info); }
.chart-line.chart-series-3 { stroke: var(--success); }
.chart-dot.chart-series-1, .chart-key.chart-series-1 { fill: var(--accent-strong); }
.chart-dot.chart-series-2, .chart-key.chart-series-2 { fill: var(--info); }
.chart-dot.chart-series-3, .chart-key.chart-series-3 { fill: var(--success); }

.prose .chart-note {
  margin: 0.6em 0 0;
  font-size: var(--text-sm);
  color: var(--text-3);
}

.prose .chart-data {
  margin-top: 0.6em;
  font-size: var(--text-sm);
}

.prose .chart-data summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
}

.prose .chart-data summary:hover { color: var(--link-hover); }
.prose .chart-data summary:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); }
.prose .chart-data .table-wrap { margin-top: 0.4em; }

@media (forced-colors: active) {
  .chart-bar, .chart-dot, .chart-key { fill: CanvasText; }
  .chart-line { stroke: CanvasText; }
  .chart-label, .chart-value, .chart-tick { fill: CanvasText; }
}

.prose .align-center {
  text-align: center;
}

.prose .align-right {
  text-align: right;
}

/* Screenshots between the sections (Seo::articleBody(), SPEC 10.3) */
.prose .post-shot {
  margin-top: 2em;
}

.post-shot__img {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.post-shot__caption {
  margin-top: var(--space-3);
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.post-shot__credit {
  color: var(--text-3);
}

/* Article ad slot after the third section */
.prose .ad-slot--article {
  margin-block: 2em;
  padding-block: var(--space-4);
  border-block: 1px solid var(--border);
  font-size: var(--text-base);
}

/* FAQ */
.faq__title {
  margin-bottom: var(--space-2);
}

.faq__list {
  border-top: 1px solid var(--border-strong);
}

.faq__item {
  border-bottom: 1px solid var(--border-strong);
}

.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
  padding: var(--space-3) 0;
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.4;
  list-style: none;
}

.faq__question::-webkit-details-marker {
  display: none;
}

.faq__icon {
  flex-shrink: 0;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease-out);
}

.faq__item[open] .faq__icon {
  transform: rotate(45deg);
}

.faq__answer {
  padding: 0 var(--space-6) var(--space-5) 0;
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.65;
}

/* After the article: share bar and tags */
.post-footer {
  display: grid;
  gap: var(--space-4);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.post-tags__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* About the source video (in the place of Sahifa's author box) */
.about-video__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 3px solid var(--accent);
}

.about-video__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}

.about-video__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-video__body {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
  min-width: 0;
}

.about-video__title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

.about-video__channel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.about-video__channel .icon {
  flex-shrink: 0;
  color: var(--danger);
}

.about-video__channel a {
  color: var(--link);
  font-weight: 600;
}

.about-video__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  font-size: 0.875rem;
}

.about-video__facts div {
  display: flex;
  gap: 6px;
}

.about-video__facts dt {
  color: var(--text-3);
}

.about-video__facts dd {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.about-video__watch {
  margin-top: var(--space-1);
}

/* Previous and next posts */
.post-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.post-nav__link {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: start;
  gap: var(--space-1);
  min-height: 44px;
  padding: var(--space-4);
  border: 1px solid var(--border);
  background: var(--box);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
}

.post-nav__link:hover {
  color: var(--text);
}

.post-nav__link:hover .post-nav__title {
  text-decoration: underline;
}

.post-nav__link--next {
  justify-items: end;
  text-align: right;
}

.post-nav__dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--link);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-nav__title {
  font-weight: 700;
  line-height: 1.35;
  text-wrap: pretty;
}

/* Not financial advice */
.note {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.note strong {
  color: var(--text);
}

.note__icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-3);
}

.preview-banner {
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.9375rem;
}

.preview-banner__inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
}

/* ============================================================== search */

.search-form__label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 600;
}

.search-form__row {
  position: relative;
  display: flex;
  gap: var(--space-2);
}

.search-form__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-form__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 52px;
  padding: 0 var(--space-4) 0 44px;
  /* --text-3 keeps the field's edge above 3:1 against the page in both themes (WCAG 1.4.11). */
  border: 1px solid var(--text-3);
  border-radius: var(--r);
  background: var(--box);
  font-size: 1.0625rem;
  -webkit-appearance: none;
  appearance: none;
}

.search-form__input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.search-form__input:hover {
  border-color: var(--text-2);
}

.search-form__input:focus {
  border-color: var(--text);
}

.search-form__submit {
  position: relative;
  isolation: isolate;
  flex-shrink: 0;
  min-height: 52px;
}

.search-count {
  margin-bottom: var(--space-3);
  color: var(--text-2);
  font-size: 0.9375rem;
}

.search-count strong {
  color: var(--text);
}

.search-suggest {
  padding: var(--space-4);
}

.search-suggest__text {
  color: var(--text-2);
}

/* ============================================================== pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.pagination__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

.pagination__num,
.pagination__link {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  background: var(--box);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.pagination__num:hover,
.pagination__link:hover {
  color: var(--text);
}

.pagination__num.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.pagination__gap {
  min-width: 24px;
  color: var(--text-3);
  text-align: center;
}

/* Phones: arrow buttons; the labels stay readable by screen readers. */
.pagination__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pagination__status {
  color: var(--text-3);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================================== empty and error states */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-4);
}

.empty-state--page {
  margin-block: var(--space-6) var(--space-8);
  padding-block: var(--space-8);
}

.empty-state__mark {
  width: 48px;
  height: 48px;
}

.empty-state__title {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.empty-state__text {
  max-width: 36em;
  color: var(--text-2);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.empty-state .tag-cloud {
  margin-top: var(--space-1);
}

.error-page {
  margin-block: var(--space-5) var(--space-6);
  padding: var(--space-6) var(--space-4);
}

.error-page__code {
  color: var(--border-strong);
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 3rem + 7vw, 8rem);
  font-weight: 700;
  line-height: 0.9;
  font-variant-numeric: lining-nums;
}

.error-page__title {
  margin-top: var(--space-4);
  font-size: clamp(1.875rem, 1.4rem + 2vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.error-page__text {
  max-width: 38em;
  margin-top: var(--space-4);
  color: var(--text-2);
  font-size: 1.125rem;
  line-height: 1.6;
}

.error-page__detail {
  margin-top: var(--space-3);
  color: var(--text-3);
  font-size: 0.9375rem;
}

.error-page__search {
  max-width: 40rem;
  margin-top: var(--space-6);
}

.error-page__home {
  margin-top: var(--space-5);
}

.related--wide {
  margin-bottom: var(--space-8);
}

/* ============================================================== static pages */

.static-page {
  padding: var(--space-5) var(--space-4) var(--space-6);
}

.static-page__header {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.static-page__header .breadcrumb {
  margin-bottom: var(--space-4);
}

.static-page__contact {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1rem;
}

/* ============================================================== footer */

.site-footer {
  margin-top: auto;
  border-top: 4px solid var(--accent);
  background: var(--chrome);
  color: var(--on-chrome-2);
  --ring: var(--accent);
}

.footer-widgets {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  padding: var(--space-7) var(--pad) var(--space-6);
}

.footer-col {
  min-width: 0;
}

.footer-title {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--chrome-line);
  color: var(--on-chrome);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
}

.footer-title--follow {
  margin-top: var(--space-5);
}

.brand--footer,
.brand--footer:hover {
  color: var(--on-chrome);
}

.brand--footer .brand__mark {
  width: 36px;
  height: 36px;
}

.brand--footer .brand__name {
  font-size: 1.375rem;
}

.footer-about {
  max-width: 30em;
  margin-top: var(--space-3);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.footer-links {
  list-style: none;
}

.footer-links--split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-4);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--on-chrome-2);
  font-size: 0.9375rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--on-chrome);
  text-decoration: underline;
}

.site-footer .social-tile--x {
  background: var(--chrome-2);
}

.site-footer .mini-list > li + li {
  border-color: var(--chrome-line);
}

.site-footer .mini-post__link,
.site-footer .mini-post__link:hover {
  color: var(--on-chrome);
}

.site-footer .meta {
  color: var(--on-chrome-2);
}

.site-footer .mini-post__media,
.site-footer .placeholder {
  background-color: var(--chrome-2);
}

.site-footer .placeholder {
  background-image: none;
  color: var(--on-chrome-2);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding: var(--space-4) var(--pad) var(--space-5);
  border-top: 1px solid var(--chrome-line);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.footer-bottom__text {
  display: grid;
  gap: var(--space-1);
}

.footer-bottom a {
  color: var(--on-chrome);
}

.footer-bottom__links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.footer-bottom__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* "Cookie settings" in the footer: a button that looks like the links next to it. */
.footer-bottom__button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--on-chrome);
  font: inherit;
  cursor: pointer;
}

.footer-bottom__button:hover { color: var(--accent); }
.footer-bottom__button:focus-visible { outline: var(--ring-width) solid var(--accent); outline-offset: var(--ring-offset); }

/* ============================================================== cookie consent (Consent.php) */

.consent {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: var(--z-toast);
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.consent[hidden] { display: none; }

.consent__inner {
  width: 100%;
  max-width: 720px;
  padding: 18px 20px 16px;
  border: 1px solid var(--border-strong);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.consent__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.consent__text {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.consent__text a { color: var(--link); }
.consent__text a:hover { color: var(--link-hover); }

.consent__choices {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.consent__choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  cursor: pointer;
}

.consent__choice input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent-strong);
}

.consent__choice strong { margin-right: 4px; color: var(--text); }

.consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Accept and Reject look the same: neither choice is pushed. */
.consent__btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}

.consent__btn:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.consent__btn:focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--ring-offset); }
.consent__btn--quiet { border-color: var(--border-strong); background: transparent; color: var(--text); }
.consent__btn[hidden] { display: none; }

@media (max-width: 560px) {
  .consent { right: 0; bottom: 0; left: 0; }
  .consent__inner { border-right: 0; border-left: 0; border-radius: 0; padding: 16px 16px 14px; }
  .consent__btn { flex: 1 1 auto; }
}

/* ============================================================== 640px */

@media (min-width: 640px) {
  .ticker__btn--prev {
    display: grid;
  }

  .ticker__label {
    padding: 0 var(--space-3);
    font-size: 0.9375rem;
  }

  .share-btn__text,
  .share-bar__text,
  .pagination__text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .row-post__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .card__media {
    aspect-ratio: 16 / 9;
  }

  .post-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-nav__link--next:only-child {
    grid-column: 2;
  }

  .about-video__inner {
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: start;
  }
}

/* ============================================================== tablet: 768px */

@media (min-width: 768px) {
  .topbar {
    display: block;
  }

  .header-main {
    padding-block: var(--space-5);
  }

  .brand__mark {
    width: 48px;
    height: 48px;
  }

  .brand__name {
    font-size: 2.125rem;
  }

  .header-tagline {
    display: block;
  }

  .ad-slot--header {
    flex: 0 1 728px;
  }

  .mosaic {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .tile {
    grid-column: span 3;
  }

  .tile:nth-of-type(-n + 2) {
    height: clamp(250px, 27vw, 320px);
  }

  .tile:nth-of-type(n + 3) {
    height: clamp(210px, 21vw, 250px);
  }

  .mosaic--1 .tile,
  .mosaic--3 .tile:nth-of-type(3) {
    grid-column: 1 / -1;
  }

  .mosaic--5 .tile:nth-of-type(n + 3) {
    grid-column: span 2;
  }

  .tile__media {
    aspect-ratio: auto;
    height: 100%;
  }

  .tile__title {
    font-size: 1.5rem;
  }

  .mosaic--5 .tile:nth-of-type(n + 3) .tile__title {
    font-size: 1.125rem;
  }

  .mosaic--5 .tile:nth-of-type(n + 3) .tile__cat {
    display: none;
  }

  .cat-boxes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cat-box--wide {
    grid-column: 1 / -1;
  }

  .cat-box--wide .cat-box__inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cat-box--wide .cat-box__list {
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  /* Wide box with fewer than two small posts: image beside the text, the list (if any) underneath. */
  .cat-box--flat .cat-box__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .cat-box--flat .cat-box__lead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr;
    align-content: start;
    column-gap: var(--space-5);
  }

  .cat-box--flat .cat-box__media {
    grid-row: 1 / -1;
    grid-column: 1;
    margin-bottom: 0;
  }

  .cat-box--flat .cat-box__more {
    justify-self: start;
    align-self: start;
  }

  .cat-box--flat .cat-box__list {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .row-post {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--space-5);
    padding-block: var(--space-5);
  }

  .row-post__media {
    aspect-ratio: 16 / 10;
  }

  .row-post__title {
    font-size: 1.3125rem;
  }

  .post-list__box {
    padding: 0 var(--space-5);
  }

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-5);
  }

  .widget--tabs {
    grid-row: span 3;
  }

  .archive-header {
    padding: var(--space-5) var(--space-6) var(--space-6);
  }

  .post-box {
    padding: var(--space-6) var(--space-6) var(--space-7);
  }

  .post-meta__source {
    flex-basis: auto;
  }

  .takeaways {
    padding: var(--space-5) var(--space-6);
  }

  .static-page {
    padding: var(--space-6) var(--space-6) var(--space-7);
  }

  .error-page {
    padding: var(--space-7) var(--space-6);
  }

  .empty-state {
    padding: var(--space-6);
  }

  .footer-widgets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6) var(--space-7);
  }
}

/* ============================================================== desktop: 1024px */

@media (min-width: 1024px) {
  .topbar__social {
    display: flex;
  }

  .topbar__input {
    width: 180px;
  }

  .header-main {
    flex-wrap: nowrap;
    min-height: 120px;
  }

  .main-nav__home {
    margin-top: -8px;
    padding-top: 8px;
  }

  .js .main-nav__menu:not(.main-nav__menu--link),
  html:not(.js) .main-nav__menu--link {
    display: none;
  }

  .site-menu {
    display: none !important;
  }

  .main-nav__list {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    list-style: none;
  }

  .page-grid {
    grid-template-columns: minmax(0, 1fr) var(--sidebar);
    padding-top: var(--space-6);
  }

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

  .widget--tabs {
    grid-row: auto;
  }

  .footer-widgets {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.75fr);
  }
}

/* ============================================================== 1200px: the box floats on the pattern */

@media (min-width: 1232px) {
  .site-box {
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
}

/* ============================================================== motion and print */

@media (prefers-reduced-motion: reduce) {
  .tile:hover .tile__img,
  .cat-box__lead:hover .cat-box__img,
  .row-post:hover .row-post__img,
  .card:hover .card__img,
  .video-embed__link:hover .video-embed__thumb {
    transform: none;
  }

  .video-embed__link:hover .video-embed__play {
    transform: translate(-50%, -50%);
  }

  .site-menu:not([hidden]),
  .js .ticker__item.is-active {
    animation: none;
  }
}

@media print {
  /* Paper is light: map the tokens to system colours so a forced dark theme still prints readably. */
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: Canvas;
    --surface: Canvas;
    --surface-2: Canvas;
    --page: Canvas;
    --box: Canvas;
    --text: CanvasText;
    --text-2: CanvasText;
    --text-3: GrayText;
    --link: LinkText;
    --border: GrayText;
    --border-strong: GrayText;
  }

  body {
    background: none;
  }

  .topbar,
  .main-nav,
  .ticker,
  .sidebar,
  .site-footer,
  .skip-link,
  .share-bar,
  .post-nav,
  .related,
  .toc,
  .video-embed,
  .ad-slot,
  .post-top {
    display: none !important;
  }

  .page-grid {
    display: block;
  }

  .box {
    border: 0;
    box-shadow: none;
  }

  .prose a::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
  }
}
