/*
Theme Name: Courtside
Theme URI: https://example.com/courtside
Author: Custom Portfolio
Description: A lightweight dark photography portfolio theme engineered for sports, match coverage, and fluid masonry galleries.
Version: 1.10.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
Text Domain: courtside
*/

/* ---------------------------------------------------------------
   Colours. The theme is dark only. No orange: the accent is white,
   and hovers dim it slightly.
   --------------------------------------------------------------- */
:root {
  color-scheme: dark;
  --bg-main: #111112;
  --bg-card: #18181a;
  --bg-hover: #222226;
  --bg-header: rgba(17, 17, 18, 0.92);
  --border-color: #26262b;
  --text-main: #f3f3f3;
  --text-strong: #ffffff;
  --text-body: #c5c5c7;
  --text-muted: #8e8e93;
  --accent: #ffffff;
  --accent-hover: #c5c5c7;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 18px 4vw;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title a {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.site-title a:hover {
  color: var(--accent);
}

.primary-navigation {
  margin-left: auto;
}

.primary-navigation ul {
  display: flex;
  list-style: none;
  gap: 24px;
}

.primary-navigation a {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.primary-navigation a:hover,
.primary-navigation .current-menu-item a {
  color: var(--accent);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Filter Bar */
.filter-bar {
  max-width: 1600px;
  margin: 32px auto 0;
  padding: 0 4vw;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-btn {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--text-strong);
  border-color: var(--accent);
  background-color: var(--bg-hover);
}

/* Gallery Masonry Layout (Mixed Aspect Ratios) */
.gallery-container {
  max-width: 1600px;
  margin: 32px auto 80px;
  padding: 0 4vw;
}

.masonry-feed {
  column-count: 1;
  column-gap: 24px;
}

@media (min-width: 650px) {
  .masonry-feed {
    column-count: 2;
  }
}

@media (min-width: 1100px) {
  .masonry-feed {
    column-count: 3;
  }
}

.feed-item {
  break-inside: avoid;
  margin-bottom: 24px;
  background-color: var(--bg-card);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}

.feed-item img {
  width: 100%;
  height: auto;
  transition: transform 0.35s ease, opacity 0.2s ease;
}

.feed-item:hover img {
  transform: scale(1.02);
  opacity: 0.94;
}

/* The label and title sit on top of every photo in the feed, all the time. A light fade at the bottom keeps the white text readable. */
.feed-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.25) 28%, transparent 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
}

.overlay-meta {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: #ececf0; /* sits on a photo, so always light (the accent is dark in the light scheme) */
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.6);
}

.overlay-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* Match Single Page Details */
.match-single {
  padding: 40px 0 80px;
}

.match-header {
  max-width: 1600px;
  margin: 0 auto 40px;
  padding: 0 4vw;
}

.match-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.15;
  margin-bottom: 12px;
}

/* Competition / League / Subtitle, directly under the title */
.match-subtitle {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 400;
  color: var(--text-body);
  line-height: 1.4;
  margin: 0;
}

.match-specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px 28px;
  background-color: var(--bg-card);
  padding: 24px;
  border: 1px solid var(--border-color);
}

/* Details box sits below the gallery, lined up with the photo grid */
.match-single .gallery-container {
  margin-bottom: 40px;
}

.match-details {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 4vw;
}

.spec-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spec-cell.span-all {
  grid-column: 1 / -1;
}

.spec-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.spec-value {
  font-size: 0.95rem;
  color: var(--text-strong);
  font-weight: 500;
}

/* Body text sits below the gallery, the same width as the photo grid */
.match-body {
  max-width: 1600px;
  margin: 0 auto 40px;
  padding: 0 4vw;
}

.match-body-text {
  max-width: none;
  color: var(--text-body);
  font-size: 1rem;
  line-height: 1.7;
}

/* Standard Page Layout */
.standard-page {
  max-width: 850px;
  margin: 60px auto 100px;
  padding: 0 4vw;
}

.page-title {
  font-size: 2.25rem;
  margin-bottom: 30px;
  color: var(--text-strong);
}

.entry-content {
  color: var(--text-body);
  line-height: 1.75;
}

.entry-content p {
  margin-bottom: 1.5em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 4vw;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* Built-in Lightbox Overlay (stays dark in both modes: photos look best on dark) */
.cs-lightbox {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 10, 12, 0.96);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.cs-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.cs-lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 92vw;
}

.cs-lightbox-img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

/* Row under the photo: caption and credit on the left, photo count on the right.
   It is exactly as wide as the photo and never makes it wider. */
.cs-lightbox-meta {
  width: 0;
  min-width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.cs-lightbox-text {
  flex: 1 1 auto;
  min-width: 0;
}

.cs-lightbox-count {
  flex: none;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #8e8e93;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Caption: left edge lines up with the photo, and it never grows wider than the photo */
.cs-lightbox-caption {
  width: 0;
  min-width: 100%;
  max-height: 14vh;
  overflow-y: auto;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #c5c5c7;
}

/* Copyright / credit line, same left edge as the photo, smaller and quieter */
.cs-lightbox-credit {
  width: 0;
  min-width: 100%;
  margin-top: 6px;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #8e8e93;
}

.cs-lightbox-caption[hidden] + .cs-lightbox-credit {
  margin-top: 0;
}

.cs-lightbox-close,
.cs-lightbox-prev,
.cs-lightbox-next {
  position: absolute;
  background: transparent;
  border: none;
  color: #d0d0d4;
  font-size: 2rem;
  cursor: pointer;
  padding: 16px;
  line-height: 1;
  transition: color 0.2s;
}

.cs-lightbox-close:hover,
.cs-lightbox-prev:hover,
.cs-lightbox-next:hover {
  color: #fff; /* the viewer is always dark, so never use the (possibly dark) accent here */
}

.cs-lightbox-close { top: 16px; right: 24px; font-size: 2.5rem; }
.cs-lightbox-prev { left: 16px; }
.cs-lightbox-next { right: 16px; }

/* Mobile menu toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-strong);
}

@media (max-width: 700px) {
  .header-inner {
    flex-wrap: wrap;
  }

  /* Row 1: name on the left; menu button on the right. Row 2: the menu when open. */
  .site-title {
    margin-right: auto;
  }

  .nav-toggle {
    display: flex;
    order: 2;
    margin-left: 8px;
  }

  .primary-navigation {
    display: none;
    order: 3;
    width: 100%;
    padding-top: 16px;
  }

  .primary-navigation.is-open {
    display: block;
  }

  .primary-navigation ul {
    flex-direction: column;
    gap: 14px;
  }
}

/* Page content: WordPress block styles are active, so keep blocks readable in both modes */
.entry-content a {
  color: var(--accent);
  text-decoration: underline;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--text-strong);
  margin: 1.6em 0 0.6em;
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1.5em 1.5em;
}

.entry-content .wp-block-image img,
.entry-content .wp-block-gallery img {
  height: auto;
}

.entry-content .wp-element-caption,
.entry-content figcaption {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Pagination */
.pagination {
  margin-top: 40px;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pagination .page-numbers {
  font-size: 0.8rem;
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  color: var(--text-strong);
  border-color: var(--accent);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Blog posts: list tiles and single post */
.posts-header { max-width: 1600px; margin: 60px auto 30px; padding: 0 4vw; }
.posts-header .page-title { margin-bottom: 0; }
.post-tile .overlay-title { margin: 0; }
.post-tile-plain { padding: 24px 20px; min-height: 140px; display: flex; flex-direction: column; justify-content: flex-end; }
.post-tile a { color: inherit; text-decoration: none; display: block; }
.post-date { color: var(--text-muted); margin: -15px 0 25px; font-size: 0.85rem; }
.post-hero { margin: 0 0 30px; }
.post-hero img, .single-post-page .entry-content img { max-width: 100%; height: auto; display: block; }
.single-post-page { max-width: 1100px; }
.navigation.pagination { max-width: 1600px; margin: 0 auto 60px; padding: 0 4vw; color: var(--text-muted); }
.navigation.pagination .page-numbers { margin-right: 12px; color: var(--text-body); text-decoration: none; }

/* Pictures inside a blog post show on their own: no caption or text underneath. */
.single-post-page .entry-content figcaption,
.single-post-page .entry-content .wp-caption-text,
.single-post-page .entry-content .gallery-caption {
  display: none;
}

/* Posts list: every tile is the same shape (3:2), photos are cropped to fit */
.post-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 650px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
.post-grid .feed-item { margin-bottom: 0; aspect-ratio: 3 / 2; }
.post-grid .feed-item > a { display: block; width: 100%; height: 100%; }
.post-grid .feed-item img { width: 100%; height: 100%; object-fit: cover; }
.post-grid .post-tile-plain { height: 100%; min-height: 0; }

/* Post navigation: two tidy blocks, with room underneath */
.post-nav { margin: 60px 0 0; padding: 40px 0 0; border-top: 1px solid var(--border-color); display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.post-nav-link { display: block; padding: 18px 20px; border: 1px solid var(--border-color); border-radius: 2px; text-decoration: none; color: var(--text-body); transition: border-color 0.2s ease, background-color 0.2s ease; }
.post-nav-link:hover { border-color: var(--text-muted); background-color: var(--bg-hover); }
.post-nav-next { text-align: right; grid-column: 2; }
.post-nav-prev { grid-column: 1; }
.post-nav-label { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.post-nav-title { display: block; font-size: 1rem; font-weight: 600; color: var(--text-strong); }
.post-back { max-width: 1100px; margin: 36px auto 140px; padding: 0 4vw; text-align: center; font-size: 0.85rem; }
.post-back a { color: var(--text-muted); text-decoration: none; }
.post-back a:hover { color: var(--text-strong); }
@media (max-width: 649px) { .post-nav { grid-template-columns: 1fr; } .post-nav-next, .post-nav-prev { grid-column: 1; text-align: left; } }

/* Post sidebar (classic widgets), only when switched on */
.single-post-page.has-sidebar { max-width: 1400px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 60px; align-items: start; }
.single-post-page.has-sidebar .post-nav { margin-top: 50px; }
.single-post-page.has-sidebar .post-back { padding: 0; margin: 30px 0 60px; text-align: left; }
.post-sidebar .widget { margin-bottom: 40px; color: var(--text-body); font-size: 0.95rem; line-height: 1.6; }
.post-sidebar .widget-title { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.post-sidebar ul { list-style: none; margin: 0; padding: 0; }
.post-sidebar li { padding: 6px 0; }
.post-sidebar a { color: var(--text-body); text-decoration: none; }
.post-sidebar a:hover { color: var(--text-strong); }
.post-sidebar input[type="search"], .post-sidebar input[type="text"] { width: 100%; box-sizing: border-box; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-strong); border-radius: 2px; }
.post-sidebar input[type="submit"], .post-sidebar button { margin-top: 8px; padding: 8px 14px; background: transparent; border: 1px solid var(--border-color); color: var(--text-body); cursor: pointer; border-radius: 2px; }
@media (max-width: 899px) { .single-post-page.has-sidebar { grid-template-columns: 1fr; gap: 30px; } }

/* Keep wide pictures inside the post column so they never run into the sidebar */
.single-post-page .post-main { min-width: 0; }
.single-post-page .entry-content { overflow-wrap: break-word; }
.single-post-page .entry-content img,
.single-post-page .entry-content figure,
.single-post-page .entry-content .wp-caption,
.single-post-page .entry-content iframe,
.single-post-page .entry-content video { max-width: 100%; height: auto; }
.single-post-page .entry-content .wp-caption,
.single-post-page .entry-content figure { width: auto !important; }
.single-post-page .entry-content .alignright,
.single-post-page .entry-content .alignleft { max-width: 50%; }
.single-post-page .entry-content::after { content: ""; display: block; clear: both; }
@media (max-width: 649px) { .single-post-page .entry-content .alignright, .single-post-page .entry-content .alignleft { float: none; max-width: 100%; } }

/* Even-grid feed (layout A) for the home and work pages */
.grid-feed { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 650px) { .grid-feed { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid-feed { grid-template-columns: repeat(3, 1fr); } }
.grid-feed .feed-item { margin-bottom: 0; aspect-ratio: 3 / 2; }
.grid-feed .feed-item > a { display: block; width: 100%; height: 100%; }
.grid-feed .feed-item img { width: 100%; height: 100%; object-fit: cover; }

/* Home page hero (layout D) */
.home-hero { position: relative; display: block; height: min(62vh, 640px); min-height: 320px; overflow: hidden; background: var(--bg-card); text-decoration: none; }
.home-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.25) 35%, transparent 60%); }
.home-hero-text { position: absolute; z-index: 1; left: 4vw; right: 4vw; bottom: 40px; display: flex; flex-direction: column; gap: 8px; }
.home-hero-title { font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 700; line-height: 1.02; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,0.5); }
.home-recent { margin-top: 48px; }
.home-recent-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 24px; }
.home-recent-head h2 { margin: 0; font-size: 1.5rem; color: var(--text-strong); }
.home-recent-head a { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); text-decoration: none; }
.home-recent-head a:hover { color: var(--text-strong); }
.home-recent-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 560px) { .home-recent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .home-recent-grid { grid-template-columns: repeat(4, 1fr); } }
.home-recent-item { display: block; text-decoration: none; color: inherit; }
.home-recent-img { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-card); }
.home-recent-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease, opacity 0.2s ease; }
.home-recent-item:hover .home-recent-img img { transform: scale(1.02); opacity: 0.94; }
.home-recent-item .overlay-meta { display: block; margin-top: 10px; color: var(--text-muted); }
.home-recent-title { display: block; font-size: 1.1rem; font-weight: 600; color: var(--text-strong); line-height: 1.2; margin-top: 2px; }

/* Viewer with a row of thumbnails (layout C) */
.viewer-strip .cs-lightbox { flex-direction: column; justify-content: center; padding-bottom: 96px; box-sizing: border-box; }
.viewer-strip .cs-lightbox-img { max-height: 66vh; }
.cs-lightbox-thumbs { position: absolute; left: 0; right: 0; bottom: 0; height: 84px; display: flex; gap: 8px; padding: 10px 72px; overflow-x: auto; justify-content: center; box-sizing: border-box; }
.cs-thumb { flex: 0 0 auto; width: 96px; height: 64px; border: 2px solid transparent; background: #222 center/cover no-repeat; padding: 0; cursor: pointer; opacity: 0.6; }
.cs-thumb:hover { opacity: 1; }
.cs-thumb.is-current { border-color: #fff; opacity: 1; }
@media (max-width: 649px) { .cs-lightbox-thumbs { justify-content: flex-start; padding: 10px 12px; } }

/* More photo layouts. Each tile carries --ar (its width / height). */
.justified-feed { display: flex; flex-wrap: wrap; gap: 12px; }
.justified-feed::after { content: ""; flex-grow: 999; }
.justified-feed .feed-item { margin: 0; flex: calc(var(--ar, 1.5) * 100) 1 calc(var(--ar, 1.5) * 260px); min-width: 0; }
.justified-feed .feed-item img { display: block; width: 100%; height: auto; }

.column-feed { display: flex; flex-direction: column; gap: 36px; max-width: 1200px; margin: 0 auto; }
.column-feed .feed-item { margin: 0; }
.column-feed .feed-item img { display: block; width: 100%; height: auto; }

.mosaic-feed { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; grid-auto-flow: dense; gap: 16px; }
@media (min-width: 900px) { .mosaic-feed { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 220px; } }
.mosaic-feed .feed-item { margin: 0; }
.mosaic-feed .feed-item:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic-feed .feed-item > a { display: block; width: 100%; height: 100%; }
.mosaic-feed .feed-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.contact-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.contact-feed .feed-item { margin: 0; aspect-ratio: 1 / 1; }
.contact-feed .feed-item > a { display: block; width: 100%; height: 100%; }
.contact-feed .feed-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.contact-feed .overlay-meta { display: none; }
.contact-feed .overlay-title { font-size: 0.8rem; }
.contact-feed .feed-overlay, .contact-feed .post-tile-plain { padding: 8px; }

/* Match story: wide photos run full width, tall ones are narrower and centred (width follows the photo's shape) */
.story-feed { display: flex; flex-direction: column; gap: 40px; }
.story-feed .feed-item { margin: 0 auto; width: min(100%, calc(var(--ar, 1.5) * 82vh)); max-width: 1500px; }
.story-feed .feed-item img { display: block; width: 100%; height: auto; }

/* Split screen: first photo stays in view on the left, the rest scroll on the right */
.split-feed { display: grid; grid-template-columns: 1fr; column-gap: 24px; row-gap: 0; align-items: start; }
.split-feed .feed-item { margin: 0 0 24px; }
.split-feed .feed-item img { display: block; width: 100%; height: auto; }
@media (min-width: 900px) {
  .split-feed { grid-template-columns: 1fr 1fr; }
  .split-feed .feed-item { grid-column: 2; }
  .split-feed .feed-item:first-child { grid-column: 1; grid-row: 1 / span 200; position: sticky; top: 24px; align-self: start; }
  .split-feed .feed-item:first-child img { width: 100%; max-height: calc(100vh - 48px); object-fit: cover; }
}

/* Angled collage (home page) */
.home-collage { display: flex; flex-wrap: wrap; max-width: 1600px; margin: 32px auto 0; padding: 0 4vw; overflow: hidden; }
.home-collage-tile { position: relative; display: block; flex: 0 0 34%; margin: 0 -1% 8px 0; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-card); clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%); text-decoration: none; }
.home-collage-tile:nth-child(3n) { margin-right: 0; }
.home-collage-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.home-collage-tile:hover img { transform: scale(1.04); }
.home-collage-label { position: absolute; left: 12%; bottom: 14px; right: 12%; color: #fff; font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,0.7); font-size: 1.05rem; }
.home-collage-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.55), transparent 45%); pointer-events: none; }
.home-collage-label { z-index: 1; }
@media (max-width: 649px) { .home-collage-tile { flex: 0 0 51%; } .home-collage-tile:nth-child(3n) { margin-right: -1%; } .home-collage-tile:nth-child(2n) { margin-right: 0; } }

/* Gallery under a post or page */
.cs-post-gallery { margin-top: 40px; }
.single-post-page .cs-post-gallery .feed-item img { max-width: none; }
.single-post-page .entry-content .grid-feed .feed-item img,
.single-post-page .entry-content .mosaic-feed .feed-item img,
.single-post-page .entry-content .contact-feed .feed-item img { height: 100%; object-fit: cover; }
.single-post-page .entry-content .masonry-feed .feed-item img,
.single-post-page .entry-content .justified-feed .feed-item img,
.single-post-page .entry-content .column-feed .feed-item img,
.single-post-page .entry-content .story-feed .feed-item img,
.single-post-page .entry-content .split-feed .feed-item img { width: 100%; height: auto; }
.standard-page .entry-content .cs-post-gallery { max-width: none; }

/* Horizontal scroller */
.scroller-feed { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; -webkit-overflow-scrolling: touch; }
.scroller-feed .feed-item { flex: 0 0 auto; height: min(72vh, 640px); margin: 0; aspect-ratio: var(--ar, 1.5); }
.scroller-feed .feed-item > a { display: block; height: 100%; }
.scroller-feed .feed-item img { height: 100%; width: auto; max-width: none; display: block; }

/* Mosaic with the big photo in the centre */
.mosaicc-feed { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 180px; grid-auto-flow: dense; gap: 16px; }
@media (min-width: 900px) { .mosaicc-feed { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 210px; } }
.mosaicc-feed .feed-item { margin: 0; }
.mosaicc-feed .feed-item:first-child { grid-column: span 2; grid-row: span 2; }
@media (min-width: 900px) { .mosaicc-feed .feed-item:first-child { grid-column: 2 / span 2; grid-row: 1 / span 2; } }
.mosaicc-feed .feed-item > a { display: block; width: 100%; height: 100%; }
.mosaicc-feed .feed-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.single-post-page .entry-content .mosaicc-feed .feed-item img { height: 100%; object-fit: cover; }
.single-post-page .entry-content .scroller-feed .feed-item img { height: 100%; width: auto; max-width: none; }

/* Contact sheet: square thumbnails with a monospaced file number under each */
.cs-fileno { display: none; }
.contact-feed .feed-item { aspect-ratio: auto; }
.contact-feed .feed-item > a { aspect-ratio: 1 / 1; }
.contact-feed .cs-fileno { display: block; margin-top: 6px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Full-screen hero archive (Work page) */
html:has(.archive-hero-list) { scroll-snap-type: y proximity; }
.archive-hero-list { margin: 0 -4vw; }
.archive-hero { position: relative; display: block; height: calc(100vh - 64px); height: calc(100svh - 64px); min-height: 420px; overflow: hidden; background: var(--bg-card); text-decoration: none; }
.archive-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.archive-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 35%, transparent 60%); }
.archive-hero-text { position: absolute; z-index: 1; left: 4vw; right: 4vw; bottom: 40px; display: flex; flex-direction: column; gap: 8px; }
.archive-hero-title { font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 700; line-height: 1.02; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,0.5); }

/* Rounded corners (setting) */
.rounded-on .feed-item, .rounded-on .home-recent-img, .rounded-on .archive-hero, .rounded-on .cs-thumb,
.rounded-on .post-nav-link, .rounded-on .home-hero, .rounded-on .spec-cell { border-radius: 12px; }
.rounded-on .feed-item { overflow: hidden; }
.rounded-on .home-hero, .rounded-on .archive-hero { border-radius: 0 0 24px 24px; }
.rounded-on .cs-lightbox-img { border-radius: 8px; }
.rounded-on .post-sidebar input[type="search"], .rounded-on .post-sidebar input[type="text"] { border-radius: 8px; }

/* Light colour scheme (setting) */
body.scheme-light {
  color-scheme: light;
  --bg-main: #f6f5f2;
  --bg-card: #ecebe7;
  --bg-hover: #e3e2dd;
  --bg-header: rgba(246, 245, 242, 0.92);
  --border-color: #dcdad4;
  --text-main: #1b1b1d;
  --text-strong: #000000;
  --text-body: #3a3a3d;
  --text-muted: #6c6c72;
  --accent: #1b1b1d;
  --accent-hover: #55555a;
}

/* Honeycomb list of matches (Work page): hexagon tiles, titles always shown, no limit on the number of matches */
.honeycomb-feed { display: flex; flex-wrap: wrap; }
.hex-item { aspect-ratio: 1 / 1.1547; position: relative; }
.hex-item a { display: block; position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--border); text-decoration: none; transform: scale(0.97); transition: transform 0.25s;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.hex-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.hex-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 16%; background: rgba(0, 0, 0, 0.45); color: #fff; transition: background 0.25s; }
.hex-sport { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: #ececf0; margin-bottom: 4px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.hex-title { font-size: clamp(0.78rem, 1.5vw, 1.15rem); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hex-item a:hover { transform: scale(1); }
.hex-item a:hover img { transform: scale(1.06); }
.hex-item a:hover .hex-text { background: rgba(0, 0, 0, 0.25); }
@media (max-width:599px) {
  .honeycomb-feed { padding-bottom: calc(57.735% / 5); }
  .hex-item { width: calc(200% / 5 - 0.5px); margin-bottom: calc(-57.735% / 5); }
  .hex-item:nth-child(4n + 3) { margin-left: calc(100% / 5); }
}
@media (min-width:600px) and (max-width:899px) {
  .honeycomb-feed { padding-bottom: calc(57.735% / 7); }
  .hex-item { width: calc(200% / 7 - 0.5px); margin-bottom: calc(-57.735% / 7); }
  .hex-item:nth-child(6n + 4) { margin-left: calc(100% / 7); }
}
@media (min-width:900px) and (max-width:1299px) {
  .honeycomb-feed { padding-bottom: calc(57.735% / 9); }
  .hex-item { width: calc(200% / 9 - 0.5px); margin-bottom: calc(-57.735% / 9); }
  .hex-item:nth-child(8n + 5) { margin-left: calc(100% / 9); }
}
@media (min-width:1300px) and (max-width:1799px) {
  .honeycomb-feed { padding-bottom: calc(57.735% / 11); }
  .hex-item { width: calc(200% / 11 - 0.5px); margin-bottom: calc(-57.735% / 11); }
  .hex-item:nth-child(10n + 6) { margin-left: calc(100% / 11); }
}
@media (min-width:1800px) {
  .honeycomb-feed { padding-bottom: calc(57.735% / 13); }
  .hex-item { width: calc(200% / 13 - 0.5px); margin-bottom: calc(-57.735% / 13); }
  .hex-item:nth-child(12n + 7) { margin-left: calc(100% / 13); }
}
