/* =========================================================
   Minimal Theme -- RISC OS CMS
   Quiet, low-contrast monochrome. Lots of whitespace.
   Self-contained; no CDN, no web fonts.
   ========================================================= */

:root {
  --color-primary:   #000000;
  --color-primary-h: #333333;
  --color-text:      #1a1a1a;
  --color-muted:     #737373;
  --color-border:    #e5e5e5;
  --color-bg:        #fafafa;
  --color-surface:   #ffffff;
  --color-accent:    #000000;
  --max-width:       720px;
  --max-wide:        980px;
  --radius:          0;
  --font-sans:       system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif:      Georgia, "Times New Roman", Times, serif;
  --font-mono:       "Cascadia Code", "Fira Code", Consolas, monospace;
  --transition:      0.15s ease;
  --shadow:          none;
  --shadow-md:       0 1px 2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--color-surface); }
img { max-width: 100%; height: auto; display: block; }
a   { color: var(--color-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
}

.container      { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.container-wide { width: 100%; max-width: var(--max-wide);  margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; top: -100%; left: 8px; padding: 8px 16px;
  background: #000; color: #fff; z-index: 9999; font-size: 14px;
  transition: top var(--transition);
}
.skip-link:focus { top: 0; }

/* Header ----------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
  background: var(--color-surface);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.site-logo    { text-decoration: none; display: flex; align-items: center; gap: 10px; color: var(--color-text); }
.site-logo-image { max-height: 32px; width: auto; }
.logo-text    { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; color: var(--color-text); }
.logo-text:hover { color: var(--color-primary); }

.site-nav .nav-list { list-style: none; display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  padding: 6px 12px; text-decoration: none; color: var(--color-muted);
  font-size: 14px; font-weight: 500; letter-spacing: 0.02em;
  transition: color var(--transition);
}
.nav-link:hover         { color: var(--color-text); }
.nav-link.is-current    { color: var(--color-text); text-decoration: underline; text-underline-offset: 4px; }

.nav-toggle {
  display: none; background: none; border: 0; padding: 8px; cursor: pointer;
  width: 40px; height: 40px;
}
.nav-toggle span {
  display: block; width: 20px; height: 1px;
  background: var(--color-text); margin: 5px auto;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Main / hero ------------------------------------------------- */
.site-main { min-height: 60vh; }

.hero-section {
  text-align: left;
  padding: 80px 0 48px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 48px;
}
.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--color-text);
}
.hero-subtitle {
  font-size: 1.05rem; color: var(--color-muted); max-width: 600px;
  margin-bottom: 24px;
}
.btn-hero {
  display: inline-block; padding: 10px 20px;
  background: transparent; color: var(--color-text);
  border: 1px solid var(--color-text);
  text-decoration: none; font-weight: 500; font-size: 14px;
  letter-spacing: 0.02em;
}
.btn-hero:hover { background: var(--color-text); color: var(--color-surface); text-decoration: none; }

/* Buttons ----------------------------------------------------- */
.btn {
  display: inline-block; padding: 8px 18px; font-size: 14px;
  font-family: inherit; font-weight: 500; letter-spacing: 0.02em;
  text-decoration: none; border: 1px solid transparent;
  cursor: pointer; background: transparent;
  transition: background var(--transition), color var(--transition);
}
.btn-primary { background: var(--color-text); color: var(--color-surface); border-color: var(--color-text); }
.btn-primary:hover { background: var(--color-muted); border-color: var(--color-muted); text-decoration: none; }
.btn-outline { color: var(--color-text); border-color: var(--color-text); }
.btn-outline:hover { background: var(--color-text); color: var(--color-surface); text-decoration: none; }

/* Section headings, grids, cards ----------------------------- */
.section-heading {
  font-size: 13px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--color-muted);
  margin: 48px 0 24px; padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0;
}
.post-card {
  padding: 28px 24px; border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}
.post-card:hover { background: var(--color-bg); }
.post-card-body { padding: 0; }
.post-card-title { font-size: 1.1rem; font-weight: 500; margin: 6px 0; line-height: 1.35; }
.post-card-title a { color: var(--color-text); text-decoration: none; }
.post-card-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.view-all-wrap { text-align: center; margin: 32px 0 64px; }

/* Blog listings ---------------------------------------------- */
.blog-header { padding: 48px 0 24px; border-bottom: 1px solid var(--color-border); margin-bottom: 48px; }
.blog-title  { font-size: 2rem; font-weight: 400; letter-spacing: -0.01em; }

.post-list { display: flex; flex-direction: column; }
.post-list-item {
  padding: 32px 0; border-bottom: 1px solid var(--color-border);
}
.post-list-item:last-child { border-bottom: none; }
.post-list-title { font-size: 1.3rem; font-weight: 500; margin: 8px 0 12px; letter-spacing: -0.01em; line-height: 1.3; }
.post-list-title a { color: var(--color-text); text-decoration: none; }
.post-list-title a:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-meta { font-size: 12px; color: var(--color-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.post-meta time, .post-meta span { display: inline; }
.post-author { color: var(--color-muted); }
.post-excerpt { color: var(--color-muted); font-size: 15px; margin-bottom: 16px; max-width: 58ch; }
.post-excerpt p { margin: 0; }

.read-more-link { font-size: 13px; font-weight: 500; color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.read-more-link:hover { text-decoration: none; }

/* Single post / page ----------------------------------------- */
.single-post { max-width: var(--max-width); margin: 0 auto; padding: 64px 0; }
.post-header { margin-bottom: 40px; }
.post-title  {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 400; letter-spacing: -0.01em;
  line-height: 1.25; margin: 16px 0;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tag-link  {
  font-size: 12px; background: transparent; color: var(--color-muted);
  padding: 2px 10px; border: 1px solid var(--color-border); border-radius: 0;
  text-decoration: none; letter-spacing: 0.04em;
}
.tag-link:hover { border-color: var(--color-text); color: var(--color-text); }

.post-footer { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--color-border); }
.back-link   { font-size: 13px; color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.back-link:hover { text-decoration: none; }

.page-container { padding-top: 64px; padding-bottom: 64px; }
.page-header    { margin-bottom: 40px; }
.page-title     { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 400; letter-spacing: -0.01em; }
.page-subtitle  { color: var(--color-muted); font-size: 1.05rem; margin-top: 8px; }

.breadcrumbs { font-size: 13px; color: var(--color-muted); margin-bottom: 24px; }
.breadcrumbs a { color: var(--color-muted); }

/* Prose ------------------------------------------------------- */
.prose h1,.prose h2,.prose h3,.prose h4,.prose h5,.prose h6 {
  margin: 2em 0 0.6em; font-weight: 500; letter-spacing: -0.005em;
}
.prose h1 { font-size: 1.8rem; }
.prose h2 { font-size: 1.4rem; }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin: 0 0 1.25em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
.prose blockquote {
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--color-text);
  color: var(--color-muted); font-style: italic;
}
.prose code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--color-bg); padding: 1px 5px;
  border: 1px solid var(--color-border);
}
.prose pre {
  background: var(--color-bg); border: 1px solid var(--color-border);
  padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 0.9em;
}
.prose pre code { background: transparent; padding: 0; border: none; }
.prose img { margin: 1.5em 0; }
.prose a { color: var(--color-text); }
.prose a:hover { color: var(--color-muted); }

.prose table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: 14px; }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--color-border); text-align: left; }
.prose th { font-weight: 600; }

/* Photo albums ------------------------------------------------ */
.photo-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
}
.photo-item { margin: 0; }
.photo-item img {
  width: 100%; height: 240px; object-fit: cover;
  display: block;
  transition: opacity var(--transition);
}
.photo-item img:hover { opacity: 0.85; }
.photo-caption { font-size: 13px; color: var(--color-muted); padding: 8px 0 0; }

.empty-state { color: var(--color-muted); font-style: italic; padding: 32px 0; }

/* Pagination -------------------------------------------------- */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 48px 0; font-size: 14px; }
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--color-border); color: var(--color-text); text-decoration: none;
}
.pagination a:hover { border-color: var(--color-text); }
.pagination .current { background: var(--color-text); color: var(--color-surface); border-color: var(--color-text); }
.pagination .disabled { color: var(--color-muted); border-color: var(--color-border); }

/* Footer ------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 48px 0 32px; margin-top: 64px;
  background: var(--color-surface);
}
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 20px;
}
.footer-brand { font-size: 14px; font-weight: 600; color: var(--color-text); margin: 0; }
.footer-tagline { font-size: 13px; color: var(--color-muted); margin: 0; flex: 1 1 auto; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { font-size: 13px; color: var(--color-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }

/* Responsive -------------------------------------------------- */
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--color-surface); padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav .nav-list { flex-direction: column; gap: 0; }
  .nav-link { display: block; padding: 10px 0; }
  .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .photo-item img { height: 180px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* Dark mode follows system preference when theme_mode is 'auto' */
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"], body[data-theme="auto"] {
    --color-primary:   #ffffff;
    --color-primary-h: #cccccc;
    --color-text:      #f2f2f2;
    --color-muted:     #888888;
    --color-border:    #2a2a2a;
    --color-bg:        #161616;
    --color-surface:   #0d0d0d;
    --color-accent:    #ffffff;
  }
}
html[data-theme="dark"], body[data-theme="dark"] {
  --color-primary:   #ffffff;
  --color-primary-h: #cccccc;
  --color-text:      #f2f2f2;
  --color-muted:     #888888;
  --color-border:    #2a2a2a;
  --color-bg:        #161616;
  --color-surface:   #0d0d0d;
  --color-accent:    #ffffff;
}

/* ---- Homepage intro card + CTA buttons ---------------------- */
/* Optional editable intro rendered on the default homepage layout.
   Content comes from Admin -> Settings -> Homepage intro page.
   Buttons come from the Admin -> Menus -> Homepage menu. */
.home-intro-card {
  margin: 32px auto 16px;
  padding: 0;
}
.homepage-ctas {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
.homepage-ctas .btn { margin: 0; }

/* =============================================================
   ALBUM LIGHTBOX
   =============================================================
   Full-viewport overlay shown when a gallery photo is clicked.
   Caption is parked in a slim bar at the bottom that doesn't
   cover the image. Counter ("3 / 12") sits alongside.
   Colors pulled from the theme's existing custom properties, so
   the overlay visually belongs to whichever theme is active.
   ============================================================= */

html.lightbox-lock, html.lightbox-lock body { overflow: hidden; }

.lightbox {
  position: fixed; inset: 0;
  display: none;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  padding: 48px 56px 96px;
  box-sizing: border-box;
}
.lightbox.is-open { display: flex; align-items: center; justify-content: center; }

.lightbox-stage {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 144px);
  width: auto; height: auto;
  display: block;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  pointer-events: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 28px; line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.lightbox-close:hover, .lightbox-close:focus-visible {
  background: var(--color-primary, #fff);
  border-color: var(--color-primary, #fff);
  color: #000;
  outline: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 34px; line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-nav:hover, .lightbox-nav:focus-visible {
  background: var(--color-primary, #fff);
  border-color: var(--color-primary, #fff);
  color: #000;
  outline: none;
}

.lightbox-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 72px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  color: #fff;
  font-size: 14px;
  display: flex; align-items: baseline; gap: 20px;
  pointer-events: none;
  min-height: 48px;
}
.lightbox-counter {
  color: var(--color-primary, #fff);
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.lightbox-caption {
  flex: 1 1 auto;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  max-height: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 600px) {
  .lightbox { padding: 16px 16px 88px; }
  .lightbox-nav { width: 44px; height: 44px; font-size: 26px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 8px; right: 8px; width: 40px; height: 40px; font-size: 24px; }
  .lightbox-info { padding: 10px 14px; font-size: 13px; }
  .lightbox-image { max-height: calc(100vh - 120px); }
}

.lightbox:not(.is-open) { display: none !important; }


/* v5.9.3: protective marking banner (public-side render) and the
   UNCLASSIFIED permanent background rule. Per-marking user colours
   come from a nonced `<style>` block emitted via
   markings.style_block_for(), since CSP blocks inline styles. */
.marking-banner {
  color: #fff;
  text-align: center;
  padding: 10px 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 13px;
  text-transform: uppercase;
  margin: 0 0 20px 0;
  border-radius: 4px;
}
.marking-banner-bottom { margin: 28px 0 16px 0; }
.marking-bg-unclassified { background: #6b7280; }


/* v5.9.49: top-right login/admin button. Sits inside
   .header-inner after the nav. The flex layout in the
   existing header already places the right-most child
   at the right edge; the button just needs typography
   + colours that fit each theme's palette. */
.site-login-btn {
  display: inline-block;
  margin-left: 12px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid currentColor;
  opacity: 0.85;
  transition: opacity 0.15s, background-color 0.15s;
  white-space: nowrap;
}
.site-login-btn:hover,
.site-login-btn:focus {
  opacity: 1;
  text-decoration: none;
  outline: none;
}
@media (max-width: 720px) {
  /* On narrow viewports the nav collapses behind the
     hamburger; the login button stays visible but moves
     to a more pragmatic spot. */
  .site-login-btn {
    margin-left: 6px;
    padding: 4px 10px;
    font-size: 0.85rem;
  }
}

/* =================================================================
 * v5.9.78 — Phase 1 UX improvements (reduced-motion, print, forced-colors)
 * ================================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .btn, .nav-link, .post-card, .pagination-link {
    border: 1px solid ButtonText;
  }
  a:focus, .btn:focus, .nav-link:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}

@media print {
  /* Hide site chrome; the article is the artefact. */
  .site-header,
  .site-footer,
  .nav-toggle,
  .skip-link,
  .pagination,
  #lightbox {
    display: none !important;
  }

  /* Force light-on-white regardless of theme/dark-mode. */
  body, .site-body, .site-main {
    background: #fff !important;
    color: #000 !important;
  }

  a, a:visited {
    color: #000 !important;
    text-decoration: underline;
  }

  /* Show external URLs after each link for offline reading. */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 90%;
    font-style: italic;
  }

  /* Headings stay with their content; long blocks wrap. */
  h1, h2, h3 { page-break-after: avoid; }
  pre, code { white-space: pre-wrap !important; word-wrap: break-word !important; }
  img { max-width: 100% !important; page-break-inside: avoid; }
}
