/*
Theme Name: PieClimate Demo
Theme URI: https://pieclimate.org/
Author: Demo Setup
Description: Demo WordPress theme for a clean energy and climate transition website.
Version: 1.0.0
Text Domain: pieclimate
*/

/*
 * Scroll-driven theme: "Fa Aqua" at the top of the page, morphing into "Fa Lime" from the
 * partner map onwards (main.js toggles body.theme-lime). The theme colours are registered with
 * @property so the browser can animate them, which makes every element that uses them morph
 * together, not just the page background.
 */
@property --theme-bg { syntax: "<color>"; inherits: true; initial-value: #f0f8ff; }
@property --theme-surface { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --theme-tint { syntax: "<color>"; inherits: true; initial-value: #e6f4fe; }
@property --theme-text { syntax: "<color>"; inherits: true; initial-value: #081226; }
@property --theme-muted { syntax: "<color>"; inherits: true; initial-value: #4a5b73; }
@property --theme-accent { syntax: "<color>"; inherits: true; initial-value: #0066cc; }
@property --theme-accent-ink { syntax: "<color>"; inherits: true; initial-value: #0052cc; }
@property --theme-highlight { syntax: "<color>"; inherits: true; initial-value: #00d2ff; }
@property --theme-dark { syntax: "<color>"; inherits: true; initial-value: #081226; }

/* Theme A: Fa Aqua (default, top of the page) */
:root {
  --theme-bg: #f0f8ff;          /* soft ice blue page background */
  --theme-surface: #ffffff;     /* cards */
  --theme-tint: #e6f4fe;        /* soft tinted fills: icon tiles, hover states */
  --theme-text: #081226;        /* deep marine text and nav */
  --theme-muted: #4a5b73;       /* secondary text */
  --theme-accent: #0066cc;      /* royal cobalt: pins, borders, decoration */
  --theme-accent-ink: #0052cc;  /* accessible accent for buttons and coloured text */
  --theme-highlight: #00d2ff;   /* electric aqua highlight */
  --theme-dark: #081226;        /* dark panels, footer, tooltips */
}

/* Theme B: Fa Lime (partner map and below) */
body.theme-lime {
  --theme-bg: #f5f9f1;          /* soft mint cream */
  --theme-surface: #ffffff;
  --theme-tint: #eef6dc;
  --theme-text: #0d2b1d;        /* deep forest slate */
  --theme-muted: #5e6b57;
  --theme-accent: #5cb82a;      /* fresh lime */
  --theme-accent-ink: #3e7b27;  /* white text on #5cb82a fails contrast, so buttons use this darker lime */
  --theme-highlight: #dcee34;   /* yellow lime */
  --theme-dark: #0d2b1d;
}

/* Semantic tokens used throughout the theme. Declared on body (not only :root) so they are
   recomputed from the active theme's colours where body.theme-lime is toggled. */
:root,
body {
  --bg: var(--theme-bg);
  --panel: var(--theme-surface);
  --panel-soft: var(--theme-tint);
  --surface-dark: var(--theme-dark);
  --text: var(--theme-text);
  --muted: var(--theme-muted);
  --primary: var(--theme-accent-ink);
  --primary-strong: color-mix(in srgb, var(--theme-accent-ink) 78%, #000);
  --accent: var(--theme-accent);
  --accent-2: var(--theme-tint);
  --highlight: var(--theme-highlight);
  --line: color-mix(in srgb, var(--theme-text) 10%, transparent);
  --shadow: 0 20px 40px color-mix(in srgb, var(--theme-text) 7%, transparent);
  --gradient-marble-soft:
    radial-gradient(ellipse at 15% 20%, color-mix(in srgb, var(--theme-accent) 22%, transparent) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, color-mix(in srgb, var(--theme-highlight) 30%, transparent) 0%, transparent 45%),
    var(--theme-bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  --theme-ease: cubic-bezier(0.16, 1, 0.3, 1);
  transition:
    --theme-bg 0.8s var(--theme-ease),
    --theme-surface 0.8s var(--theme-ease),
    --theme-tint 0.8s var(--theme-ease),
    --theme-text 0.8s var(--theme-ease),
    --theme-muted 0.8s var(--theme-ease),
    --theme-accent 0.8s var(--theme-ease),
    --theme-accent-ink 0.8s var(--theme-ease),
    --theme-highlight 0.8s var(--theme-ease),
    --theme-dark 0.8s var(--theme-ease);
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--theme-bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
}
.brand {
  display: flex;
  align-items: center;
  flex: none;
}
.brand-logo {
  display: block;
  height: 54px;
  width: auto;
  aspect-ratio: 226 / 104;
}
.main-nav {
  display: flex;
  gap: 26px;
  align-items: center;
  font-size: 0.95rem;
  color: var(--muted);
}
.main-nav a {
  position: relative;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -7px;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.main-nav a:hover::after { transform: scaleX(1); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  box-shadow: var(--shadow);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.hero {
  position: relative;
  overflow: hidden;
  padding: 90px 0 60px;
  background: var(--gradient-marble-soft);
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--theme-bg) 88%, transparent) 0%, color-mix(in srgb, var(--theme-bg) 60%, transparent) 50%, color-mix(in srgb, var(--theme-bg) 15%, transparent) 100%);
  pointer-events: none;
}
.hero > .container {
  position: relative;
  z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 0.8rem;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
h1 {
  margin: 20px 0 18px;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}
.hero-copy p { font-size: 1.08rem; color: var(--muted); max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 28px; }
.hero-panel {
  /* 60% transparent: only the background fades, text stays fully opaque */
  background: linear-gradient(160deg, color-mix(in srgb, var(--theme-dark) 36%, transparent), color-mix(in srgb, var(--theme-dark) 44%, transparent));
  border-radius: 28px;
  padding: 30px;
  color: white;
  box-shadow: var(--shadow);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hero-panel .mini-label { font-size: 0.8rem; opacity: 0.8; }
.hero-panel h3 {
  margin: 18px 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.06;
}
.hero-panel-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.hero-panel-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}
.section {
  padding: 90px 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 36px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}
.section-head p {
  margin: 0;
  max-width: 580px;
  color: var(--muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}
.stat-number {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--primary);
}
.stat-card p { margin: 10px 0 0; color: var(--muted); }
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.info-card .icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--accent-2);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 18px;
}
.info-card h3 { margin: 0 0 12px; }
.info-card p { margin: 0; color: var(--muted); }
.map-shell {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--theme-surface) 90%, transparent), color-mix(in srgb, var(--theme-highlight) 16%, transparent));
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.map-toolbar {
  position: absolute;
  top: 38px;
  right: 38px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--theme-text) 12%, transparent);
  backdrop-filter: blur(10px);
}
.map-control {
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}
.map-control:hover,
.map-control:focus-visible {
  background: var(--accent-2);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.map-zoom-reset {
  min-width: 40px;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}
.world-map {
  position: relative;
  height: 420px;
  background: rgba(255,255,255,0.2);
  overflow: hidden;
  border-radius: 24px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.world-map.is-dragging {
  cursor: grabbing;
}
.world-map-canvas {
  position: absolute;
  inset: -15%;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
}
.world-map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  object-fit: fill;
  opacity: 0.8;
  filter: saturate(0.9) contrast(1.02) brightness(0.9);
}
.partner-pin {
  position: absolute;
  width: 72px;
  height: 30.6px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 5px;
  box-sizing: border-box;
  background: linear-gradient(135deg, var(--accent), var(--highlight));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent), 0 4px 8px color-mix(in srgb, var(--accent) 20%, transparent);
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -50%) translateY(12px) scale(1);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
}
.partner-pin.is-visible {
  opacity: 1;
  animation: partnerPinReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}
@keyframes partnerPinReveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(18px) scale(1);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(-4px) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1);
  }
}
.partner-pin::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 2px;
}
.partner-pin-image {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  border-radius: 3px;
  object-fit: contain;
  background: #fff;
  z-index: 1;
}
.partner-pin:hover,
.partner-pin:focus-visible {
  z-index: 100;
  transform: translate(-50%, -50%) translateY(-2px) scale(1.2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--highlight) 45%, transparent), 0 8px 14px color-mix(in srgb, var(--accent) 25%, transparent);
  filter: saturate(1.1);
}
.partner-name-tooltip {
  position: absolute;
  left: 50%;
  top: -58px;
  z-index: 2147483647;
  max-width: 190px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: var(--surface-dark);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--theme-text) 20%, transparent);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.partner-name-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 9px;
  height: 9px;
  background: var(--surface-dark);
  transform: translateX(-50%) rotate(45deg);
}
.partner-pin:hover .partner-name-tooltip,
.partner-pin:focus-visible .partner-name-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.map-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}
@media (min-width: 901px) {
  .world-map {
    height: 560px;
  }
  .partner-pin {
    width: 42px;
    height: 42px;
    border-radius: 50%;
  }
  .partner-pin::before {
    inset: 2px;
    border-radius: 50%;
  }
  .partner-pin-image {
    inset: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border-radius: 50%;
  }
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}
.about-panel {
  background: var(--surface-dark);
  color: white;
  border-radius: 28px;
  padding: 30px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.about-panel ul {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 12px;
}
.about-panel li {
  padding-left: 20px;
  position: relative;
  color: rgba(255,255,255,0.85);
}
.about-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.resource-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.resource-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.resource-item .tag {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.resource-item h3 { margin: 12px 0 8px; }
.resource-item p { margin: 0 0 18px; color: var(--muted); }
.footer {
  background: var(--surface-dark);
  color: rgba(255,255,255,0.85);
  padding: 36px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.modal {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--theme-dark) 50%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}
.modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.modal-card {
  width: min(520px, 100%);
  background: linear-gradient(180deg, var(--theme-surface) 0%, var(--panel-soft) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 24px;
  padding: 28px 24px 24px;
  position: relative;
  box-shadow: 0 28px 60px color-mix(in srgb, var(--theme-text) 18%, transparent);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
}
.modal.is-open .modal-card {
  animation: modalFadeRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes modalFadeRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal-card {
    transition: none;
    animation: none;
  }
  .modal.is-open .modal-card {
    opacity: 1;
    transform: none;
  }
}
.modal-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--highlight));
}
.modal-close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
}
.modal-close:hover,
.modal-close:focus-visible {
  background: var(--accent-2);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.modal-body {
  position: relative;
  z-index: 1;
}
.modal-logo {
  width: 199px;
  height: 85px;
  flex: 0 0 199px;
  display: grid;
  place-items: center;
  border-radius: 0;
  box-sizing: border-box;
  background: transparent;
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  box-shadow: none;
}
.modal-logo img {
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: contain;
}
#partner-modal-title {
  margin: 16px 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.05em;
}
.modal .is-typing {
  border-right: 2px solid var(--accent);
  animation: modalTypingCaret 0.8s steps(1, end) infinite;
}
@keyframes modalTypingCaret {
  0%, 49% { border-color: var(--accent); }
  50%, 100% { border-color: transparent; }
}
#partner-modal-meta {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.02em;
}
#partner-modal-text {
  margin: 14px 0 0;
  color: var(--muted);
}
#partner-modal-link {
  margin-top: 22px;
}
@media (max-width: 900px) {
  .hero-grid,
  .about-grid,
  .card-grid,
  .resource-list,
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hero-grid { grid-template-columns: 1fr; }
  .main-nav { display: none; }
  .partner-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
  }
  .partner-pin::before {
    inset: 2px;
    border-radius: 50%;
  }
  .partner-pin-image {
    inset: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border-radius: 50%;
  }
  .partner-name-tooltip {
    top: -48px;
    max-width: 130px;
    padding: 6px 8px;
    font-size: 0.62rem;
  }
}
@media (max-width: 640px) {
  .stats-grid,
  .card-grid,
  .resource-list,
  .about-grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    display: block;
  }
  .hero { padding-top: 50px; }
  .brand-logo { height: 46px; }
  .partner-pin {
    width: 22px;
    height: 22px;
    border-radius: 50%;
  }
  .partner-pin-image {
    inset: 2px;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
  }
  .partner-name-tooltip {
    top: -42px;
    max-width: 110px;
    padding: 5px 7px;
    font-size: 0.56rem;
  }
}
