/*
Theme Name: TiE Nairobi
Theme URI: https://tienairobi.org
Author: TiE Nairobi
Description: Custom WordPress theme for TiE Nairobi, blending the membership-tier structure of TiE Bangalore with the polish of TiE Silicon Valley. Built around a "horizon at golden hour" visual signature — a thin gold rule marking section breaks, echoing the Nairobi savanna skyline.
Version: 1.0.4
Requires PHP: 7.4
Text Domain: tie-nairobi
*/

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  /* Color — TiE global brand: red & white, applied consistently across chapters */
  --tie-ink: #1A1A1A;         /* near-black, body text */
  --tie-cream: #FFFFFF;       /* white, primary background */
  --tie-clay: #C8102E;        /* TiE red — primary accent, CTAs, links */
  --tie-leaf: #7A0C1D;        /* deep maroon — secondary accent, hovers */
  --tie-gold: #FFFFFF;        /* white, used for accents/rules on dark red/black */
  --tie-white: #FFFFFF;
  --tie-red: #C8102E;         /* alias for direct reference */
  --tie-red-dark: #7A0C1D;
  --tie-ink-70: rgba(26, 26, 26, 0.7);
  --tie-ink-40: rgba(26, 26, 26, 0.4);
  --tie-cream-60: rgba(255, 255, 255, 0.6);

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --step-eyebrow: 0.75rem;
  --step-body: 1.0625rem;
  --step-h3: 1.5rem;
  --step-h2: 2.25rem;
  --step-h1: clamp(2.5rem, 5vw, 4.25rem);

  /* Layout */
  --rule-gold: 2px solid var(--tie-red);
  --radius: 2px;
  --container: 1180px;
  --section-pad: clamp(3.5rem, 8vw, 7rem);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: var(--step-body);
  color: var(--tie-ink);
  background: var(--tie-cream);
  line-height: 1.6;
  margin: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 0.5em;
  color: var(--tie-ink);
}

h1 { font-size: var(--step-h1); font-weight: 500; }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); }

a { color: var(--tie-clay); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--tie-clay);
  outline-offset: 2px;
}

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tie-clay);
  display: block;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   HORIZON SIGNATURE — thin gold rule marking section breaks
   ========================================================================== */
.horizon {
  position: relative;
  border: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tie-red) 15%, var(--tie-red) 85%, transparent);
  margin: 0;
}

section {
  padding: var(--section-pad) 0;
  position: relative;
}

section + section {
  border-top: 1px solid rgba(14, 31, 28, 0.08);
}

section.on-ink {
  background: var(--tie-red-dark);
  color: var(--tie-cream);
}
section.on-ink h1, section.on-ink h2, section.on-ink h3 { color: var(--tie-cream); }

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--tie-cream);
  border-bottom: var(--rule-gold);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
  gap: 1rem;
}

.site-logo { display: flex; align-items: center; height: 100%; overflow: visible; flex-shrink: 0; }
.site-logo img,
.site-logo .custom-logo { height: 64px; width: auto; max-width: 220px; object-fit: contain; display: block; }

.primary-nav { flex: 1; min-width: 0; }
.primary-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.35rem;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.primary-nav li { position: relative; }

.primary-nav a {
  color: var(--tie-ink);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.primary-nav .sub-menu {
  display: none;
  position: absolute;
  background: var(--tie-white);
  border: 1px solid rgba(14,31,28,0.1);
  padding: 0.5rem 0;
  min-width: 200px;
  margin-top: 0.75rem;
  box-shadow: 0 8px 24px rgba(14,31,28,0.12);
}
.primary-nav li:hover > .sub-menu { display: block; }
.primary-nav .sub-menu li { padding: 0; }
.primary-nav .sub-menu a { display: block; padding: 0.6rem 1.25rem; }

/* ---------------------------------------------------------------------
   Mobile nav toggle (hamburger) — hidden on desktop
   --------------------------------------------------------------------- */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(14,31,28,0.2);
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--tie-ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; }
.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--tie-ink);
}

.site-header .btn {
  font-size: 0.7rem;
  padding: 0.6rem 1.1rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--tie-clay);
  border-color: var(--tie-clay);
  color: var(--tie-white);
}
.btn-primary:hover { background: var(--tie-ink); border-color: var(--tie-ink); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--tie-ink);
}
.btn-ghost:hover { background: var(--tie-ink); color: var(--tie-cream); text-decoration: none; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  background: var(--tie-red-dark);
  color: var(--tie-cream);
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(3rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tie-white) 50%, transparent);
}

.hero .container { max-width: 760px; }
.hero .container.container-wide { max-width: var(--container); }
.hero h1 { color: var(--tie-white); }
.hero .eyebrow { color: rgba(255,255,255,0.8); }
.hero p.lede { font-size: 1.2rem; color: var(--tie-cream-60); margin-bottom: 2rem; }
.hero .cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   Static hero — optional two-column layout with a side image/carousel
   --------------------------------------------------------------------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero-text .cta-row { margin-top: 0; }

.hero-side {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}
.hero-side-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hero-side-slide.is-active { opacity: 1; }

.hero-side-dots {
  position: absolute;
  bottom: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}
.hero-side-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}
.hero-side-dot.is-active { background: var(--tie-white); }

@media (max-width: 780px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { order: -1; aspect-ratio: 16 / 10; }
}

/* ==========================================================================
   HERO SLIDER — client-toggleable alternative to the static hero
   ========================================================================== */
.hero-slider {
  position: relative;
  height: clamp(420px, 60vw, 640px);
  overflow: hidden;
  background: var(--tie-red-dark);
}

.hero-slider-track { position: relative; width: 100%; height: 100%; }

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease;
}
.hero-slide.is-active { opacity: 1; visibility: visible; }

.hero-slide-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, rgba(26,26,26,0.72) 0%, rgba(26,26,26,0.35) 55%, rgba(26,26,26,0.1) 100%);
}
.hero-slide-overlay .container { max-width: 760px; }
.hero-slide-overlay h1, .hero-slide-overlay p { color: var(--tie-white); }

.hero-slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(26,26,26,0.4);
  color: var(--tie-white);
  border: 1px solid rgba(255,255,255,0.5);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
}
.hero-slider-arrow:hover { background: var(--tie-red); border-color: var(--tie-red); }
.hero-slider-arrow.prev { left: 1.25rem; }
.hero-slider-arrow.next { right: 1.25rem; }

.hero-slider-pause {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  background: rgba(26,26,26,0.5);
  color: var(--tie-white);
  border: 1px solid rgba(255,255,255,0.5);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  z-index: 5;
}
.hero-slider-pause:hover { background: var(--tie-red); border-color: var(--tie-red); }

.hero-slider-dots {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.6rem;
  z-index: 5;
}
.hero-slider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: none;
  cursor: pointer;
  padding: 0;
}
.hero-slider-dot.is-active { background: var(--tie-white); }

@media (max-width: 640px) {
  .hero-slider-arrow { width: 36px; height: 36px; font-size: 1.2rem; }
  .hero-slide-overlay { background: linear-gradient(180deg, rgba(26,26,26,0.75), rgba(26,26,26,0.5)); }
}

/* ==========================================================================
   IMPACT / STAT STRIP — "surveyor's markers" along the horizon
   ========================================================================== */
.impact-strip { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: var(--rule-gold);
}
.impact-item {
  padding: 1.75rem 1rem 0;
  border-left: 1px solid rgba(14,31,28,0.12);
  text-align: left;
}
.impact-item:first-child { border-left: none; }
.impact-number {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  color: var(--tie-clay);
  display: block;
}
.impact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tie-ink-70);
}

/* ==========================================================================
   CARD GRIDS — pillars, programs, members
   ========================================================================== */
.grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ---------------------------------------------------------------------
   Sponsor logo grid — guaranteed spacing, uniform logo height regardless
   of each logo's natural size, wraps cleanly to new rows as more are added
   --------------------------------------------------------------------- */
.sponsor-logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2.5rem 2rem;
  align-items: center;
  justify-items: center;
}
.sponsor-logo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  text-align: center;
}
.sponsor-logo-img {
  max-height: 84px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.sponsor-role {
  font-size: 0.82rem;
  color: var(--tie-ink-70);
}

.card {
  background: var(--tie-white);
  border: 1px solid rgba(14,31,28,0.1);
  padding: 2rem;
}
.card img { width: 100%; height: 180px; object-fit: cover; margin-bottom: 1.25rem; }

.member-card { text-align: left; }
.member-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: 1rem;
  filter: grayscale(15%);
}
.member-card .tier {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tie-clay);
}
.member-card h4 { margin: 0.25rem 0 0; font-size: 1.05rem; }
.member-card .company { color: var(--tie-ink-70); font-size: 0.9rem; }

/* ==========================================================================
   EVENTS
   ========================================================================== */
.event-row {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(14,31,28,0.1);
  align-items: baseline;
}
.event-date {
  font-family: var(--font-mono);
  color: var(--tie-clay);
  min-width: 110px;
  font-size: 0.85rem;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--tie-ink);
  color: var(--tie-cream-60);
  padding: 4rem 0 2rem;
}
.site-footer h4 { color: var(--tie-cream); font-size: 0.95rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.site-footer a { color: var(--tie-cream-60); }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 3rem;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 0.5rem; }
.footer-social {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
}
.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(246,241,228,0.3);
  color: var(--tie-cream-60);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.footer-social-link:hover {
  background: var(--tie-red, var(--tie-clay));
  border-color: var(--tie-red, var(--tie-clay));
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid rgba(246,241,228,0.15);
  padding-top: 1.5rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .site-header .container { flex-wrap: wrap; }
  .mobile-nav-toggle { display: flex; order: 2; }
  .site-header .btn-primary { order: 3; font-size: 0.72rem; padding: 0.65rem 1rem; }

  .primary-nav {
    order: 4;
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .primary-nav.is-open { max-height: 80vh; overflow-y: auto; }

  .primary-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
  }
  .primary-nav > ul > li { width: 100%; border-top: 1px solid rgba(14,31,28,0.08); position: relative; }
  .primary-nav a { display: block; padding: 0.85rem 0.25rem; }

  /* Submenus: no hover on touch devices, so they're tap-toggled via JS
     (adds/removes .is-open on the parent <li>) and laid out inline
     rather than as an absolutely-positioned dropdown. */
  .primary-nav .sub-menu {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    background: rgba(14,31,28,0.03);
    margin-top: 0;
    padding-left: 1rem;
  }
  .primary-nav li.is-open > .sub-menu { display: block; }
  .primary-nav li:hover > .sub-menu { display: none; } /* hover does nothing useful on touch; avoid the desktop hover rule leaking in */
  .primary-nav li.is-open:hover > .sub-menu { display: block; }

  .submenu-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: var(--tie-ink);
    cursor: pointer;
  }

  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
