/*
Theme Name: auDHD South Africa
Theme URI: https://audhd.co.za/theme
Author: auDHD.co.za Digital Publishing Team & Neurodivergent Community
Author URI: https://audhd.co.za
Description: An accessibility-first WordPress Full Site Editing (FSE) block theme designed specifically for South Africa's neurodivergent-affirming community guide to AuDHD, autism, and ADHD. Engineered with strict WCAG 2.2 AA/AAA compliance, low-glare warm sand palette, Atkinson Hyperlegible and Lexend typography, 48px minimum touch targets, sensory pause controls, and Gutenberg block patterns built for South African clinical, legal (POPIA, CCMA, Section 9), and healthcare realities.
Version: 1.0.1
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: audhd-theme
Tags: block-theme, full-site-editing, accessibility-ready, custom-colors, custom-typography, custom-spacing, editor-style, wide-blocks, one-column, two-columns, three-columns, four-columns, featured-images

(c) 2025-2026 auDHD.co.za Community. All rights reserved.
*/

/* Baseline reset for WordPress Core Blocks adhering to auDHD Design Tokens */
:root {
  --wp--custom--color--au-gold: #E0A526;
  --wp--custom--color--au-gold-tint: #FFF8E6;
  --wp--custom--color--ink: #1F2A44;
  --wp--custom--color--sand: #F7F2E8;
  --wp--custom--color--surface: #FFFFFF;
  --wp--custom--color--teal: #2F8F89;
  --wp--custom--color--teal-tint: #EEF6F5;
  --wp--custom--color--coral: #E8735A;
  --wp--custom--color--coral-tint: #FDF1EE;
  --wp--custom--color--sage: #8FB59A;
  --wp--custom--color--sage-tint: #F1F7F2;
  --wp--custom--color--mist: #D9DCE1;
  
  --wp--custom--radius--card: 16px;
  --wp--custom--radius--button: 10px;
  --wp--custom--radius--pill: 999px;
  --wp--custom--touch-target: 48px;
}

/* Accessibility Focus Ring: 3px Visible Au Gold with 2px offset */
*:focus-visible {
  outline: 3px solid var(--wp--custom--color--au-gold) !important;
  outline-offset: 2px !important;
}

/* Ensure minimum touch targets for all interactive elements */
button,
input[type="button"],
input[type="submit"],
.wp-block-button__link,
.sensory-toolbar-btn,
.sensory-action-btn {
  min-height: var(--wp--custom--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Text zoom scalability support */
html.font-scale-md {
  font-size: 112.5% !important; /* 18px base */
}
html.font-scale-lg {
  font-size: 125% !important; /* 20px base */
}

/* Sensory Focus Mode: dims non-essential decorative elements, reduces motion, and centers reading column */
body.sensory-focus-active .is-decorative-sensory,
body.sensory-focus-active .hero-visual-column,
body.sensory-focus-active .decorative-scrim,
body.sensory-focus-active .decorative-visual {
  opacity: 0.15 !important;
  filter: grayscale(80%) !important;
  transition: opacity 0.3s ease, filter 0.3s ease;
  pointer-events: none;
}

body.sensory-focus-active {
  background-color: var(--wp--preset--color--sand, #F7F2E8) !important;
}

/* ==========================================================================
   DARK MODE SYSTEM (Low-Glare WCAG 2.2 Palette)
   Overrides both WordPress Gutenberg Presets and Custom Properties
   ========================================================================== */
html.dark,
body.dark-mode,
:root.dark,
html.dark body,
body.dark-mode .wp-site-blocks,
body.dark-mode .editor-styles-wrapper {
  /* Gutenberg Preset Overrides */
  --wp--preset--color--sand: #121826 !important;
  --wp--preset--color--surface: #1C2433 !important;
  --wp--preset--color--ink: #EDE8DF !important;
  --wp--preset--color--mist: #2D3748 !important;
  --wp--preset--color--gold-tint: #2A2415 !important;
  --wp--preset--color--teal-tint: #142826 !important;
  --wp--preset--color--coral-tint: #2B1E1B !important;
  --wp--preset--color--sage-tint: #1A261E !important;

  /* Custom Properties Overrides */
  --wp--custom--color--sand: #121826 !important;
  --wp--custom--color--surface: #1C2433 !important;
  --wp--custom--color--ink: #EDE8DF !important;
  --wp--custom--color--mist: #2D3748 !important;
  --wp--custom--color--au-gold-tint: #2A2415 !important;
  --wp--custom--color--teal-tint: #142826 !important;
  --wp--custom--color--coral-tint: #2B1E1B !important;
  --wp--custom--color--sage-tint: #1A261E !important;

  background-color: #121826 !important;
  color: #EDE8DF !important;
}

/* Text & Link Overrides in Dark Mode */
body.dark-mode p,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode span:not([class*="has-"]),
body.dark-mode .has-ink-color {
  color: #EDE8DF !important;
}

body.dark-mode a:not(.wp-block-button__link) {
  color: #98F2EB !important;
}

/* Containers and Group Blocks in Dark Mode */
body.dark-mode .wp-block-group.has-sand-background-color,
body.dark-mode .has-sand-background-color,
body.dark-mode .site-header-wrapper,
body.dark-mode .sensory-toolbar-container {
  background-color: #121826 !important;
  color: #EDE8DF !important;
}

body.dark-mode .wp-block-group.has-surface-background-color,
body.dark-mode .has-surface-background-color,
body.dark-mode .wp-block-column.has-surface-background-color,
body.dark-mode .main-navigation-bar {
  background-color: #1C2433 !important;
  color: #EDE8DF !important;
}

body.dark-mode .has-gold-tint-background-color {
  background-color: #2A2415 !important;
  color: #EDE8DF !important;
  border-color: #3D331E !important;
}

body.dark-mode .has-teal-tint-background-color {
  background-color: #142826 !important;
  color: #98F2EB !important;
}

body.dark-mode .has-coral-tint-background-color {
  background-color: #2B1E1B !important;
  color: #ff9179 !important;
}

body.dark-mode .has-sage-tint-background-color {
  background-color: #1A261E !important;
  color: #8FB59A !important;
}

/* Borders in Dark Mode */
body.dark-mode .has-mist-border-color,
body.dark-mode [style*="border-color:var(--wp--preset--color--mist)"],
body.dark-mode .wp-block-group,
body.dark-mode .wp-block-column {
  border-color: #2D3748 !important;
}

/* Table in Dark Mode */
body.dark-mode .wp-block-table table {
  background-color: #1C2433 !important;
  color: #EDE8DF !important;
}

body.dark-mode .wp-block-table th {
  background-color: #25304a !important;
  color: #EDE8DF !important;
}

body.dark-mode .wp-block-table td {
  border-color: #2D3748 !important;
  color: #EDE8DF !important;
}

body.dark-mode .wp-block-table tr:hover {
  background-color: #25304a !important;
}

/* Sensory Toolbar Buttons in Dark Mode */
body.dark-mode .sensory-zoom-group {
  background: #25304a !important;
}

body.dark-mode .sensory-zoom-btn {
  color: #EDE8DF !important;
}

body.dark-mode .sensory-zoom-btn.active-scale {
  background: #1C2433 !important;
  color: #EDE8DF !important;
}

body.dark-mode .sensory-action-btn {
  background: #1C2433 !important;
  color: #EDE8DF !important;
  border-color: #2D3748 !important;
}

body.dark-mode .sensory-action-btn:hover {
  border-color: #E0A526 !important;
}

/* Forms and Inputs in Dark Mode */
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="search"] {
  background-color: #1C2433 !important;
  color: #EDE8DF !important;
  border-color: #2D3748 !important;
}

/* Line-length constraints for cognitive readability */
.entry-content p,
.wp-block-paragraph {
  max-width: 70ch;
  line-height: 1.6;
}

.wp-block-heading {
  line-height: 1.25;
  font-weight: 600;
}
