/*
Theme Name:        CraftBook Custom Theme V1
Theme URI:         https://www.craftbook.co.uk
Author:            Paul Riley
Author URI:        https://www.craftbook.co.uk/about
Description:       A custom magazine-style WordPress theme for CraftBook — exploring technology, creativity, business and society. Built for performance, accessibility and SEO best practice.
Version:           1.0.0
Requires at least: 6.4
Tested up to:      6.7
Requires PHP:      8.0
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       craftbook
Tags:              magazine, blog, custom-colors, custom-logo, custom-menu, featured-images, full-width-template, sticky-post, threaded-comments, accessibility-ready, rtl-language-support
*/

/* =============================================================================
   TABLE OF CONTENTS
   1.  Design Tokens (Edit Here)
   2.  Dark Mode Tokens
   3.  CSS Reset & Normalisation
   4.  Base Typography
   5.  Links
   6.  Layout & Grid
   7.  Utility Classes
   8.  Screen Reader & Accessibility
   9.  Skip Link
   10. Selection Styles
   11. Print Styles (basic — extended in assets/css/print.css)
   ============================================================================= */


/* =============================================================================
   1. DESIGN TOKENS — EDIT HERE
   All visual decisions are defined in this section as CSS custom properties.
   To change the accent colour: update --color-accent and --color-accent-hover.
   To change fonts: update --font-heading and --font-body, then update the
   @import in assets/css/fonts.css accordingly.
   ============================================================================= */

:root {

  /* --- Colour Palette --- */
  --color-background:        #F8F7F4;   /* Warm off-white — easy on the eyes for reading */
  --color-background-alt:    #FFFFFF;   /* Pure white for cards and elevated surfaces */
  --color-background-subtle: #F0EFEB;   /* Slightly darker for section backgrounds */

  --color-text:              #1A1A2E;   /* Deep charcoal — easier to read than pure black */
  --color-text-light:        #4B5563;   /* Mid-tone for secondary text */
  --color-meta:              #6B7280;   /* Metadata: dates, reading time, category labels */
  --color-placeholder:       #9CA3AF;   /* Input placeholders */

  --color-accent:            #2D6A4F;   /* Deep teal — primary accent colour */
  --color-accent-hover:      #1B4332;   /* Darker teal for hover states */
  --color-accent-light:      #D1FAE5;   /* Very light teal for backgrounds/badges */
  --color-accent-amber:      #D97706;   /* Warm amber — used sparingly for highlights */
  --color-accent-amber-hover:#B45309;   /* Darker amber for hover */

  --color-border:            #E5E7EB;   /* Light grey for dividers and borders */
  --color-border-strong:     #D1D5DB;   /* Slightly stronger border for inputs */

  --color-heading:           #111827;   /* Near-black for headings — slightly richer than body */
  --color-link:              #2D6A4F;   /* Links match accent */
  --color-link-hover:        #1B4332;   /* Darker on hover */

  --color-focus:             #2D6A4F;   /* Focus ring colour — accessible contrast */
  --color-focus-offset:      #F8F7F4;   /* Focus ring offset matches background */

  --color-overlay:           rgba(17, 24, 39, 0.6);   /* Dark overlay for hero images */
  --color-overlay-strong:    rgba(17, 24, 39, 0.8);   /* Stronger overlay */

  --color-success:           #065F46;
  --color-error:             #991B1B;
  --color-warning:           #92400E;

  /* --- Typography --- */
  --font-heading:    'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-ui:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:       'Courier New', Courier, monospace;

  /* --- Font Sizes (fluid, using clamp for responsive scaling) --- */
  --text-xs:    clamp(0.694rem,  0.67rem  + 0.12vw, 0.75rem);   /* ~11–12px */
  --text-sm:    clamp(0.833rem,  0.8rem   + 0.17vw, 0.938rem);  /* ~13–15px */
  --text-base:  clamp(1rem,      0.96rem  + 0.2vw,  1.125rem);  /* ~16–18px */
  --text-md:    clamp(1.125rem,  1.07rem  + 0.28vw, 1.313rem);  /* ~18–21px */
  --text-lg:    clamp(1.266rem,  1.19rem  + 0.38vw, 1.563rem);  /* ~20–25px */
  --text-xl:    clamp(1.424rem,  1.32rem  + 0.52vw, 1.875rem);  /* ~23–30px */
  --text-2xl:   clamp(1.602rem,  1.46rem  + 0.71vw, 2.25rem);   /* ~26–36px */
  --text-3xl:   clamp(1.802rem,  1.6rem   + 1.01vw, 2.7rem);    /* ~29–43px */
  --text-4xl:   clamp(2.027rem,  1.73rem  + 1.49vw, 3.247rem);  /* ~32–52px */
  --text-5xl:   clamp(2.281rem,  1.84rem  + 2.2vw,  3.9rem);    /* ~37–62px */

  /* --- Font Weights --- */
  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;
  --weight-black:     900;

  /* --- Line Heights --- */
  --leading-none:     1;
  --leading-tight:    1.2;
  --leading-snug:     1.35;
  --leading-normal:   1.5;
  --leading-relaxed:  1.65;
  --leading-loose:    1.8;

  /* --- Letter Spacing --- */
  --tracking-tight:   -0.025em;
  --tracking-normal:  0;
  --tracking-wide:    0.025em;
  --tracking-wider:   0.05em;
  --tracking-widest:  0.1em;

  /* --- Spacing Scale (based on 4px baseline grid) --- */
  --space-1:    0.25rem;   /*  4px */
  --space-2:    0.5rem;    /*  8px */
  --space-3:    0.75rem;   /* 12px */
  --space-4:    1rem;      /* 16px */
  --space-5:    1.25rem;   /* 20px */
  --space-6:    1.5rem;    /* 24px */
  --space-8:    2rem;      /* 32px */
  --space-10:   2.5rem;    /* 40px */
  --space-12:   3rem;      /* 48px */
  --space-16:   4rem;      /* 64px */
  --space-20:   5rem;      /* 80px */
  --space-24:   6rem;      /* 96px */
  --space-32:   8rem;      /* 128px */

  /* --- Layout --- */
  --container-sm:     640px;
  --container-md:     768px;
  --container-lg:     1024px;
  --container-xl:     1200px;
  --container-2xl:    1400px;
  --content-width:    1200px;    /* Full container width — matches homepage */
  --sidebar-width:    320px;

  --header-height:          64px;
  --header-height-scrolled: 56px;

  /* --- Borders --- */
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-xl:    16px;
  --radius-full:  9999px;

  --border-width:       1px;
  --border-width-thick: 2px;
  --border-width-heavy: 4px;

  /* --- Shadows --- */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* --- Transitions --- */
  --transition-fast:    150ms ease;
  --transition-base:    200ms ease;
  --transition-slow:    300ms ease;
  --transition-slower:  400ms ease;

  /* --- Z-Index Scale --- */
  --z-below:      -1;
  --z-base:        0;
  --z-raised:     10;
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-toast:     500;

}


/* =============================================================================
   2. DARK MODE TOKENS
   Applied automatically when OS is in dark mode, and toggled via
   [data-theme="dark"] attribute on <html> (set by JavaScript toggle).
   ============================================================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-background:        #0F1117;
    --color-background-alt:    #1A1D27;
    --color-background-subtle: #151821;

    --color-text:              #E8E6E0;
    --color-text-light:        #A8A29E;
    --color-meta:              #78716C;
    --color-placeholder:       #57534E;

    --color-accent:            #4ADE80;   /* Lighter teal-green for dark mode legibility */
    --color-accent-hover:      #86EFAC;
    --color-accent-light:      #052E16;
    --color-accent-amber:      #FCD34D;
    --color-accent-amber-hover:#FDE68A;

    --color-border:            #2D2D3A;
    --color-border-strong:     #3D3D4E;

    --color-heading:           #F3F1EC;
    --color-link:              #4ADE80;
    --color-link-hover:        #86EFAC;

    --color-focus:             #4ADE80;
    --color-focus-offset:      #0F1117;

    --color-overlay:           rgba(0, 0, 0, 0.7);
    --color-overlay-strong:    rgba(0, 0, 0, 0.85);

    --shadow-card:      0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-card-hover:0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

/* Manual dark mode toggle — overrides system preference */
[data-theme="dark"] {
  --color-background:        #0F1117;
  --color-background-alt:    #1A1D27;
  --color-background-subtle: #151821;
  --color-text:              #E8E6E0;
  --color-text-light:        #A8A29E;
  --color-meta:              #78716C;
  --color-placeholder:       #57534E;
  --color-accent:            #4ADE80;
  --color-accent-hover:      #86EFAC;
  --color-accent-light:      #052E16;
  --color-accent-amber:      #FCD34D;
  --color-accent-amber-hover:#FDE68A;
  --color-border:            #2D2D3A;
  --color-border-strong:     #3D3D4E;
  --color-heading:           #F3F1EC;
  --color-link:              #4ADE80;
  --color-link-hover:        #86EFAC;
  --color-focus:             #4ADE80;
  --color-focus-offset:      #0F1117;
  --color-overlay:           rgba(0, 0, 0, 0.7);
  --color-overlay-strong:    rgba(0, 0, 0, 0.85);
  --shadow-card:             0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-card-hover:       0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Manual light mode toggle — forces light even if OS is dark */
[data-theme="light"] {
  --color-background:        #F8F7F4;
  --color-background-alt:    #FFFFFF;
  --color-background-subtle: #F0EFEB;
  --color-text:              #1A1A2E;
  --color-text-light:        #4B5563;
  --color-meta:              #6B7280;
  --color-accent:            #2D6A4F;
  --color-accent-hover:      #1B4332;
  --color-accent-light:      #D1FAE5;
  --color-border:            #E5E7EB;
  --color-border-strong:     #D1D5DB;
  --color-heading:           #111827;
  --color-link:              #2D6A4F;
  --color-link-hover:        #1B4332;
  --color-focus:             #2D6A4F;
  --color-focus-offset:      #F8F7F4;
}


/* =============================================================================
   3. CSS RESET & NORMALISATION
   Modern reset — removes browser inconsistencies while preserving useful defaults.
   Based on Andy Bell's modern CSS reset, extended for WordPress compatibility.
   ============================================================================= */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 100%;                    /* Respects user's browser font size preference */
  hanging-punctuation: first last;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Avoid text overflows */
p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* Remove all animations and transitions for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-play-state: paused !important;
    transition: none !important;
  }
}


/* =============================================================================
   4. BASE TYPOGRAPHY
   ============================================================================= */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-heading);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

/* Body text */
p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead paragraph — larger intro text */
.text-lead {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--color-text-light);
  font-weight: var(--weight-regular);
}

/* Strong and emphasis */
strong, b {
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
}

em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--text-sm);
}

/* Superscript and subscript */
sup, sub {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sup { top: -0.5em; }
sub { bottom: -0.25em; }

/* Blockquote — editorial pull quote style */
blockquote {
  position: relative;
  margin: var(--space-8) 0;
  padding: var(--space-6) var(--space-8);
  border-left: var(--border-width-heavy) solid var(--color-accent);
  background-color: var(--color-background-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote p {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-style: italic;
  line-height: var(--leading-snug);
  color: var(--color-heading);
  margin-bottom: var(--space-3);
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-style: normal;
  font-weight: var(--weight-medium);
  color: var(--color-meta);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-top: var(--space-3);
}

/* Code */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--color-background-subtle);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
  color: var(--color-accent-amber);
}

pre {
  background-color: var(--color-background-subtle);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: var(--border-width) solid var(--color-border);
  margin: var(--space-12) 0;
}

hr.section-divider {
  border-top-width: var(--border-width-thick);
  border-color: var(--color-accent);
  width: 64px;
  margin-left: 0;
}

/* Lists */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}

ul li {
  list-style-type: disc;
}

ol li {
  list-style-type: decimal;
}

/* Definition lists */
dt {
  font-weight: var(--weight-semibold);
  color: var(--color-heading);
}

dd {
  margin-left: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--color-text-light);
}

/* Figures */
figure {
  margin: var(--space-8) 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-meta);
  text-align: center;
  margin-top: var(--space-3);
  font-style: italic;
  line-height: var(--leading-normal);
}

/* Address */
address {
  font-style: normal;
  line-height: var(--leading-relaxed);
}

/* Mark / highlight */
mark {
  background-color: var(--color-accent-light);
  color: var(--color-text);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-sm);
}

/* Abbreviation */
abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* Time element */
time {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--color-meta);
}


/* =============================================================================
   5. LINKS
   ============================================================================= */

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Navigation links — decoration removed, handled by component styles */
nav a {
  text-decoration: none;
}


/* =============================================================================
   6. LAYOUT & GRID
   ============================================================================= */

/* Page wrapper */
.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Main content area grows to push footer down */
.site-content {
  flex: 1;
  padding-top: var(--header-height);    /* Offset for sticky header */
}

/* Container — centred, max-width, padded */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--sm   { max-width: var(--container-sm);  }
.container--md   { max-width: var(--container-md);  }
.container--lg   { max-width: var(--container-lg);  }
.container--xl   { max-width: var(--container-xl);  }
.container--2xl  { max-width: var(--container-2xl); }
.container--full { max-width: 100%; }

/* Content width — optimal reading measure */
.content-width {
  max-width: var(--content-width);
  margin-inline: auto;
}

/* Grid systems */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Article grid — 12-column base */
.grid--12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-8);
}

/* Common layout: content + sidebar */
.layout--sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--space-12);
  align-items: start;
}

/* Responsive grid adjustments */
@media (max-width: 1024px) {
  .grid--4  { grid-template-columns: repeat(2, 1fr); }
  .layout--sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }

  .container {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-3);
  }
}

/* Flex utilities */
.flex { display: flex; }
.flex--center { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--gap-2 { gap: var(--space-2); }
.flex--gap-4 { gap: var(--space-4); }
.flex--gap-6 { gap: var(--space-6); }
.flex--wrap  { flex-wrap: wrap; }


/* =============================================================================
   7. UTILITY CLASSES
   ============================================================================= */

/* Text alignment */
.text-left    { text-align: left; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* Text colours */
.text-accent  { color: var(--color-accent); }
.text-meta    { color: var(--color-meta); }
.text-light   { color: var(--color-text-light); }
.text-heading { color: var(--color-heading); }

/* Font families */
.font-heading { font-family: var(--font-heading); }
.font-body    { font-family: var(--font-body); }
.font-ui      { font-family: var(--font-ui); }

/* Font weights */
.font-regular  { font-weight: var(--weight-regular); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

/* Text transforms */
.uppercase { text-transform: uppercase; letter-spacing: var(--tracking-wider); }
.lowercase  { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* Spacing utilities */
.mt-0  { margin-top: 0; }
.mt-4  { margin-top: var(--space-4); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: var(--space-4); }
.mb-8  { margin-bottom: var(--space-8); }

/* Visibility */
.hidden          { display: none !important; }
.visible         { display: block !important; }
.invisible       { visibility: hidden; }
.opacity-0       { opacity: 0; }

/* Display */
.block        { display: block; }
.inline       { display: inline; }
.inline-block { display: inline-block; }

/* Borders */
.border-top    { border-top: var(--border-width) solid var(--color-border); }
.border-bottom { border-bottom: var(--border-width) solid var(--color-border); }

/* Background colours */
.bg-background        { background-color: var(--color-background); }
.bg-background-alt    { background-color: var(--color-background-alt); }
.bg-background-subtle { background-color: var(--color-background-subtle); }
.bg-accent            { background-color: var(--color-accent); }

/* Aspect ratios for images */
.ratio-16x9  { aspect-ratio: 16 / 9; }
.ratio-4x3   { aspect-ratio: 4 / 3; }
.ratio-3x2   { aspect-ratio: 3 / 2; }
.ratio-1x1   { aspect-ratio: 1 / 1; }
.ratio-21x9  { aspect-ratio: 21 / 9; }

/* Object fit for images within aspect ratio containers */
.object-cover   { object-fit: cover; object-position: center; }
.object-contain { object-fit: contain; }

/* Truncate text with ellipsis */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* Section spacing */
.section {
  padding-block: var(--space-16);
}

.section--sm {
  padding-block: var(--space-10);
}

.section--lg {
  padding-block: var(--space-24);
}


/* =============================================================================
   8. SCREEN READER & ACCESSIBILITY
   ============================================================================= */

/* Visually hidden but available to screen readers */
.sr-only,
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focusable screen-reader text — visible when focused */
.sr-only-focusable:focus,
.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Focus styles for all interactive elements */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Remove outline for mouse users (only shown for keyboard) */
:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (forced-colors: active) {
  a { color: LinkText; }
  button { color: ButtonText; background-color: ButtonFace; }
}


/* =============================================================================
   9. SKIP LINK
   Allows keyboard users to skip directly to main content.
   ============================================================================= */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-toast);
  background-color: var(--color-accent);
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}


/* =============================================================================
   10. SELECTION STYLES
   ============================================================================= */

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

[data-theme="dark"] ::selection {
  background-color: var(--color-accent);
  color: #FFFFFF;
}


/* =============================================================================
   11. WORDPRESS CORE COMPATIBILITY
   Styles required for WordPress core classes and functionality.
   ============================================================================= */

/* Alignment classes */
.alignleft {
  float: left;
  margin-right: var(--space-6);
  margin-bottom: var(--space-4);
}

.alignright {
  float: right;
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.aligncenter {
  display: block;
  margin-inline: auto;
  margin-bottom: var(--space-4);
}

.alignwide {
  margin-inline: calc(var(--space-8) * -1);
}

.alignfull {
  margin-inline: calc(50% - 50vw);
  width: 100vw;
  max-width: 100vw;
}

/* WordPress caption */
.wp-caption {
  max-width: 100%;
  margin-bottom: var(--space-6);
}

.wp-caption img {
  display: block;
  width: 100%;
}

.wp-caption-text {
  font-size: var(--text-sm);
  color: var(--color-meta);
  text-align: center;
  padding-top: var(--space-2);
  font-style: italic;
}

/* WordPress gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.gallery-item {
  margin: 0;
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  transition: transform var(--transition-base);
}

.gallery-item img:hover {
  transform: scale(1.02);
}

/* WordPress sticky post */
.sticky {
  border-left: var(--border-width-heavy) solid var(--color-accent);
  padding-left: var(--space-6);
}

/* WordPress password-protected posts */
.post-password-form label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--weight-medium);
}

.post-password-form input[type="password"] {
  width: 100%;
  max-width: 320px;
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-background-alt);
  margin-bottom: var(--space-4);
}

/* WordPress search form */
.search-form {
  display: flex;
  gap: var(--space-2);
}

.search-form .search-field {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-background-alt);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.search-form .search-field:focus {
  border-color: var(--color-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.search-form .search-submit {
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.search-form .search-submit:hover {
  background-color: var(--color-accent-hover);
}

/* WordPress tag cloud */
.tagcloud a {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-background-subtle);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm) !important;  /* Override WordPress inline size */
  text-decoration: none;
  color: var(--color-text-light);
  margin: var(--space-1);
  transition: all var(--transition-fast);
}

.tagcloud a:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

/* WordPress pagination */
.page-numbers {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.page-numbers a,
.page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.page-numbers a:hover {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

.page-numbers .current {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #FFFFFF;
}

/* WordPress comment list */
.comment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* WordPress widgets */
.widget {
  margin-bottom: var(--space-10);
}

.widget-title {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-meta);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: var(--border-width-thick) solid var(--color-accent);
}
