/* ============================================================
   HEADER & FOOTER
   Shared site header/nav and footer styles, extracted from styles.css.
   Load AFTER styles.css (and BEFORE subpages.css on case-study pages).

   Keeps global/base styles in styles.css and case-study/subpage
   styles in subpages.css. This file only holds header/footer rules.
   ============================================================ */

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;

  background-color: var(--bg-section);
  border-bottom: 1px solid var(--home-line);
}

.nav-center {
  display: flex;
  justify-content: space-between;
  align-items: center;

  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 11px 0;
}

/* Logo */
.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-wrapper a {
  text-decoration: none;
  color: inherit;
}

.logo-wrapper img {
  height: 64px;
  width: auto;
  object-fit: contain;
  display: block;
}

.logo-wrapper h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

/* Nav links */
.nav-links {
  display: flex; align-items: center; gap: 36px; list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-mid);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
}
.nav-links a:hover { color: var(--text-hover); }

/* 📂 Dropdown menu */
.dropdown { position: relative; list-style: none; }
.dropdown-menu {
  position: absolute; top: 100%; left: 0;
  background: var(--bg-light);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 10px 0; margin: 0; min-width: 180px; z-index: 1000;

  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.dropdown:hover .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.dropdown-menu li a {
  display: block; padding: 10px 15px;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease;
}
.dropdown-menu li a:hover {
  background: var(--text-hover);
  color: var(--bg-light);
}

/* ===== Work dropdown — desktop/tablet polish ===== */
@media (min-width: 740px) {
  .dropdown-menu {
    margin-top: 12px;
    padding: 8px;
    min-width: 210px;
    background: var(--bg-light);
    border: 1px solid var(--home-line);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  }

  /* Transparent hover bridge filling the margin-top gap so the
     cursor can move continuously from "Work" into the dropdown */
  .dropdown::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
    z-index: 999;
  }

  .dropdown-menu li a {
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.01em;
    color: var(--text-main);
  }

  .dropdown-menu li a:hover {
    background: var(--text-hover);
    color: var(--bg-light);
  }
}

/* ===== HEADER-TO-CONTENT SPACING ===== */
/* Standard white space between header and first main content section */
/* Desktop: 42px | Mobile: 24px — consistent across all pages */
main > section:first-child,
header ~ section:first-of-type {
  padding-top: 42px;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-section);
  text-align: center;
  padding: 46px 20px;
  font-family: Arial, sans-serif;
  border-top: 1px solid var(--home-line);
  flex-shrink: 0;
}
.site-footer p {
  max-width: 600px;
  margin: 0 auto 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-p);
}
.site-footer img {
  height: 56px;
  margin: 10px auto;
  display: block;
}
.site-footer .copyright {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: 8px;
}

/* ===== Hamburger toggle (desktop/tablet hidden) ===== */
.nav-toggle {
  display: none;
}

.mobile-menu {
  display: none;
}

/* -------📱 Mobile responsive ---------- */
@media (max-width: 739px) {
  /* Single-row compact header */
  .site-header {
    margin-top: 0;
    position: relative;
    border-bottom: none;
  }

  .nav-center {
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 14px;
  }

  /* Logo */
  .logo-wrapper {
    flex-shrink: 0;
    gap: 8px;
  }

  .logo-wrapper img {
    height: 40px;
  }

  .logo-wrapper h2 {
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    white-space: nowrap;
  }

  /* Nav links */
  .nav-links {
    gap: 16px;
    flex-shrink: 0;
  }

  .nav-links a {
    font-size: 1.1rem;
    white-space: nowrap;
  }

  .site-footer p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* Footer */
  .site-footer {
    padding: 24px 16px;
  }

  .site-footer p {
    font-size: 0.82rem;
    line-height: 1.4;
    margin-bottom: 8px;
  }

  .site-footer img {
    height: 44px;
    margin: 8px auto;
  }

  .site-footer .copyright {
    font-size: 0.7rem;
    margin-top: 6px;
  }

  /* Header-to-content spacing (mobile) */
  main > section:first-child,
  header ~ section:first-of-type {
    padding-top: 24px;
  }

  /* Dropdown menu — polished mobile styling */
  .dropdown-menu {
    left: auto;
    right: 20px;
    min-width: 200px;
    margin: 10px 0 0;
    padding: 6px;
    border: 1px solid var(--home-line);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  }

  .dropdown-menu li a {
    padding: 12px 14px;
    border-radius: 7px;
    font-size: 1rem;
    line-height: 1.35;
    color: var(--text-mid);
  }

  .dropdown-menu li a:hover {
    background: var(--text-hover);
    color: var(--bg-light);
  }

  /* Hamburger toggle — replace visible Work/Contact links on mobile */
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: auto;
    height: auto;
    padding: 9px 4px;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
  }

  .nav-toggle-bar {
    display: block;
    width: 18px;
    height: 1.5px;
    margin: 3px 0;
    background: var(--text-main);
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  /* When open, hide the 3 bars (keep their layout space so the toggle
     and logo stay in a fixed position) and draw a clean symmetric 2-line X */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar {
    visibility: hidden;
  }

  .nav-toggle[aria-expanded="true"]::before,
  .nav-toggle[aria-expanded="true"]::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 1.5px;
    background: var(--text-main);
    border-radius: 1px;
    transition: transform 0.25s ease;
  }

  .nav-toggle[aria-expanded="true"]::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"]::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  /* Mobile menu panel */
  .mobile-menu {
    display: block;
    position: absolute;
    top: 100%;
    right: 14px;
    left: 14px;
    margin: 8px 0 0;
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid var(--home-line);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
    list-style: none;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .mobile-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mobile-menu > li > a {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .mobile-menu > li > a:hover {
    background: var(--text-hover);
    color: var(--bg-light);
  }

  /* Contact matches the Work submenu links' style (not bold) */
  .mobile-menu > li:not(.dropdown) > a {
    font-weight: 400;
    font-size: 1rem;
    color: var(--text-mid);
  }

  /* Hide the top-level "Work" label; keep the Work submenu links */
  .mobile-menu .dropdown > a {
    display: none;
  }

  .mobile-menu .dropdown-menu {
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    border: 0;
    margin: 2px 0 6px;
    padding: 0;
    min-width: 0;
    right: auto;
    border-radius: 0;
  }

  .mobile-menu .dropdown-menu li a {
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-mid);
  }

  .mobile-menu .dropdown-menu li a:hover {
    background: var(--text-hover);
    color: var(--bg-light);
  }
}

/* ===== Header fix for tablets (740px – 900px) ===== */
@media (min-width: 740px) and (max-width: 900px) {
  .nav-center {
    padding: 0 16px;
  }

  .nav-links { gap: 24px; }
  .nav-links a { font-size: 1.2rem; }
}