/* =========================================================================
   sandsea — a clean, lightweight, non-Bootstrap theme for Tuskfish
   Palette: "bright skies, blue sea, golden sand". Hand-written, no framework, mobile-first.
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* Sand & sea palette */
  --bg:          #f4f9fc;
  --bg-tint:     #e7f1f8;
  --card:        #ffffff;
  --text:        #102a3c;
  --muted:       #5a7384;
  --text-soft:   #2f4a5b;
  --rule:        #d6e3ec;
  --rule-strong: #bcd1e0;
  --accent:      #136aa3;
  --accent-700:  #0e527e;
  --accent-050:  #e3f0fa;
  --link:        #115e92;
  --link-hover:  #0c4670;
  --sand:        #e6c87e;
  --coral:       #cf7d22;
  --coral-700:   #b0691a;
  --coral-050:   #fbecd8;

  /* Type scale (fluid) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-heading: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --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(16, 42, 60, .06), 0 6px 18px rgba(16, 42, 60, .06);
  --shadow-sm: 0 1px 2px rgba(16, 42, 60, .08);
  --img-border: 1px solid rgba(16, 42, 60, .18);   /* hairline on figure imagery */
}

/* ---- 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); font-family: var(--font-heading); }
.page-title, .featured-title, .stream-item .title, .article .title, .brand-text, .footer-title { font-family: var(--font-heading); }
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); }

/* =========================================================================
   Responsive images — srcset / sizes MAP   (read before changing any width)
   -------------------------------------------------------------------------
   The srcset "rungs" and the `sizes` hint live in the TEMPLATES, not here —
   see $content->cachedImageSrcset([...]) and the sizes="..." attribute in each
   .html file. `sizes` must mirror the display width the CSS below produces:
   change a max-width / padding / breakpoint here and you MUST recompute `sizes`
   (and revisit the rungs) in the listed template(s), or the browser fetches a
   too-small (blurry) or too-large (wasteful) image.

   Layout inputs the maths is derived from (all defined elsewhere in this file):
     --container ........ 1140px          max content width
     .container ......... padding-inline  clamp(1rem, .5rem + 2vw, 2rem)
     .article ........... padding         clamp(1.25rem, .8rem + 2vw, 2.5rem)
     phone breakpoint ... max-width: 560px  (figures drop to full width)

   Each governing rule below is tagged  «srcset: NAME»  — search that tag to
   jump between this map and the rule.

   NAME            CSS rule (this file)        template(s)        src / rungs / sizes
   -------------------------------------------------------------------------
   stream-thumb    .figure-left (200px cap)    listView.html      src 200
                                               search.html        rungs [200,400,600,800]
                                                                  sizes (max-width:560px) calc(96vw - 61px), 200px

   child-thumb     .article .figure-left       children.html      src 200
                   (nested, 200px cap)         parent.html        rungs [200,400,600,800]
                                                                  sizes (max-width:560px) calc(92vw - 42px), 200px

   figure-side     .figure-right (40%) and     collection.html        src 640
                   .article > .figure-left     collection-compact.html rungs [320,400,640,800]
                   (40%, the left mirror)      tag.html, download.html (40% of ~996 ≈ 398 → 400 @1x)
                                               article-right.html      sizes (max-width:560px) calc(92vw - 42px), 400px
                                               article-left.html
                                               audio.html

   figure-centre   .figure-centre img (100%)   article.html       src 996
                                               image.html         rungs [400,680,996,1400,1992]
                                               track.html         sizes (min-width:1140px) 996px, calc(92vw - 42px)

   gallery-tile    .gallery-grid               gallery.html       src 400
                   (minmax(220px,1fr), 4/3)                       rungs [260,400,520,800]
                                                                  sizes (min-width:1200px) 251px,
                                                                        (min-width:1008px) calc((96vw - 88px)/4),
                                                                        (min-width:754px)  calc((96vw - 64px)/3),
                                                                        (min-width:500px)  calc((96vw - 40px)/2),
                                                                        calc(96vw - 16px)
   ========================================================================= */

/* =========================================================================
   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 tight and
   set apart from the menu. Their visible gap is button padding, so trim that —
   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) vs the full-bleed rss/moon/sun, so it
   renders short — nudge it up to match. Its path also touches the box's right
   edge, which the viewport clips when enlarged: allow 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: #102a3c; 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 at the container's 1140px max: with the dropdown +
   search, the nav row only fits above that width; below it the menu wraps
   against the logo. */
@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): a 600 weight and smaller size read less
     heavy above their own content. */
  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 +
   underline (not size); a small teal tag icon adds colour without pill bulk.
   Exclude icon links from the underline. */
.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 colour it only when
   it's a link (<a>). A non-linked title renders the icon in a <span>, which
   stays 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 drops every glyph 0.115em onto the body-text baseline; in the
   larger headings that sinks it below the text. Cancel the nudge inside titles. */
.title [class^="icon-"], .title [class*=" icon-"] { top: .06em; }
/* The same 0.115em nudge drops RSS/tag glyphs below the small meta text. They're
   inline-block (vendor `a > [icon]`), so vertical-align:middle sinks them — pin
   to the baseline and lift slightly to 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; display: flow-root;   /* contains the floated thumbnail */
  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. Hidden when there's no gutter; the same type/date then appears
   inline in .content-info. */
.gutter-label { display: none; }
/* Absolutely positioned into the free space LEFT of the centred content
   (right:100%). That space only exists once (vw - content)/2 exceeds the gutter
   width — ~1480px; showing it earlier overflows and triggers horizontal scroll. */
@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); }
/* Secondary tier: lighter than the base heading 700 so it harmonises with the
   600-weight h1 page title (and the matching .block titles). */
.stream-item .title { margin-bottom: .35rem; font-size: var(--h3); font-weight: 600; }
.stream-item .teaser { color: var(--text-soft); }
.stream-item .teaser p:last-child { margin-bottom: 0; }
/* .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. The max-widths below drive the responsive-image `sizes`
   in the templates — see the srcset MAP at the top; each rule is tagged
   «srcset: NAME». */
figure { margin: 0; }
figure img { border-radius: var(--radius-sm); border: var(--img-border); }
figcaption { color: var(--muted); font-size: .88rem; margin-top: .4rem; }
/* «srcset: stream-thumb» (streams) / «child-thumb» (.article child & parent lists) */
.figure-left  { float: left;  margin: .25rem 1.25rem 1rem 0; max-width: 200px; }
/* «srcset: figure-side» */
.figure-right { float: right; margin: .25rem 0 1rem 1.25rem; max-width: 40%; }
/* A left-floated article body image mirrors .figure-right at 40%, not the 200px
   thumbnail cap. .figure-left is otherwise the stream/child-list thumbnail
   (nested deeper, not a direct .article child), so widen only the direct child.
   «srcset: figure-side» (shares the right mirror's rungs/sizes). */
.article > .figure-left { max-width: 40%; }
/* «srcset: figure-centre» */
.figure-centre { margin: 1.25rem auto; }
.figure-centre img { width: 100%; }

@media (max-width: 560px) {
  /* Nudge body text up a touch more on phones. */
  body { font-size: 1.1875rem; }
  /* Phone full-width branch of every figure `sizes` (the "(max-width:560px) …"
     clause). Move this breakpoint and you must update that clause in every
     figure template — see the srcset map. */
  .figure-left, .figure-right { float: none; margin: 0 0 1rem; max-width: 100%; }
  /* Match the .article > .figure-left specificity above so the body image also
     goes full width on phones. */
  .article > .figure-left { 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 body text, so
   add a standing underline and a 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: var(--img-border); margin: 1rem 0; }
.description h2, .description h3 { margin-top: 1.6rem; }
/* Clearfix (not flow-root): the body text must wrap around a preceding sibling
   thumbnail (.figure-right/-left in article-right/-left.html). flow-root would
   make .description a BFC, which refuses to overlap that float and drops into a
   column beside it. The pseudo-element only contains .description's own internal
   floats (body images), leaving the external wrap intact. */
.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 in teasers/descriptions. A teaser wraps beside a floated
   thumbnail, so a plain list would start behind the float and strand its outside
   markers. `display: flow-root` gives each list its own BFC, so it sits in the
   text column beside the float and the markers hang correctly. Harmless where
   there's 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);
  /* flow-root contains a floated thumbnail so a tall image / short teaser
     doesn't spill past the block's bottom edge. */
  display: flow-root;
}
/* Parent / child titles share the stream teaser heading (var(--h3), weight 600);
   placed after `.article .title` so it wins on source order at equal specificity. */
.related .title, .collection-children .title { font-size: var(--h3); font-weight: 600; margin-bottom: .35rem; }
.child-item { padding: 1rem 0; border-bottom: 1px solid var(--rule); display: flow-root; }
.child-item:last-child { border-bottom: 0; }

/* =========================================================================
   Gallery (CSS grid)
   ========================================================================= */
/* «srcset: gallery-tile» — the minmax() track width, the --gap, the container
   padding and the 4/3 aspect-ratio all feed gallery.html's `sizes` breakpoints;
   change any of them and recompute that sizes string. See the srcset map. */
.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-content .featured-title { text-align: center; margin: 0 0 2rem; font-size: var(--h2) !important; 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; }
/* Printed-photo framing: white mat, thin stroke, soft shadow that lifts on
   hover (slow, eased). */
.featured-thumb {
  display: block; overflow: hidden;
  background: #fff; padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(16, 42, 60, .12);
  transition: box-shadow .25s ease, transform .25s ease;
  margin-bottom: .8rem;
}
.featured-thumb img { width: 100%; height: auto; display: block; }
.featured-card:hover .featured-thumb {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(16, 42, 60, .18);
}
/* The global reduced-motion rule kills all transitions with !important;
   re-enable this one gentle decorative lift. */
@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); }
/* Both blocks carry their own full-width layout, so strip the standard .block
   card chrome (background, border, accent bar, shadow, padding) when wrapping
   one — the featured-video player then sits seamlessly on the page. */
.block:has(.featured-content), .block:has(.featured-video) {
  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 block region is the last thing on the page (no pagination to space it
   off), add 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 titles arrive from shared templates at mixed levels (Spotlight/
   Featured-video <h2>; Recent-content/HTML <h3>). Normalise both to the
   content-stream tier — var(--h3)/600 — so the home page reads as one h1 over a
   uniform secondary tier; card chrome (border + accent bar), not title size,
   sets a block apart. Applies wherever the block sits. Linked titles (Spotlight)
   take the link colour like stream titles; unlinked ones stay text colour. */
.block :is(h2, h3) {
  font-size: var(--h3); font-weight: 600; line-height: 1.25;
  margin: 0 0 .6rem; letter-spacing: -.005em; color: var(--text);
}
.block :is(h2, h3) a { color: var(--link); text-decoration: none; }
.block :is(h2, h3) a:hover { color: var(--link-hover); text-decoration: underline; }
.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/sandsea/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: #bcdcf2; 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; }

/* =========================================================================
   Footer
   ========================================================================= */
/* The footer is the surface of the water: a teal band whose top edge is a
   crisp, repeating wave (fixed 800px 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 crest fills with the *page* colour (var(--bg) revealed through an SVG
   mask, not baked into the SVG) so it stays matched to the background in both
   light and dark — a hard-coded fill leaves a pale band above the wave in dark. */
.site-footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 24px;
  background: var(--bg);
  -webkit-mask: repeat-x top / 800px 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 V6 C66,6 60,20 40,20 C20,20 14,6 0,6 Z'/%3E%3C/svg%3E");
          mask: repeat-x top / 800px 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 V6 C66,6 60,20 40,20 C20,20 14,6 0,6 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 gets a
   little more room for the logo. */
.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 height
   to match. */
.footer-social .social-svg {
  width: 1.22rem; height: 1.22rem; fill: currentColor; display: block;
  /* Font glyphs ink slightly below box centre, so align-items:center leaves the
     SVG riding high — 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
   ========================================================================= */
.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>, set by tide-init.js before first
   paint from the saved choice, falling back to OS preference (no JS = light).
   Header and footer stay teal in both schemes, so --accent / --accent-700 keep
   their brand values; we only re-tint the page surfaces and teal-as-text-on-card
   (which must lift to a lighter teal to stay legible on dark cards).
   ========================================================================= */
:root[data-theme="dark"] {
  --bg:          #0a1925;
  --bg-tint:     #0f2636;
  --card:        #12293b;
  --text:        #e8f0f7;
  --text-soft:   #c3d3df;
  --muted:       #97aebd;
  --rule:        #233d4f;
  --rule-strong: #345871;
  --accent-050:  #122c3e;
  --link:        #5cb7e8;
  --link-hover:  #8fd0f3;
  --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(.card h3, .page-link, .tag-pill,
  .alert-info, .gutter-label .kind, .content-info a:not(.icon-link), .content-tags a) {
  color: #82bdec;
}
:root[data-theme="dark"] :is(.content-info a:not(.icon-link):hover, .content-tags a:hover) { color: #aad4f5; }

/* 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: #d6e9fb; }

/* 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; }
