/* =========================================================================
   tide — a clean, lightweight, non-Bootstrap theme for Tuskfish
   Palette: "calm coastal". Hand-written, no framework, mobile-first.
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* Calm coastal palette */
  --bg:          #f4f7f8;   /* foam              */
  --bg-tint:     #eaf1f2;   /* faint teal wash   */
  --card:        #ffffff;
  --text:        #14323c;   /* deep sea          */
  --muted:       #5b727b;   /* muted slate       */
  --text-soft:   #36505a;   /* teaser body, a touch lighter than --text */
  --rule:        #d9e3e6;   /* hairline          */
  --rule-strong: #c3d4d8;   /* hairline on hover */
  --accent:      #0e7c86;   /* teal              */
  --accent-700:  #0a5d65;   /* teal, darker      */
  --accent-050:  #e2f0f1;   /* teal, faint       */
  --link:        #0a6b8a;   /* lagoon blue       */
  --link-hover:  #084e66;
  --sand:        #c9b48a;   /* warm coastal trim */
  --coral:       #de7356;   /* warm accent: action / emphasis only */
  --coral-700:   #c25b3f;
  --coral-050:   #fbe7e0;

  /* Type scale (fluid) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --h1: clamp(1.8rem, 1.3rem + 2.2vw, 2.6rem);
  --h2: clamp(1.45rem, 1.2rem + 1.3vw, 1.95rem);
  --h3: clamp(1.2rem, 1.05rem + 0.7vw, 1.45rem);

  /* Spacing & shape */
  --gap: 1.5rem;
  --container: 1140px;
  --measure: 70ch;     /* readable line length for prose */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 50, 60, .06), 0 6px 18px rgba(20, 50, 60, .06);
  --shadow-sm: 0 1px 2px rgba(20, 50, 60, .08);
}

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: fill the viewport so the footer sits at the bottom even
     when the page content is short. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; margin: 0 0 .6em; color: var(--text); }
h1 { font-size: var(--h1); letter-spacing: -.01em; }
h2 { font-size: var(--h2); letter-spacing: -.005em; }
h3 { font-size: var(--h3); }
p { margin: 0 0 1rem; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* ---- Skip link -------------------------------------------------------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---- Layout container ------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 0.5rem + 2vw, 2rem);
}
.page { padding-block: clamp(1.75rem, 1rem + 3vw, 3.25rem); }

/* =========================================================================
   Header / navigation
   ========================================================================= */
.site-header {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-700) 100%);
  color: #eaf6f7;
  box-shadow: var(--shadow-sm);
}
.nav {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--gap);
  min-height: 132px;
}
.nav-menu { display: flex; align-items: center; gap: var(--gap); }
.brand-logo {
  display: inline-flex; align-items: center; gap: 1rem;
  color: #fff; text-decoration: none; margin-right: auto;
}
.brand-logo:hover { color: #fff; text-decoration: none; }
.brand-logo img { height: 92px; width: auto; display: block; flex-shrink: 0; }
.brand-text {
  font-size: clamp(1.05rem, .85rem + .75vw, 1.4rem);
  font-weight: 600; letter-spacing: -.015em; line-height: 1.15;
  max-width: 16rem;
}
.nav-links { list-style: none; display: flex; align-items: center; gap: .35rem; margin: 0; padding: 0; }
.nav-links a {
  color: #dff0f1; text-decoration: none; padding: .45rem .7rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .97rem; display: inline-flex; align-items: center; gap: .4rem;
  transition: background-color .15s ease, color .15s ease;
}
.nav-links a:hover { background: rgba(255,255,255,.14); color: #fff; }

/* RSS + theme toggle are utility controls, not nav items: group them tightly
   and set them a little apart from the menu links. The visible spacing between
   the two is their button padding, so trim that (the gap alone won't do it). */
.nav-utilities { display: inline-flex; align-items: center; gap: 0; margin-left: .5rem; }
.nav-utilities a, .nav-utilities .theme-toggle { padding-left: .4rem; padding-right: .4rem; }

/* image-fill is inset (~14/16 tall) where rss/moon/sun are full-bleed, so it
   renders shorter. Nudge it up to match their optical height. Its path also
   touches the right edge of the 16-unit box, which the SVG viewport would clip
   (default overflow:hidden) once enlarged — so let it overflow. */
.nav-links svg.gallery-icon { width: 1.28rem; height: 1.28rem; overflow: visible; }

/* Dropdown menus. No-JS by design: a native <details>/<summary> owns the open
   state, so it works with keyboard and touch alike (no hover trap on mobile). */
.nav-dropdown { position: relative; }
.nav-dropdown details > summary {
  /* Match the styling of a plain nav link, but as a clickable summary. */
  color: #dff0f1; cursor: pointer; list-style: none;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .97rem;
  display: inline-flex; align-items: center; gap: .35rem;
  transition: background-color .15s ease, color .15s ease;
}
.nav-dropdown details > summary::-webkit-details-marker { display: none; }
.nav-dropdown details > summary:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav-dropdown details[open] > summary { background: rgba(255,255,255,.14); color: #fff; }
.nav-dropdown summary .chevron {
  width: .85rem; height: .85rem; transition: transform .15s ease;
}
.nav-dropdown details[open] > summary .chevron { transform: rotate(180deg); }

.nav-submenu {
  list-style: none; margin: 0; padding: .35rem;
  position: absolute; top: calc(100% + .35rem); left: 0; z-index: 50;
  min-width: 13rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.nav-submenu a {
  display: block; padding: .5rem .7rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 500; font-size: .95rem; text-decoration: none;
  white-space: nowrap;
}
.nav-submenu a:hover { background: var(--accent-050); color: var(--accent-700); text-decoration: none; }

/* Search */
.nav-search { display: flex; gap: .4rem; }
.nav-search input[type="search"] {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12);
  color: #fff; border-radius: var(--radius-sm); padding: .45rem .7rem;
  width: 7rem; min-width: 0;
  font-size: .95rem;
}
.nav-search input::placeholder { color: #cfe6e8; }
/* The input always turns white on focus (in both colour schemes), so pin the
   text to a fixed dark — var(--text) would be near-white under dark mode. */
.nav-search input:focus { background: #fff; color: #14323c; outline: none; border-color: #fff; }
.nav-search .btn { padding: .45rem .9rem; }

/* CSS-only mobile toggle */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none; cursor: pointer; margin-left: auto;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: ""; display: block; width: 22px; height: 2px; background: #fff; position: relative;
  transition: transform .2s ease;
}
.nav-toggle-label span::before { position: absolute; top: -7px; }
.nav-toggle-label span::after  { position: absolute; top: 7px; }

/* Collapse to the hamburger before the full nav (brand + links + search) runs
   out of room and starts wrapping onto a second line against the logo. With the
   expanded dropdown menu + search, the horizontal row only fits comfortably once
   the container reaches its 1140px max, so switch over below that. */
@media (max-width: 1140px) {
  .nav { min-height: 84px; }
  .brand-logo img { height: 64px; }
  .nav-toggle-label { display: inline-flex; }
  .nav-menu {
    order: 3; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: .5rem;
    display: none; padding-bottom: 1rem;
  }
  .nav-toggle:checked ~ .nav-menu { display: flex; }
  .nav-links { flex-direction: column; align-items: stretch; gap: .15rem; }
  .nav-links a { padding: .7rem .6rem; }
  /* Dropdowns expand inline (not as a floating overlay) within the stacked menu. */
  .nav-dropdown details > summary { padding: .7rem .6rem; justify-content: space-between; }
  .nav-submenu {
    position: static; min-width: 0; margin: .15rem 0 .35rem .6rem;
    box-shadow: none;
  }
  /* Keep the utility controls on one row even when the menu stacks. */
  .nav-utilities { margin-left: 0; gap: .25rem; }
  .nav-search input[type="search"] { flex: 1; }
}

/* =========================================================================
   Buttons & forms
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer;
  padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--coral); color: #fff;
  text-decoration: none; transition: background-color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--coral-700); color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--accent-700); border-color: rgba(255,255,255,.6); }
.btn-secondary:hover { background: var(--accent-050); color: var(--accent-700); }
.btn-block { width: 100%; }

label { font-weight: 600; display: inline-block; margin-bottom: .35rem; }
input[type="text"], input[type="search"], input[type="email"],
input[type="password"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--text);
  padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--card);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-050); }
.field { margin-bottom: 1rem; }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input-group-text {
  display: grid; place-items: center; padding: 0 .8rem;
  border: 1px solid var(--rule); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-tint); color: var(--muted);
}

/* =========================================================================
   Page title & meta
   ========================================================================= */
.page-title {
  text-align: center; margin-bottom: 1.75rem;
  /* Lighter than the base h1 (700/--h1): page titles sit above their own
     content, so a 600 weight and a slightly smaller size read less heavy. */
  font-weight: 600; font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.15rem);
}
/* "Horizon" rule — a short teal underline echoing the header waterline */
.page-title::after {
  content: ""; display: block; width: 3.5rem; height: 3px; margin: .6rem auto 0;
  background: var(--coral); border-radius: 3px;
}
.article .title::after {
  content: ""; display: block; width: 3.5rem; height: 3px; margin: .55rem 0 0;
  background: var(--coral); border-radius: 3px;
}
.content-info { color: var(--muted); font-size: .92rem; margin-bottom: 1.25rem; }
/* Tags sit on their own line below the meta. Lift the links with weight + an
   underline (not size) so they read as links; a small teal tag icon adds a
   little colour without the bulk of pills. Exclude any icon link from the
   underline treatment. */
.content-tags { margin: -.9rem 0 1.25rem; color: var(--muted); }
.content-tags .icon-tag { color: var(--accent); margin-right: .15rem; }
.content-info a:not(.icon-link), .content-tags a {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.content-info a:not(.icon-link):hover, .content-tags a:hover { color: var(--accent-700); }
.small { font-size: .92rem; }

/* Type icon next to titles — teal signals "clickable", so only colour it when
   the icon is actually a link (<a>). A non-linked title (e.g. an article with
   no download) renders the icon in a <span>, which stays in the text colour. */
.icon-link { color: var(--text); }
a.icon-link { color: var(--link); }
a.icon-link:hover { color: var(--link-hover); }
.title .icon-link, .title-link { vertical-align: baseline; }
/* The icon font pushes every glyph down 0.115em to sit on the body-text
   baseline; in the larger/bolder headings that drops the icon below the
   text. Cancel the nudge for icons inside titles so they sit level. */
.title [class^="icon-"], .title [class*=" icon-"],
.parent [class^="icon-"], .child-title [class^="icon-"] { top: .06em; }
/* The icon font's 0.115em down-nudge drops the RSS/tag glyphs below the small
   meta text. The icons are inline-block (vendor `a > [icon]` rule), so
   vertical-align:middle centres their full em box and sinks them well below the
   baseline — align to the baseline and lift a touch so they sit on the line. */
.content-info [class^="icon-"], .content-info [class*=" icon-"],
.content-tags [class^="icon-"], .content-tags [class*=" icon-"] {
  top: .02em; vertical-align: baseline;
}

/* =========================================================================
   Stream (teaser list — listView / search results)
   ========================================================================= */
.stream { display: flex; flex-direction: column; }
.stream-item {
  position: relative;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; margin-bottom: 1.1rem; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

/* Gutter label — content type + date pulled into the left gutter on wide
   screens. Asymmetric and informational; hidden when there's no gutter (the
   same type/date still appears inline in .content-info on smaller screens). */
.gutter-label { display: none; }
/* The gutter label is absolutely positioned into the free space to the LEFT of
   the centred content (right:100% + ~10rem). That space only exists once the
   viewport is wide enough: (vw - content) / 2 must exceed the gutter's width,
   which lands around 1480px. Showing it any earlier pushes it off-screen and
   triggers horizontal scroll, so gate it on the width where it actually fits. */
@media (min-width: 1480px) {
  .gutter-label {
    display: block; position: absolute; right: 100%; top: 1.4rem;
    width: 8.5rem; margin-right: 1.75rem; text-align: right;
  }
  .gutter-label .kind {
    display: block; font-size: .72rem; font-weight: 800; letter-spacing: .14em;
    text-transform: uppercase; color: var(--accent);
  }
  .gutter-label .when { display: block; font-size: .82rem; color: var(--muted); margin-top: .25rem; }
  .gutter-label::after {
    content: ""; display: block; width: 1.75rem; height: 2px; margin: .55rem 0 0 auto;
    background: var(--rule);
  }
  /* Gutter shows the date on wide screens, so drop the redundant inline date
     below the heading. If there's no other info, the line collapses entirely. */
  .stream-item .content-info .meta-date { display: none; }
  .stream-item .content-info .meta-info::before { content: ""; }
  .stream-item .content-info:has(.meta-date):not(:has(.meta-info)) { display: none; }
}
/* Inline meta separator (narrow screens, where the gutter is hidden). */
.content-info .meta-info::before { content: " | "; }
.stream-item:hover { box-shadow: var(--shadow); border-color: var(--rule-strong); }
.stream-item .title { margin-bottom: .35rem; font-size: var(--h3); }
.stream-item .teaser { color: var(--text-soft); }
.stream-item .teaser p:last-child { margin-bottom: 0; }
.stream-item::after { content: ""; display: table; clear: both; }
/* .stream is a flex column, so the last item's margin-bottom doesn't collapse —
   it would otherwise add to the gap above the bottom pagination, making it
   larger than the gap below the top pagination. Drop it for parity. */
.stream-item:last-child { margin-bottom: 0; }

/* Floated thumbnails */
figure { margin: 0; }
figure img { border-radius: var(--radius-sm); border: 1px solid rgba(20, 50, 60, .18); }
figcaption { color: var(--muted); font-size: .88rem; margin-top: .4rem; }
.figure-left  { float: left;  margin: .25rem 1.25rem 1rem 0; max-width: 200px; }
.figure-right { float: right; margin: .25rem 0 1rem 1.25rem; max-width: 40%; }
.figure-centre { margin: 1.25rem auto; }
.figure-centre img { width: 100%; }

/* Nudge body text up on touch devices — the fixed desktop size reads small.
   Tablets (incl. iPad, up to 1024px) get a small bump; phones a larger one. */
@media (max-width: 1024px) {
  body { font-size: 1.1875rem; }
}

@media (max-width: 560px) {
  body { font-size: 1.1875rem; }
  .figure-left, .figure-right { float: none; margin: 0 0 1rem; max-width: 100%; }
  .figure-left img, .figure-right img { width: 100%; }
}

/* =========================================================================
   Single article / collection prose
   ========================================================================= */
.article { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.5rem); box-shadow: var(--shadow); }
.article .title { font-size: var(--h2); font-weight: 600; text-align: left; }
/* Inline prose links: the plain lagoon colour is hard to spot in running body
   text, so give them a standing underline and a slightly stronger weight. */
.description a, .teaser a {
  color: var(--link); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px;
}
.description a:hover, .teaser a:hover { color: var(--link-hover); }
.description img { border-radius: var(--radius-sm); border: 1px solid rgba(20, 50, 60, .18); margin: 1rem 0; }
.description h2, .description h3 { margin-top: 1.6rem; }
.description::after { content: ""; display: table; clear: both; }
.rights { font-style: italic; color: var(--muted); }
.media a { font-weight: 600; }

/* tag pills */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-pill {
  display: inline-block; padding: .22rem .7rem; background: var(--accent-050); color: var(--accent-700);
  border-radius: 999px; font-size: .85rem; font-weight: 600; text-decoration: none;
}
.tag-pill:hover { background: var(--coral); color: #fff; text-decoration: none; }

/* Prose lists inside teasers/descriptions — hanging indents, with the marker
   clear of the wrapped text. A teaser wraps beside a floated thumbnail, so a
   plain block list would start behind the float and strand its outside markers
   far to the left. `display: flow-root` makes each list its own block
   formatting context, so it sits in the text column beside the float instead;
   outside markers then hang correctly within its padding. Harmless where there
   is no float (descriptions). */
.teaser ul, .teaser ol,
.description ul, .description ol {
  display: flow-root;
  margin: 0 0 1rem; padding-left: 1.5rem;
  list-style-position: outside;
}
.teaser li, .description li { margin-bottom: .25rem; }

/* Related / parent / children */
.related, .collection-children { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
/* Clear the floated thumbnail so a tall image / short teaser doesn't spill past
   the bottom edge of the related block. */
.related::after { content: ""; display: table; clear: both; }
.child-title, .parent { font-size: 1.15rem; }
.child-item { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.child-item:last-child { border-bottom: 0; }
.child-item::after { content: ""; display: table; clear: both; }

/* =========================================================================
   Gallery (CSS grid)
   ========================================================================= */
.gallery-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.gallery-grid a { display: block; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm);
  background: var(--card); aspect-ratio: 4 / 3; }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.gallery-grid a:hover img { transform: scale(1.04); }

/* =========================================================================
   Featured content block (CSS grid of card tiles)
   ========================================================================= */
.featured-content { padding-top: clamp(1.75rem, 1rem + 3vw, 3.25rem); padding-bottom: 0; }
.featured-title { text-align: center; margin: 0 0 2rem; font-weight: 600; }
.featured-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.featured-card { display: flex; flex-direction: column; }
/* Old-style printed-photo framing: white mat, thin outer stroke, soft shadow that
   lifts gently on hover (slow, eased — no sudden jump). */
.featured-thumb {
  display: block; overflow: hidden;
  background: #fff; padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(20, 50, 60, .12);
  transition: box-shadow .25s ease, transform .25s ease;
}
.featured-thumb img { width: 100%; height: auto; display: block; }
.featured-card:hover .featured-thumb {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(20, 50, 60, .18);
}
/* The global prefers-reduced-motion rule below kills all transitions with !important
   (a stricter stance than Bootstrap, which only neutralises specific components and
   lets its .lift hover through). Re-enable this one gentle decorative lift to match. */
@media (prefers-reduced-motion: reduce) {
  .featured-thumb { transition: box-shadow .25s ease, transform .25s ease !important; }
}
.featured-card h3 { font-size: 1.15rem; margin: .9rem 0 .4rem; }
.featured-card h3 a { color: var(--text); text-decoration: none; }
.featured-card h3 a:hover { color: var(--accent-700); }
.featured-card p { margin: 0; color: var(--text-soft); }
/* This block carries its own full-width layout, so strip the standard .block card
   chrome (background, border, accent bar, shadow, padding) when it wraps one. */
.block:has(.featured-content) {
  background: none; border: none; border-radius: 0; box-shadow: none; padding: 0;
}

/* =========================================================================
   Centre blocks (layout regions)
   ========================================================================= */
.block-region { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 2rem; }
/* When a centre-block region is the last thing on the page (e.g. "Featured
   content" below the stream and there's no pagination to space it off), give
   it a top margin so it doesn't rub against the main content. */
.page > .container:last-child > .block-region { margin-top: 1.25rem; }
.block {
  background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow-sm);
}
.block h3 { font-size: 1.1rem; margin-bottom: .6rem; color: var(--accent-700); }
.block ul { margin: 0; padding-left: 1.1rem; }
.block li { margin-bottom: .35rem; }

/* =========================================================================
   Filters & select bar
   ========================================================================= */
.select-filters { max-width: 22rem; margin: 0 auto 1.75rem; }

/* =========================================================================
   Pagination  (markup from themes/tide/pagination.html)
   ========================================================================= */
.pagination { display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 1.25rem 0; justify-content: flex-end; }
.page-link {
  display: block; padding: .45rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  color: var(--accent-700); background: var(--card); text-decoration: none; font-weight: 600; line-height: 1;
}
.page-link:hover { background: var(--accent-050); text-decoration: none; }
.page-link.is-current { background: var(--coral); border-color: var(--coral); color: #fff; }

/* =========================================================================
   Alerts (webauthn login etc.)
   ========================================================================= */
.alert { padding: 1rem 1.2rem; border-radius: var(--radius-sm); border: 1px solid var(--rule); margin-bottom: 1rem; }
.alert-info { background: var(--accent-050); border-color: #b9dde0; color: var(--accent-700); }
.alert-success { background: #e4f3ec; border-color: #b7ddc7; color: #1c6b42; }

/* =========================================================================
   Media: audio / video
   ========================================================================= */
.video-player { margin: 1.5rem 0; }
.ratio { position: relative; width: 100%; background: #000; border-radius: var(--radius); overflow: hidden; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-4x3  { aspect-ratio: 4 / 3; }
.ratio-1x1  { aspect-ratio: 1 / 1; }
.ratio-21x9 { aspect-ratio: 21 / 9; }
.ratio iframe, .ratio video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-player video { width: 100%; height: auto; border-radius: var(--radius); background: #000; }
.audio-player { margin: 1.5rem 0; }
audio { width: 100%; margin: 1.5rem 0; }
video { max-width: 100%; height: auto; }

/* Track map */
.map-responsive { margin: 1.5rem 0; }
.map-responsive #map { width: 100%; height: 420px; border-radius: var(--radius); }

/* =========================================================================
   Cards, tables & narrow forms (login / register / search)
   ========================================================================= */
.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: clamp(1.1rem, 0.8rem + 1vw, 1.6rem); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem;
}
.card h3 { margin-top: 0; color: var(--accent-700); }
.form-narrow, .search-form { max-width: 22rem; margin: 0 auto; }
.search-form { margin-bottom: 2rem; }
.form-text { display: block; color: var(--muted); font-size: .88rem; margin-top: .35rem; }
.mt-3 { margin-top: 1rem; }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--rule); }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table tbody tr:hover { background: var(--bg-tint); }

.btn-sm { padding: .35rem .7rem; font-size: .88rem; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-danger:hover { background: var(--coral-700); color: #fff; }

/* =========================================================================
   Expert browse / search (experts module)
   ========================================================================= */
/* A-Z name index: a centred row of bracketed letters that wraps gracefully. */
.expert-browse .alpha-nav { text-align: center; font-weight: 600; line-height: 1.9; margin-bottom: 1.75rem; }
.expert-browse .alpha-nav a { color: var(--accent); text-decoration: none; margin: 0 .1rem; }
.expert-browse .alpha-nav a:hover { color: var(--accent-700); text-decoration: underline; }

/* Filter bar: tag + country selects and the search field sit on one row on
   wider screens, then stack on mobile. Selects/inputs are full-width within
   their flex cell (base input rule), so the cells own the sizing. */
.expert-filters { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; align-items: end; max-width: 48rem; margin: 0 auto 2rem; }
.expert-filters .field { flex: 1 1 12rem; margin-bottom: 0; }
.expert-filters .field-submit { flex: 0 0 auto; }
.expert-filters .field-submit .btn { width: 100%; }
/* The text input inherits the body's tall line-height while selects and the
   button are shorter; pin all three to one height so the row lines up. */
.expert-filters input[type="text"],
.expert-filters select,
.expert-filters .btn { height: 2.9rem; }

/* =========================================================================
   Footer
   ========================================================================= */
/* The footer is the surface of the water: a teal band whose top edge is a
   crisp, repeating wave (fixed 80px wavelength, so it never stretches). */
.site-footer {
  position: relative;
  /* The .page already supplies generous bottom padding; a small top margin
     here is enough to clear the wave crest without doubling the gap. */
  margin-top: 1rem;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-700) 100%);
  color: #d6edef;
}
/* The wave's crest fills with the *page* colour so it reads as the page edge
   biting into the teal band. Painting it as a solid var(--bg) revealed through
   an SVG mask (rather than baking the colour into the SVG) keeps it matched to
   the background in both light and dark — a hard-coded fill leaves a pale band
   above the wave once the page goes dark. */
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 24px;
  background: var(--bg);
  -webkit-mask: repeat-x top / 240px 24px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 24' preserveAspectRatio='none'%3E%3Cpath fill='%23fff' d='M0,0 H80 V7 C66,7 60,18 40,18 C20,18 14,7 0,7 Z'/%3E%3C/svg%3E");
          mask: repeat-x top / 240px 24px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 24' preserveAspectRatio='none'%3E%3Cpath fill='%23fff' d='M0,0 H80 V7 C66,7 60,18 40,18 C20,18 14,7 0,7 Z'/%3E%3C/svg%3E");
}
/* Extra top padding keeps the columns clear of the wave crest above. */
.site-footer .container { padding-top: 4rem; padding-bottom: 1.75rem; }
.site-footer a { color: #fff; text-decoration: underline; }
.site-footer a:hover { color: #fff; }

/* Four-column footer: logo + social, then three link columns. The first column
   is given a touch more room for the logo; the rest share the remainder. */
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.25rem;
}
.footer-brand { display: flex; flex-direction: column; gap: 1.25rem; }
.footer-logo { display: inline-block; }
.footer-logo img { height: 84px; width: auto; }
.footer-social { display: flex; align-items: center; gap: 1rem; }
.footer-social a { color: #d6edef; text-decoration: none; line-height: 0; }
.footer-social a:hover { color: #fff; }
.footer-social [class^="icon-"] { font-size: 1.4rem; }
/* Facebook is an inline SVG (the bundle lacks a square tile). The font tiles ink
   only ~0.875em of their 1.4rem box, so size the (full-bleed) SVG to that inked
   height to match; align-items:center keeps it level with the glyph baselines. */
.footer-social .social-svg {
  width: 1.22rem; height: 1.22rem; fill: currentColor; display: block;
  /* The font glyphs ink slightly below their box centre (a small descender);
     align-items:center alone leaves the SVG riding high, so drop it to match. */
  position: relative; top: 0.18em;
}
/* The icon font hard-codes the YouTube glyph red; override to match the set. */
.footer-social .icon-youtube:before { color: inherit; }

.footer-title {
  margin: 0 0 .9rem; color: #fff;
  font-size: 1rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: .5rem; }
.footer-links a { color: #d6edef; text-decoration: none; font-size: .95rem; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem 2rem; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.copyright { margin: 0; font-size: .92rem; }

/* =========================================================================
   Utilities
   ========================================================================= */
/* Stats Playground promo (home page only): a heading above the section tiles. */
.stats-nav-home-section { margin-top: 3rem; }
.stats-nav-home-title {
  text-align: center; margin: 0 0 1.5rem; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
  font-weight: 600; letter-spacing: -.015em;
}
.stats-nav-home-new { color: var(--accent); }

/* Email newsletter signup (home page only): a full-bleed band whose background runs
   edge-to-edge, with the form constrained to the normal content width inside. */
.newsletter-cta {
  margin-top: 3rem;
  padding-block: 2.5rem;
  /* Flat brand teal to match the MailerLite form box. --accent keeps its brand teal
     in dark mode (it also paints the header/footer), so this stays teal in both schemes. */
  background: var(--accent);
}
.newsletter-cta .ml-embedded { max-width: 32rem; margin: 0 auto; }

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

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

/* =========================================================================
   Dark mode — "night tide"
   Driven by [data-theme="dark"] on <html>, which tide-init.js sets before
   first paint from the saved choice, falling back to the OS preference — so
   auto-detection still happens and the header toggle can override it. (No JS =
   no attribute = light, the baseline.) The header and footer stay teal in both
   schemes, so --accent / --accent-700 keep their brand values; we only re-tint
   the page surfaces and the places where teal is used as *text on a card* (it
   must lift to a lighter teal to stay legible on the dark cards).
   ========================================================================= */
:root[data-theme="dark"] {
  --bg:          #0c1a1f;   /* deep water        */
  --bg-tint:     #102a31;
  --card:        #13272e;
  --text:        #e7eff1;
  --text-soft:   #c5d3d7;
  --muted:       #9fb3ba;
  --rule:        #244249;
  --rule-strong: #37636c;
  --accent-050:  #143038;   /* faint teal wash → dark teal surface */
  --link:        #5bc4df;   /* lagoon, lifted for dark */
  --link-hover:  #8ad8ee;
  --shadow:    0 1px 2px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
}

/* Teal used as text on a dark card — lift to a light teal so it stays legible
   (the token itself can't move: it also paints the teal header/footer band). */
:root[data-theme="dark"] :is(.block h3, .card h3, .page-link, .tag-pill,
  .alert-info, .gutter-label .kind, .content-info a:not(.icon-link), .content-tags a) {
  color: #7fd4da;
}
:root[data-theme="dark"] :is(.content-info a:not(.icon-link):hover, .content-tags a:hover) { color: #a6e3e8; }

/* The white header search button keeps dark teal text on its white face;
   only its hover (which fills with the dark teal wash) flips to light text. */
:root[data-theme="dark"] .btn-secondary { color: var(--accent-700); }
:root[data-theme="dark"] .btn-secondary:hover { color: #d7f1f3; }

/* Re-tint the light, hard-coded alert greens for the dark surface. */
:root[data-theme="dark"] .alert-success { background: #14302a; border-color: #2c5a44; color: #8fe0b3; }

/* Soften image hairlines, which were tuned for light cards. */
:root[data-theme="dark"] :is(figure img, .description img) { border-color: rgba(255,255,255,.14); }

/* =========================================================================
   Theme toggle (header) — moon in light mode (= switch to dark), sun in dark.
   Hidden until tide-init.js adds .js to <html>, so it never shows as a dead
   control when scripting is unavailable.
   ========================================================================= */
.theme-toggle { display: none; }
:root.js .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer; color: #dff0f1;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,.14); color: #fff; }
/* Bootstrap Icons, solid fill (toggle + gallery + RSS) share one box so the
   header set reads as a single family. */
.nav-links svg {
  width: 1.15rem; height: 1.15rem; display: block;
  fill: currentColor; stroke: none;
}
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
