/*
Theme Name: Grove
Theme URI: https://gppsychotherapy.com
Author: Gerhard Pretorius
Description: A calming, trauma-informed custom theme for Gerhard Pretorius Psychotherapy. Navy "dusk" hero with a breathing orb and grove treeline motif, set against warm moss and stone tones.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: grove
*/

/* =========================================================
   1. Design tokens
   ========================================================= */
:root {
  --ink: #4F5D44;
  --ink-light: #7E8C6F;
  --bg: #F1EEE6;
  --bg-alt: #E6DFD0;
  --secondary: #D9CBB8;
  --accent: #B5694A;
  --accent-dark: #9C5740;
  --navy: #2E3A4A;
  --navy-light: #44566A;
  --glow: #E8B785;
  --text: #34352E;
  --text-light: #F8F5EE;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;
  --space-12: 96px;

  --font-serif: 'Newsreader', serif;
  --font-sans: 'Work Sans', sans-serif;
  --max-width: 1120px;
  --radius: 8px;
}

/* =========================================================
   2. Base
   ========================================================= */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}
img { max-width: 100%; height: auto; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.25rem; }
.entry-content { padding: 0; }

/* Skip link / accessibility */
.skip-link,
.screen-reader-text {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--text-light);
  padding: var(--space-1) var(--space-2);
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus,
.screen-reader-text:focus {
  left: 0;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* =========================================================
   3. Colour palette mapping
   (matches Appearance > Editor colour names, so any blocks
   created in the editor pick up the Grove palette)
   ========================================================= */
.has-primary-background-color   { background-color: var(--navy) !important; }
.has-primary-color              { color: var(--navy) !important; }
.has-secondary-background-color { background-color: var(--navy) !important; }
.has-secondary-color             { color: var(--navy) !important; }
.has-foreground-background-color { background-color: var(--ink) !important; }
.has-foreground-color            { color: var(--ink) !important; }
.has-background-background-color { background-color: var(--bg) !important; }
.has-tertiary-background-color   { background-color: var(--text-light) !important; }
.has-tertiary-color              { color: var(--text-light) !important; }
.has-accent-background-color     { background-color: var(--accent) !important; }
.has-accent-color                { color: var(--accent) !important; }

/* =========================================================
   4. Alignment helpers (classic theme support for wide/full)
   ========================================================= */
.alignwide {
  margin-left: auto;
  margin-right: auto;
  max-width: 1200px;
}
.alignfull {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  max-width: 100vw;
  width: 100vw;
}
.alignfull > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   5. Buttons
   ========================================================= */
.wp-block-button__link {
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: var(--radius) !important;
  padding: 0.85rem 1.75rem !important;
  border: 2px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.wp-block-button__link:hover { transform: translateY(-1px); }
.wp-block-button.is-style-outline .wp-block-button__link {
  background: transparent !important;
  border-color: currentColor;
}
.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background: rgba(248, 245, 238, 0.08) !important;
}

/* =========================================================
   6. Core block refinements
   ========================================================= */
.wp-block-quote {
  border-left: 4px solid var(--accent);
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-style: italic;
}
.wp-block-quote cite {
  display: block;
  margin-top: var(--space-1);
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.85rem;
}

.wp-block-separator {
  border-top: 1px solid var(--secondary);
  opacity: 1;
}

.wp-block-details {
  border-bottom: 1px solid var(--secondary);
  padding: var(--space-2) 0;
}
.wp-block-details summary {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: var(--space-1) var(--space-6) var(--space-1) 0;
  position: relative;
  list-style: none;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after {
  content: "+";
  position: absolute;
  right: var(--space-1);
  top: var(--space-1);
  font-size: 1.4rem;
  color: var(--accent);
}
.wp-block-details[open] summary::after { content: "\2212"; }
.wp-block-details p:last-child { margin-bottom: 0; }

.wp-block-list { padding-left: 1.2rem; }
.wp-block-list li { margin-bottom: var(--space-2); }
.wp-block-list li strong { font-family: var(--font-serif); color: var(--ink); }

/* =========================================================
   7. Header / nav / wordmark
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--secondary);
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.logo-mark {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--glow) 0%, var(--accent) 65%, var(--navy) 100%);
  animation: breathe-small 5s ease-in-out infinite;
}
.logo-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}
.logo-sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  cursor: pointer;
  position: relative;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-icon { top: 50%; transform: translateY(-1px); }
.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list li { position: relative; }
.nav-list a {
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: var(--space-1) 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nav-list a:hover,
.nav-list .current-menu-item > a,
.nav-list a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--accent);
}
.nav-list a.nav-cta {
  background: var(--navy);
  color: var(--text-light);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border-bottom: none;
}
.nav-list a.nav-cta:hover { background: var(--accent); }
.nav-list .sub-menu { display: none; }

/* =========================================================
   8. Hero / page-header treatment
   Applied automatically to the first primary-coloured group
   in the page content - gives every page a navy "dusk" band
   with a breathing orb and a grove treeline silhouette.
   ========================================================= */
.entry-content > .wp-block-group.has-primary-background-color:first-child {
  position: relative;
  overflow: hidden;
  padding-bottom: 110px !important;
}
.entry-content > .wp-block-group.has-primary-background-color:first-child::before {
  content: "";
  position: absolute;
  top: 6%;
  right: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--glow) 0%, var(--accent) 45%, transparent 75%);
  filter: blur(4px);
  opacity: 0.85;
  animation: breathe 4s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}
.entry-content > .wp-block-group.has-primary-background-color:first-child::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 90px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cg fill='%23F8F5EE'%3E%3Ccircle cx='-30' cy='100' r='50'/%3E%3Ccircle cx='40' cy='100' r='50'/%3E%3Ccircle cx='110' cy='100' r='50'/%3E%3Ccircle cx='180' cy='100' r='50'/%3E%3Ccircle cx='250' cy='100' r='50'/%3E%3Ccircle cx='320' cy='100' r='50'/%3E%3Ccircle cx='390' cy='100' r='50'/%3E%3Ccircle cx='460' cy='100' r='50'/%3E%3Ccircle cx='530' cy='100' r='50'/%3E%3Ccircle cx='600' cy='100' r='50'/%3E%3Ccircle cx='670' cy='100' r='50'/%3E%3Ccircle cx='740' cy='100' r='50'/%3E%3Ccircle cx='810' cy='100' r='50'/%3E%3Ccircle cx='880' cy='100' r='50'/%3E%3Ccircle cx='950' cy='100' r='50'/%3E%3Ccircle cx='1020' cy='100' r='50'/%3E%3Ccircle cx='1090' cy='100' r='50'/%3E%3Ccircle cx='1160' cy='100' r='50'/%3E%3Ccircle cx='1230' cy='100' r='50'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: 1;
}
.entry-content > .wp-block-group.has-primary-background-color:first-child > * {
  position: relative;
  z-index: 2;
}

/* =========================================================
   9. Footer
   ========================================================= */
.site-footer {
  position: relative;
  background: var(--navy);
  color: var(--text-light);
  padding-top: calc(var(--space-12) + 50px);
  padding-bottom: var(--space-6);
}
.site-footer h3 {
  color: var(--text-light);
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}
.site-footer .logo { color: var(--text-light); }
.site-footer .logo-sub { color: var(--secondary); }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.footer-grid a {
  color: var(--text-light);
  text-decoration: none;
  opacity: 0.85;
}
.footer-grid a:hover { opacity: 1; text-decoration: underline; }
.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.footer-bottom {
  margin-top: var(--space-6);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(248, 245, 238, 0.15);
  font-size: 0.82rem;
  opacity: 0.7;
}

.footer-treeline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  transform: rotate(180deg);
  display: block;
}
.footer-treeline .layer-back { fill: var(--ink-light); opacity: 0.5; }
.footer-treeline .layer-front { fill: var(--navy); }

/* =========================================================
   10. Responsive
   ========================================================= */
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    background: var(--bg);
    border-bottom: 1px solid var(--secondary);
    padding: var(--space-3);
    display: none;
  }
  .nav-list.is-open { display: flex; }
  .nav-list a.nav-cta { width: 100%; text-align: center; display: block; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (min-width: 760px) {
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   11. Animations
   ========================================================= */
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 0.95; }
}
@keyframes breathe-small {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wp-block-button__link:hover { transform: none; }
  .entry-content > .wp-block-group.has-primary-background-color:first-child::before,
  .logo-mark { animation: none; }
}
