/* ============================================================
 * EchoSys Varsity — Design System
 * design-system.css
 *
 * Contains:
 *   1. CSS Custom Properties (tokens)
 *   2. Modern CSS Reset
 *   3. Base / Typography
 *   4. Dark Mode Overrides
 *   5. Utility Classes
 *   6. Scroll Animation Base States
 * ============================================================ */

/* ============================================================
 * 0. DEFENSIVE OVERRIDES
 * Override any WordPress core CSS that could conflict with
 * the theme design (e.g. custom-background image tiling).
 * ============================================================ */
body.custom-background {
  background-image: none !important;
  background-color: var(--ev-bg, #F8F9FC) !important;
}


/* ============================================================
 * 1. CSS CUSTOM PROPERTIES
 * ============================================================ */
:root {
  /* ── Brand Colors ─────────────────────────────────────── */
  --ev-primary:        #1B2A52;
  --ev-primary-light:  #253668;
  --ev-primary-dark:   #111B36;
  --ev-accent:         #F5A623;
  --ev-accent-light:   #FFBE55;
  --ev-accent-dark:    #D4891A;
  --ev-white:          #FFFFFF;

  /* ── Semantic Surface Colors ──────────────────────────── */
  --ev-bg:             #F8F9FC;
  --ev-surface:        #FFFFFF;
  --ev-text:           #1A1F36;
  --ev-text-muted:     #6B7280;
  --ev-border:         #E5E7EB;

  /* ── Shadows ──────────────────────────────────────────── */
  --ev-shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --ev-shadow-md:  0 4px 20px rgba(0, 0, 0, 0.10);
  --ev-shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.14);
  --ev-shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.18);

  /* ── Dark Mode Tokens (applied under body.ev-dark) ────── */
  --ev-dark-bg:         #0D1321;
  --ev-dark-surface:    #1A2540;
  --ev-dark-border:     #2A3A5C;
  --ev-dark-text:       #E8EDF5;
  --ev-dark-text-muted: #94A3B8;

  /* ── Typography Families ──────────────────────────────── */
  --ev-font-heading: 'Playfair Display', Georgia, serif;
  --ev-font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --ev-font-accent:  'Outfit', 'Inter', sans-serif;

  /* ── Type Scale ───────────────────────────────────────── */
  --ev-text-xs:   0.75rem;
  --ev-text-sm:   0.875rem;
  --ev-text-base: 1rem;
  --ev-text-lg:   1.125rem;
  --ev-text-xl:   1.25rem;
  --ev-text-2xl:  1.5rem;
  --ev-text-3xl:  1.875rem;
  --ev-text-4xl:  2.25rem;
  --ev-text-5xl:  3rem;
  --ev-text-6xl:  3.75rem;

  /* ── Spacing Scale ────────────────────────────────────── */
  --ev-space-1:  0.25rem;
  --ev-space-2:  0.5rem;
  --ev-space-3:  0.75rem;
  --ev-space-4:  1rem;
  --ev-space-6:  1.5rem;
  --ev-space-8:  2rem;
  --ev-space-10: 2.5rem;
  --ev-space-12: 3rem;
  --ev-space-16: 4rem;
  --ev-space-20: 5rem;
  --ev-space-24: 6rem;

  /* ── Layout ───────────────────────────────────────────── */
  --ev-container-max:     1280px;
  --ev-container-padding: 1.5rem;

  /* ── Border Radii ─────────────────────────────────────── */
  --ev-radius-sm:   6px;
  --ev-radius-md:   12px;
  --ev-radius-lg:   20px;
  --ev-radius-xl:   32px;
  --ev-radius-full: 9999px;

  /* ── Transitions ──────────────────────────────────────── */
  --ev-transition-fast:   150ms ease;
  --ev-transition-base:   250ms ease;
  --ev-transition-slow:   400ms ease;
  --ev-transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Z-Index Scale ────────────────────────────────────── */
  --ev-z-base:     1;
  --ev-z-dropdown: 100;
  --ev-z-sticky:   200;
  --ev-z-modal:    300;
  --ev-z-toast:    400;
  --ev-z-float:    500;
}


/* ============================================================
 * 2. MODERN CSS RESET
 * ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin:     0;
  padding:    0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  min-height: 100vh;
  line-height: 1.7;
  font-family:       var(--ev-font-body);
  color:             var(--ev-text);
  background-color:  var(--ev-bg);
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display:   block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul,
ol {
  list-style: none;
}

a {
  color:           var(--ev-accent);
  text-decoration: none;
  transition:      color var(--ev-transition-fast);
}

a:hover {
  color: var(--ev-accent-dark);
}

/* ── Main content offset for fixed header ──────────────────── */
/* Inner pages (not the homepage hero) need top padding to
   clear the fixed topbar + header stack.
   The homepage hero is full-screen so it handles its own offset. */
.ev-main-content {
  min-height: 60vh;
}

/* Non-front-page pages: add top padding to clear fixed header */
body:not(.home) .ev-main-content > *:first-child:not(.ev-page-hero):not(.ev-hero) {
  padding-top: calc(var(--ev-offset) + var(--ev-space-8));
}

/* The archive and search pages that use index/archive layout */
body:not(.home) .ev-main-content {
  padding-top: 0; /* page-hero handles it via its own padding */
}


/* ============================================================
 * 3. BASE TYPOGRAPHY
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family:   var(--ev-font-heading);
  font-weight:   700;
  line-height:   1.2;
  color:         var(--ev-text);
}

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

@media (max-width: 767px) {
  h1 { font-size: var(--ev-text-4xl); }
  h2 { font-size: var(--ev-text-3xl); }
  h3 { font-size: var(--ev-text-2xl); }
}

p {
  font-size: var(--ev-text-base);
  color:     var(--ev-text-muted);
}

strong, b {
  font-weight: 700;
  color: var(--ev-text);
}

blockquote {
  border-left:  4px solid var(--ev-accent);
  padding-left: var(--ev-space-4);
  font-style:   italic;
  color:        var(--ev-text-muted);
}

code, pre {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size:   var(--ev-text-sm);
}

pre {
  padding:       var(--ev-space-4);
  background:    var(--ev-surface);
  border:        1px solid var(--ev-border);
  border-radius: var(--ev-radius-md);
  overflow-x:    auto;
}

hr {
  border:     none;
  border-top: 1px solid var(--ev-border);
  margin:     var(--ev-space-8) 0;
}


/* ============================================================
 * 4. DARK MODE OVERRIDES
 * ============================================================ */
body.ev-dark {
  --ev-bg:         var(--ev-dark-bg);
  --ev-surface:    var(--ev-dark-surface);
  --ev-text:       var(--ev-dark-text);
  --ev-text-muted: var(--ev-dark-text-muted);
  --ev-border:     var(--ev-dark-border);

  color:            var(--ev-dark-text);
  background-color: var(--ev-dark-bg);
}

body.ev-dark h1,
body.ev-dark h2,
body.ev-dark h3,
body.ev-dark h4,
body.ev-dark h5,
body.ev-dark h6 {
  color: var(--ev-dark-text);
}

body.ev-dark p {
  color: var(--ev-dark-text-muted);
}

body.ev-dark strong,
body.ev-dark b {
  color: var(--ev-dark-text);
}

body.ev-dark hr {
  border-top-color: var(--ev-dark-border);
}

body.ev-dark pre {
  background:   var(--ev-dark-surface);
  border-color: var(--ev-dark-border);
}


/* ============================================================
 * 5. UTILITY CLASSES
 * ============================================================ */

/* Container */
.ev-container {
  max-width: var(--ev-container-max);
  margin:    0 auto;
  padding:   0 var(--ev-container-padding);
  width:     100%;
}

/* Section wrapper */
.ev-section {
  padding: var(--ev-space-20) 0;
}

@media (max-width: 767px) {
  .ev-section {
    padding: var(--ev-space-12) 0;
  }
}

/* Section label / eyebrow */
.ev-section-label {
  display:        inline-flex;
  align-items:    center;
  gap:            var(--ev-space-2);
  font-family:    var(--ev-font-accent);
  font-size:      var(--ev-text-xs);
  font-weight:    700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color:          var(--ev-accent);
  margin-bottom:  var(--ev-space-3);
}

.ev-section-label::before {
  content:    '';
  display:    inline-block;
  width:      24px;
  height:     2px;
  background: var(--ev-accent);
  flex-shrink: 0;
}

/* Section headings */
.ev-section-title {
  font-family:   var(--ev-font-heading);
  font-size:     var(--ev-text-4xl);
  font-weight:   800;
  line-height:   1.15;
  color:         var(--ev-text);
  margin-bottom: var(--ev-space-4);
}

@media (max-width: 767px) {
  .ev-section-title {
    font-size: var(--ev-text-3xl);
  }
}

body.ev-dark .ev-section-title {
  color: var(--ev-dark-text);
}

.ev-section-subtitle {
  font-size:   var(--ev-text-lg);
  color:       var(--ev-text-muted);
  max-width:   600px;
  line-height: 1.7;
}

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

.ev-text-center .ev-section-subtitle {
  margin-left:  auto;
  margin-right: auto;
}

/* Responsive grids */
.ev-grid-2,
.ev-grid-3,
.ev-grid-4 {
  display: grid;
  gap:     var(--ev-space-8);
}

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

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

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

/* Flexbox utilities */
.ev-flex         { display: flex; }
.ev-flex-center  { display: flex; align-items: center; justify-content: center; }
.ev-flex-between { display: flex; align-items: center; justify-content: space-between; }

/* Screen-reader only */
.ev-sr-only {
  position:    absolute;
  width:       1px;
  height:      1px;
  padding:     0;
  margin:      -1px;
  overflow:    hidden;
  clip:        rect(0, 0, 0, 0);
  white-space: nowrap;
  border:      0;
}

/* Generic card shell */
.ev-card {
  background:    var(--ev-surface);
  border:        1px solid var(--ev-border);
  border-radius: var(--ev-radius-md);
  overflow:      hidden;
  box-shadow:    var(--ev-shadow-sm);
  transition:    transform var(--ev-transition-base),
                 box-shadow var(--ev-transition-base);
}

.ev-card:hover {
  transform:  translateY(-4px);
  box-shadow: var(--ev-shadow-md);
}

body.ev-dark .ev-card {
  background:   var(--ev-dark-surface);
  border-color: var(--ev-dark-border);
}


/* ============================================================
 * 6. SCROLL ANIMATION BASE STATES
 * ============================================================ */

/* Fade up */
.ev-animate-fade-up {
  opacity:   0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Fade in */
.ev-animate-fade-in {
  opacity:    0;
  transition: opacity 0.6s ease;
}

/* Slide in from left */
.ev-animate-slide-left {
  opacity:   0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Slide in from right */
.ev-animate-slide-right {
  opacity:   0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Scale in */
.ev-animate-scale-in {
  opacity:   0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Activated by JS IntersectionObserver */
.ev-animated {
  opacity:   1 !important;
  transform: translate(0, 0) scale(1) !important;
}

/* Staggered delays */
.ev-delay-1 { transition-delay: 100ms !important; }
.ev-delay-2 { transition-delay: 200ms !important; }
.ev-delay-3 { transition-delay: 300ms !important; }
.ev-delay-4 { transition-delay: 400ms !important; }
.ev-delay-5 { transition-delay: 500ms !important; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ev-animate-fade-up,
  .ev-animate-fade-in,
  .ev-animate-slide-left,
  .ev-animate-slide-right,
  .ev-animate-scale-in {
    opacity:    1;
    transform:  none;
    transition: none;
  }
}
