/* ============================================================
   COWI — Child Of Wealth Initiative
   Responsive Stylesheet (tablet.css)

   This file handles ALL responsive design — meaning how the
   website looks on smaller screens like tablets and phones.

   HOW MEDIA QUERIES WORK:
   @media screen and (max-width: 950px) { ... }

   This says: "Apply the styles inside only when the screen
   is 950 pixels wide or narrower."

   We have three breakpoints:
   1. ≤950px  — Tablets (iPad, etc.)
   2. ≤680px  — Large phones (iPhone Plus, etc.)
   3. ≤430px  — Small phones (standard iPhone, etc.)
   ============================================================ */

/* ============================================================
   TABLET BREAKPOINT — screens up to 950px wide
   ============================================================ */
@media screen and (max-width: 950px) {
  /* ---- NAVBAR ---- */

  /* Make both navbars narrower */
  #nav-bar,
  #sc-nav-bar {
    width: clamp(20em, 90vw, 44em);
  }

  #nav-bar{padding: 0;}

  /* Hide all nav links on the main navbar except the logo :)*/
  .nav-bar a:not(.show-nav-logo) {
    display: none;
  }

  .nav-logo-con {
    display: flex;
    align-items: center;
    margin: 0 auto 0 0;
    width: clamp(4em, 9%, 5em);
  }

  #nav-bar img,
  #nav-logo,
  .logo {
    margin: 0;
    width: 100%;
    height: 100%;
  }

  /* Show the hamburger menu icon (9th list item)
  #nav-bar ul li:nth-child(9) {
    display: flex;
    align-items: center;
    margin: 0 0 0 auto;
    width: clamp(2em, 5%, 3.3em);
  }
*/

  /*New show hambugar menu icon on tablet/mobile*/

  .more-icon-con {
    display: flex;
    align-items: center;
    margin: 0 0 0 auto;
    width: clamp(2em, 5%, 3.3em);
  }

  #more-icon {
    display: flex;
    width: 100%;
    height: 100%;
  }

  /* Make the hamburger icon white*/
  /* .more-icon img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(100%) saturate(2%)
      hue-rotate(296deg) brightness(104%) contrast(101%);
    width: 100%;
    margin: 0;
  } */

  /*New hambugar icon white
  .more-icon img {
    filter: brightness(0) saturate(100%) invert(100%) sepia(100%) saturate(2%)
      hue-rotate(296deg) brightness(104%) contrast(101%);
    width: 100%;
    margin: 0;
  }*/

  /* Show the sidebar nav on small screens */
  .sc-nav-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: -100%; /* Start hidden above the screen */
    left: 50%;
    z-index: 100;
    transform: translateX(-50%);
    background-color: var(--nav-white);
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    border-radius: 1.5em;
    padding: clamp(0.7em, 2vh, 2em);
    width: clamp(20em, 90vw, 40em);
  }

  /* When JS adds this class, the sidebar slides into view */
  .show-nav-bar {
    top: 2em;
    transition: var(--transition);
  }

  /* Sidebar list is vertical */
  .sc-nav-bar ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.3em, 1.2vh, 0.7em);
    padding: 0;
    list-style: none;
    width: 100%;
  }

  .sc-nav-bar li {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }

  .sc-nav-bar ul li a {
    text-decoration: none;
    font-weight: 600;
    font-size: clamp(0.95em, 2.5vw, 1.1em);
    width: 100%;
    text-align: center;
    transition: color var(--transition);
  }

  .sc-nav-bar ul li a:hover {
    color: var(--ochre);
  }

  .sc-logo {
    width: clamp(4em, 22%, 6em);
    height: 100%;
    margin: 0 auto 0 0;
  }

  /* Make the close icon white */
  .close-icon {
    /* filter: brightness(0) saturate(100%) invert(100%) sepia(100%) saturate(2%)
      hue-rotate(296deg) brightness(104%) contrast(101%); */
    width: clamp(1.5em, 6%, 2.5em);
    margin: 0 0 0 auto;
  }

  .sc-nav-bar a {
    width: 100%;
    text-align: center;
  }

  /* Dim overlay when sidebar is open */
  .close-overlay-invisble {
    display: none;
  }

  .close-overlay {
    display: block;
    position: fixed;
    inset: 0px;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.25);
  }

  /* ---- HERO ---- */

  .hero {
    background-attachment: scroll; /* Disable parallax on touch devices (performance) */
  }

  .hero-overlay {
    padding: 8rem 2rem 3rem;
    align-items: flex-end;
  }

  .hero-con h1 {
    font-size: clamp(1.8em, 5vw, 2.8em);
  }

  /* ---- STATS BAR ---- */
  .stats-bar {
    padding: 1.2rem 1.5rem;
    gap: 0;
  }

  .stat-item {
    min-width: 90px;
  }

  /* ---- ABOUT SECTION ---- */
  /* Switch from 2 columns to 1 column (stack vertically) */
  .about-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-img {height: 340px;}

  .invert-item-a {order: 2;}

  .invert-item-b {order: 1;}

  .invert-item-c {order: 3;}

  .invert-item-d {order: 4;}

  .invert-item-e {order: 6;}

  .invert-item-f {order: 5;}

  .invert-item-g {order: 7;}

  .invert-item-h {order: 8;}

  /* ---- CAUSES SECTION ---- */
  /* 3 columns → 1 column */
  .causes-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ---- PROGRAMS SECTION ---- */
  /* 3 columns → 1 column */
  .programs-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ---- PARTNERS SECTION ---- */
.partners-logo-con {
  width: 8rem;
  padding: 0 1.2em;
}

/* Slow it down slightly on mobile */
.partners-scroll {
  animation-duration: 8s;
}

  /* ---- TEAM SECTION ---- */
  /* 4 columns → 2 columns */
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ---- STORIES SECTION ---- */
  /* Side-by-side → stacked single column */
  .stories-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  /* Featured card no longer spans multiple rows */
  .story-card--featured {
    grid-row: span 1;
  }


  /* ---- CONTACT SECTION ---- */
  /* 2 columns → 1 column */
  .contact-inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  /* ---- FOOTER ---- */
  /* 4 columns → 2 columns */
  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    padding: 3rem 1.5rem 2rem;
  }

  /* Brand column spans full width */
  .footer-brand {
    grid-column: 1 / -1;
  }

  /* Hero content direction fix */
  .hero-con div {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 1em;
    margin: 1.3em 0 0 0;
  }
}

/* ============================================================
   LARGE PHONE BREAKPOINT — screens up to 680px wide
   ============================================================ */
@media screen and (max-width: 680px) {
  /* ---- HERO ---- */
  .hero-overlay {
    padding: 7rem 1.5rem 2.5rem;
  }

  .hero-con h1 {
    font-size: clamp(1.5em, 6vw, 2.2em);
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  /* ---- STATS BAR ---- */
  /* On phones, show only 2 stats per row */
  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 1rem;
  }

  /* Hide the vertical dividers in the grid layout */
  .stat-divider {
    display: none;
  }

  /* ---- SECTION HEADINGS ---- */
  .section-header h2 {
    font-size: clamp(1.3em, 5vw, 1.8em);
  }

  /* ---- TEAM ---- */
  /* 2 columns → 1 column */
  .team-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  #partners-paragraph {
    text-align: left;
  }


  /* ---- CONTACT ---- */
  .contact-form-wrap {
    padding: 1.3rem;
  }

  /* ---- FOOTER ---- */
  /* 2 columns → 1 column */
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .footer-brand {
    grid-column: auto;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
  }

  /* ---- GENERAL SECTION PADDING ---- */
  /* Reduce padding on sections for smaller screens */
  .about-section,
  .causes-section,
  .programs-section,
  .team-section,
  .stories-section,
  .contact-section {
    padding: 3.5rem 1.2rem;
  }
}

/* ============================================================
   SMALL PHONE BREAKPOINT — screens up to 430px wide
   ============================================================ */
@media screen and (max-width: 430px) {
  /* Even smaller navbar */
  #nav-bar,
  #sc-nav-bar {
    width: 92vw;
  }

  /* ---- HERO ---- */
  .hero-overlay {
    padding: 6rem 1rem 2rem;
  }

  .hero-con h1 {
    font-size: clamp(1.4em, 7vw, 2em);
  }

  /* ---- STATS ---- */
  .stat-item h3 {
    font-size: 1.5em;
  }

  .stat-item p {
    font-size: 0.72em;
  }

  /* ---- ABOUT ---- */
  .about-img {
    height: 260px;
  }

  /* ---- GENERAL PADDING ---- */
  .about-section,
  .causes-section,
  .programs-section,
  .team-section,
  .stories-section,
  .contact-section {
    padding: 2.5rem 1rem;
  }

  /* ---- FOOTER ---- */
  .footer-inner {
    padding: 2rem 1rem 1.5rem;
  }
}
