/*
Theme Name: Zero Theories
Theme URI: https://zerotheories.com
Author: Team Zero Theories
Author URI: https://zerotheories.com
Description: Premium editorial theme for Zero Theories — a philosophical and analytical digital journal exploring technology, human behaviour, and modern life.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: All Rights Reserved
License URI: https://zerotheories.com
Text Domain: zero-theories
Tags: blog, editorial, minimal, dark-mode, philosophy
*/

/* ============================================================
   🎨 BRAND VARIABLES
   ============================================================ */
:root {
  --global-palette1: #2bb056;   /* Primary accent — green */
  --global-palette2: #215387;   /* Secondary accent — blue */
  --global-palette3: #1A202C;   /* Dark text / backgrounds */
  --global-palette4: #2D3748;   /* Secondary text */
  --global-palette5: #4A5568;   /* Body text */
  --global-palette6: #718096;   /* Muted text / meta */
  --global-palette7: #EDF2F7;   /* Borders / light bg */
  --global-palette8: #F7FAFC;   /* Main background */
  --global-palette9: #ffffff;   /* Pure white (cards) */

  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;

  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  32px;
  --space-lg:  64px;
  --space-xl:  100px;
  --space-2xl: 140px;

  --transition-smooth: all 0.3s ease;
  --transition-slow:   all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ============================================================
   🌙 DARK MODE
   ============================================================ */
body.dark-mode {
  --global-palette3: #F7FAFC;
  --global-palette4: #EDF2F7;
  --global-palette5: #A0AEC0;
  --global-palette6: #718096;
  --global-palette7: #2D3748;
  --global-palette8: #11151C;
  --global-palette9: #1A202C;
}

/* ============================================================
   🛠️ RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--global-palette5);
  background-color: var(--global-palette8);
  line-height: 1.8;
  font-size: 1.1rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity 0.5s ease, background-color 0.4s ease, color 0.4s ease;
}
body.loaded { opacity: 1; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--global-palette3);
  font-weight: 600;
  line-height: 1.2;
  transition: color 0.4s ease;
}
h1 { font-size: clamp(40px, 5vw, 64px); letter-spacing: -1px; }
h2 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -0.5px; margin-bottom: 30px; }
h3 { font-size: 22px; margin-bottom: 12px; }

p  { margin-bottom: 1.5em; }
a  { text-decoration: none; color: inherit; transition: var(--transition-smooth); }
img { max-width: 100%; display: block; border-radius: 4px; }
/* object-fit:cover only inside deliberate cropped containers */
.image-hover img,
.featured-image img,
.zt-thumb-wrap img,
.sa-card .image-hover img,
.zt-404-card .image-hover img,
.search-card .image-hover img {
  width: 100%; height: 100%; object-fit: cover;
}
ul { list-style: none; }

/* ============================================================
   📐 LAYOUT
   ============================================================ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
}
@media (max-width: 768px) {
  .container { padding: 0 20px; }
}
.reading-width {
  max-width: 720px;
  margin: 0 auto;
}
.section-padding { padding: 72px 0; }

/* ============================================================
   ✨ UTILITIES
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
/* animation-delay is used for staggered reveals — it delays the JS observer trigger */
.fade-in[style*="animation-delay"] {
  /* The JS observer fires normally; we use a setTimeout offset in main.js instead */
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
  /* Once visible, kill all transition-delay so hover is instant */
  transition: opacity 0.8s ease, transform 0.8s ease;
}
/* Topic cards: hover must be instant — no delay after visible */
.topic-card.visible,
.topic-card.visible:hover {
  transition-delay: 0s !important;
}

.hover-underline { position: relative; display: inline-block; }
.hover-underline::after {
  content: '';
  position: absolute;
  width: 0; height: 1px;
  bottom: 2px; left: 0;
  background-color: var(--global-palette3);
  transition: var(--transition-smooth);
}
.hover-underline:hover::after { width: 100%; }

.cat-tag {
  font-family: var(--font-body);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--global-palette1);
  font-weight: 600;
  margin-bottom: 12px;
  display: block;
}
.article-meta {
  font-size: 14px;
  color: var(--global-palette6);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}
.section-divider {
  border: none;
  border-top: 1px solid var(--global-palette7);
  margin: 0;
}

/* ============================================================
   🔘 BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: 40px;
  font-family: var(--font-body); font-weight: 500; font-size: 16px;
  transition: var(--transition-smooth); border: none; cursor: pointer;
}
.btn-primary {
  background: var(--global-palette3);
  color: var(--global-palette9);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--global-palette1), var(--global-palette2));
  transform: scale(1.02);
  box-shadow: 0 10px 20px rgba(33,83,135,0.15);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--global-palette3);
  color: var(--global-palette3);
}
.btn-outline:hover { background: var(--global-palette7); transform: scale(1.02); }

/* ============================================================
   ⏳ READING PROGRESS BAR
   ============================================================ */
#progressBar {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: var(--global-palette1);
  z-index: 2000;
  transition: width 0.1s ease;
}

/* ============================================================
   🗂️ NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; width: 100%; z-index: 1000;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 16px 0;
  transition: var(--transition-smooth);
}
body.dark-mode .navbar { background: rgba(17,21,28,0.88); }

.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-family: var(--font-heading); font-size: 24px; font-weight: 700; color: var(--global-palette3); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-link { font-size: 15px; font-weight: 500; color: var(--global-palette5); position: relative; }
.nav-link::after { content: ''; position: absolute; width: 0; height: 1px; bottom: -4px; left: 0; background: var(--global-palette1); transition: 0.3s; }
.nav-link:hover::after,
.nav-link.active::after { width: 100%; }
.nav-link:hover,
.nav-link.active { color: var(--global-palette3); }
.nav-actions { display: flex; align-items: center; gap: 16px; }
.nav-icon {
  cursor: pointer; font-size: 1.1rem;
  color: var(--global-palette5); background: none; border: none; transition: color 0.3s;
}
.nav-icon:hover { color: var(--global-palette1); }

/* ============================================================
   🍔 HAMBURGER
   ============================================================ */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 4px; background: none; border: none;
}
.hamburger span {
  display: block; width: 24px; height: 2px;
  background: var(--global-palette3); border-radius: 2px;
  transition: var(--transition-smooth);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none; position: fixed; inset: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  z-index: 999; flex-direction: column;
  align-items: center; justify-content: center; gap: 40px;
  opacity: 0; transform: translateY(-20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}
body.dark-mode .mobile-nav { background: rgba(17,21,28,0.97); }
.mobile-nav.open { display: flex; opacity: 1; transform: translateY(0); pointer-events: all; }
.mobile-nav a { font-family: var(--font-heading); font-size: 28px; font-weight: 500; color: var(--global-palette3); }
.mobile-nav a:hover { color: var(--global-palette1); }

/* ============================================================
   🃏 ARTICLE CARDS
   ============================================================ */
.article-card {
  background: var(--global-palette9);
  border: 1px solid var(--global-palette7);
  border-radius: 8px; overflow: hidden;
  transition: var(--transition-smooth);
  display: flex; flex-direction: column;
}
.article-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  border-color: transparent;
}
.image-hover-wrapper { overflow: hidden; width: 100%; }
.image-hover-wrapper img { transition: transform 0.4s ease; width: 100%; height: 100%; }
.article-card:hover .image-hover-wrapper img { transform: scale(1.05); }
.card-content { padding: 24px; display: flex; flex-direction: column; flex-grow: 1; }
.card-content h3 {
  font-size: 20px; margin-bottom: 12px; line-height: 1.3;
  color: var(--global-palette3) !important;
}
.card-content h3 a {
  color: var(--global-palette3) !important;
}
.card-content h3 a:hover { color: var(--global-palette1) !important; }
.card-excerpt {
  font-size: 15px; color: var(--global-palette5); margin-bottom: 20px;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
/* Fixed height ONLY for archive/blog grid cards, never for random page */
.archive-grid .card-img-container,
.search-archive-grid .card-img-container,
.grid-3 .card-img-container { height: 220px; overflow: hidden; }
.article-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--global-palette6);
  margin-top: auto;
}
.cat-tag {
  display: inline-block;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--global-palette1); margin-bottom: 10px;
}
.cat-tag:hover { color: var(--global-palette2); }

/* ============================================================
   📰 NEWSLETTER
   ============================================================ */
.newsletter-section {
  background: var(--global-palette7);
  padding: var(--space-xl) 0;
  text-align: center;
  border-top: 1px solid var(--global-palette7);
}
.newsletter-title { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 12px; }
.newsletter-desc { font-size: 1.1rem; color: var(--global-palette5); margin-bottom: var(--space-md); }
.newsletter-form {
  display: flex; max-width: 500px; margin: 0 auto;
  border-bottom: 1px solid var(--global-palette5); padding-bottom: 8px;
  transition: border-color 0.3s;
}
.newsletter-form:focus-within { border-bottom-color: var(--global-palette1); }
.newsletter-input {
  flex: 1; background: transparent; border: none;
  font-family: var(--font-body); font-size: 1rem;
  color: var(--global-palette3); outline: none; padding: 8px 0;
}
.newsletter-btn {
  background: transparent; border: none;
  font-family: var(--font-body); font-weight: 500;
  color: var(--global-palette3); cursor: pointer; padding: 8px 16px; transition: color 0.3s;
}
.newsletter-btn:hover { color: var(--global-palette1); }

/* ============================================================
   🦶 FOOTER
   ============================================================ */
.footer {
  padding: 60px 0;
  border-top: 1px solid var(--global-palette7);
  text-align: center; font-size: 14px; color: var(--global-palette6);
}
.footer-links { display: flex; justify-content: center; gap: 24px; margin: 20px 0; }
.footer-links a:hover { color: var(--global-palette1); }
.footer-copy { font-size: 0.9rem; color: var(--global-palette6); }

/* ============================================================
   🧲 MAGNETIC HOVER
   ============================================================ */
.magnetic { display: inline-block; transition: transform 0.2s ease; }

/* ============================================================
   📱 RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .section-padding { padding: 56px 0; }
}


/* ============================================================
   🌙 DARK MODE — CSS Variable Swap (Phase 22 corrected)
   This is the correct approach: swap palette variables so ALL
   existing CSS automatically inverts without per-element overrides.
   ============================================================ */
body.dark-mode {
  --global-palette3: #F7FAFC;
  --global-palette4: #EDF2F7;
  --global-palette5: #A0AEC0;
  --global-palette6: #718096;
  --global-palette7: #2D3748;
  --global-palette8: #11151C;
  --global-palette9: #1A202C;
}

/* Navbar & mobile nav dark backgrounds */
body.dark-mode .navbar {
  background: rgba(17, 21, 28, 0.88) !important;
  border-bottom-color: rgba(255,255,255,0.05) !important;
}
body.dark-mode .mobile-nav {
  background: rgba(17, 21, 28, 0.97) !important;
}

/* Newsletter input dark */
body.dark-mode .newsletter-input {
  color: var(--global-palette3);
  background: transparent !important;
  -webkit-box-shadow: none !important;
  box-shadow: none !important;
}
body.dark-mode .newsletter-input::placeholder {
  color: var(--global-palette6);
}

/* Contact/search form inputs */
body.dark-mode input:not(.newsletter-input),
body.dark-mode textarea,
body.dark-mode select {
  background: transparent;
  color: var(--global-palette3);
  border-color: var(--global-palette7);
}
body.dark-mode input[type="text"]:focus,
body.dark-mode input[type="email"]:focus,
body.dark-mode textarea:focus {
  background: transparent !important;
  outline: none;
}

/* Reading progress bar always green */
body.dark-mode #progressBar {
  background: var(--global-palette1);
}

/* Archive filter pills */
body.dark-mode .filter-pill {
  background: var(--global-palette9);
  color: var(--global-palette5);
  border-color: var(--global-palette7);
}
body.dark-mode .filter-pill:hover,
body.dark-mode .filter-pill.active {
  border-color: var(--global-palette1);
  color: var(--global-palette1);
}

/* Pagination */
body.dark-mode .page-numbers {
  background: var(--global-palette9);
  color: var(--global-palette5);
  border-color: var(--global-palette7);
}
body.dark-mode .page-numbers.current {
  background: var(--global-palette1);
  color: #fff;
}

/* Decorative quote contrast - light and dark mode */
.mission-quote::before {
  color: var(--global-palette7);
  opacity: 0.6;
}
body.dark-mode .mission-quote::before {
  color: var(--global-palette6);
  opacity: 0.8;
}
.section-divider {
  opacity: 0.8;
}

/* Light mode card depth - subtle shadow on all card variants */
.topic-card,
.principle,
.explore-pillar,
.collection-card,
.cluster-card,
.start-topic-card,
.essay-card,
.option-card,
.journey-card,
.discover-card,
.collection-card {
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
body.dark-mode .topic-card,
body.dark-mode .principle,
body.dark-mode .explore-pillar,
body.dark-mode .collection-card,
body.dark-mode .cluster-card,
body.dark-mode .start-topic-card,
body.dark-mode .essay-card,
body.dark-mode .option-card,
body.dark-mode .journey-card,
body.dark-mode .discover-card {
  box-shadow: none;
}

/* ── FIX 5: Premium elevation hover for non-interactive cards ── */
/* Clickable cards use border/color change; static cards use elevation only */
.principle:hover,
.explore-pillar:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.08) !important;
  transition: all 0.3s ease;
}

/* ── FIX: Contact page email input dark mode transparency ── */
.form-input:focus {
  background: transparent !important;
}
body.dark-mode .form-input,
body.dark-mode .form-control {
  background: transparent !important;
  color: var(--global-palette3) !important;
}
body.dark-mode .zt-contact-form input:-webkit-autofill,
body.dark-mode .zt-contact-form input:-webkit-autofill:hover,
body.dark-mode .zt-contact-form input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--global-palette9) inset !important;
  -webkit-text-fill-color: var(--global-palette3) !important;
}
