/* Force mission bar to only cover text height */
/* Updated: 2025-11-04 - GitHub Pages cache fix */
.mission-text {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 0 !important;
  margin: 0 !important;
}
.mission-text h2,
.mission-text .tagline {
  margin: 0 !important;
}
/* Tea Cozy — exact match to Codecademy example (desktop), with small responsive tweaks */
/* Design tokens */
:root {
  --color-bg: #000; /* black */
  --color-text: seashell; /* primary text */
  --color-border: seashell; /* light border */
  --header-height: 69px;
  --container-max: 1200px;
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
}

/* Base */
html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* prevent horizontal scroll */
  overscroll-behavior-x: none; /* disable horizontal overscroll */
  touch-action: pan-y; /* restrict touch to vertical scrolling */
}
/* Ensure sizing doesn’t cause overflow */
*,
*::before,
*::after {
  box-sizing: border-box;
}
img,
video {
  max-width: 100%;
  height: auto;
}
body {
  background-color: var(--color-bg);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 22px;
  color: var(--color-text);
  text-align: center;
  opacity: 0.9;
}
/* Utility: visually hidden (for accessible h1) */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: #222;
  color: var(--color-text);
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
  transition: top 0.2s;
  z-index: 2000;
}
.skip-link:focus {
  top: 8px;
}
/* Extra safety: prevent horizontal overflow on main layout wrappers */
main,
header,
footer {
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

/* (moved targeted 400–480px tweak below to win cascade) */

/* Header / Nav */
header {
  height: var(--header-height);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}
.nav-container {
  max-width: var(--container-max);
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 var(--spacing-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo img {
  height: 50px;
}
.nav ul {
  display: flex;
  list-style: none;
  gap: var(--spacing-5);
  margin: 0;
  padding: 0;
}
.nav a {
  color: var(--color-text);
  text-decoration: underline;
}
.nav a[aria-current="true"] {
  text-decoration: none;
  position: relative;
}
.nav a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--color-text);
}
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
/* No-JS baseline adjustments */
body.no-js .hamburger {
  display: none !important;
}
body.no-js .nav ul {
  display: flex !important;
}
/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
}

/* Hamburger (hidden on desktop) */
.nav-toggle {
  display: none;
}
.hamburger {
  display: none;
  width: 32px;
  height: 24px;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}
.hamburger span {
  display: block;
  height: 3px;
  background: seashell;
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}
/* Animate hamburger into an X when open */
.nav-toggle:checked + .hamburger span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.nav-toggle:checked + .hamburger span:nth-child(2) {
  opacity: 0;
}
.nav-toggle:checked + .hamburger span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Account for fixed header when jumping to anchors */
section {
  scroll-margin-top: 80px;
}

/* Mission */
.mission-container {
  background-image: url(./img-mission-background.jpg);
  background-position: center;
  background-size: cover;
  height: 700px;
  width: var(--container-max);
  margin: var(--header-height) auto 40px auto; /* sits below fixed header */
  display: flex;
  justify-content: center;
  align-items: center;
}
.mission-text {
  background-color: var(--color-bg);
  width: 100%;
  padding: 0.04rem 0 !important;
}

/* Featured Tea */
.featured-tea-container {
  max-width: 1000px;
  margin: 0 auto 40px auto;
}
.f-t-text {
  /* force heading block to occupy its own row within the flex container */
  flex: 0 0 100%;
  margin-bottom: 10px;
}
.f-t-text h2,
.f-t-text h4 {
  margin: 10px 0;
}
.tea-month-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.tea-month-pic {
  /* ensure consistent card spacing and alignment */
  margin: 10px 15px;
  text-align: center;
}
.tea-month-pic img {
  width: 300px;
  height: 200px;
  object-fit: cover;
}
.tea-month-pic h4 {
  margin: 10px 0 0 0;
  font-weight: normal;
}
.tagline {
  font-size: 0.9em;
  line-height: 1.4;
  margin: 6px auto 0;
  max-width: 70ch;
}
.f-t-second {
  /* second row container as a flex item that starts on a new line */
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
}

/* Locations */
.locations-container {
  /* show more of the background and bias towards the cup area */
  background-image: url(./img-locations-background.jpg);
  background-repeat: no-repeat;
  /* show more of the cup's top: move image further up (lower Y %) */
  background-position: 85% 0%;
  /* zoomed-out relative to the container width on desktop */
  background-size: var(--container-max) auto;
  height: 800px;
  width: var(--container-max);
  margin: 0 auto 40px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 70px; /* push heading inside the background area */
}
.locations-heading {
  margin: 0 0 20px 0;
}
.address {
  display: flex;
  gap: 40px;
  justify-content: center;
  width: 100%;
}
.location {
  background: var(--color-bg);
  width: 300px;
  height: 285px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 3rem; /* match example's text rhythm */
}
/* Desktop: keep all location cards aligned; mobile offset defined in @media */

/* Footer */
.contact-info {
  height: 200px;
}
.copyright {
  text-align: left;
  padding-left: 20px;
}

/* Minimal responsiveness (does not change desktop look) */
@media (max-width: 1240px) {
  .mission-container,
  .locations-container {
    width: 100%;
  }
  .locations-container {
    /* keep the cup in frame and scale to container width */
    width: 100%;
    height: auto;
    background-position: 85% 0%;
    background-size: 100% auto;
    overflow-x: hidden; /* extra safety for background container */
  }
}
@media (max-width: 1040px) {
  .featured-tea-container {
    padding: 0 10px;
  }
  .tea-month-pic img {
    width: 260px;
    height: 173px;
  }
  /* Allow locations to wrap before mobile to avoid horizontal scroll */
  .address {
    flex-wrap: wrap;
  }
}

/* Tablet layout: fit all three Locations in one row at ~768px */
@media (min-width: 761px) and (max-width: 1040px) {
  .locations-container {
    min-height: 500px; /* slightly shorter to reveal more background */
  }
  .address {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
  }
  .location {
    width: 220px;
    height: 240px;
    line-height: 2.2rem;
  }
}
@media (max-width: 760px) {
  body {
    font-size: 18px;
  }
  /* Keep header fixed on mobile too */
  header {
    position: fixed;
  }
  main {
    margin-top: 76px;
  } /* avoid overlap under fixed header */
  .nav-container {
    flex-direction: row;
    height: var(--header-height);
    padding: 0 var(--spacing-3);
    gap: var(--spacing-3);
  }
  .logo img {
    height: 42px;
  }
  /* Show hamburger, hide menu by default */
  .hamburger {
    display: flex;
  }
  .nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    right: 0;
  }
  .nav ul {
    display: none;
    flex-direction: column;
    gap: 0;
    background: rgba(0, 0, 0, 0.95);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-2) 0;
    margin: 0;
    width: 100%;
  }
  /* Toggle menu when checkbox checked */
  .nav-toggle:checked ~ .hamburger + .nav ul {
    display: flex;
  }
  .nav a {
    padding: 10px var(--spacing-4);
    display: block;
  }
  .mission-container {
    margin: 0 auto 20px auto;
    height: 400px;
    width: 100%;
  }
  .mission-text {
    width: 85%;
    padding: 0.04rem 0 !important;
    margin: 0 auto;
  }
  .mission-text h2 {
    margin: 0.5px 0;
    font-size: 18px;
  }
  .mission-text h4 {
    margin: 0.5px 0;
    margin-top: 0.5px !important;
    margin-bottom: 0.5px !important;
    font-size: 14px;
  }
  .locations-container {
    width: 100%;
    height: auto;
    background-position: 85% 0%;
    background-size: 100% auto;
    padding-bottom: 24px;
  }
  .address {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }
  .location {
    width: 90%;
    max-width: 300px;
    height: auto;
    padding: 20px 0;
    line-height: 2rem;
  }
  .featured-tea-container,
  .mission-container {
    width: 100%;
  }
  .tea-month-pic img {
    width: 100%;
    height: auto;
    max-width: 500px;
  }
  .tea-month-pic {
    margin: 10px auto;
    width: 90%;
    max-width: 520px;
  }
  /* Stack tea items vertically on mobile */
  .tea-month-container {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .f-t-second {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .f-t-text {
    margin-bottom: 0.5rem;
  }

  /* Drop the first location card down slightly on mobile */
  .address .location:first-child {
    margin-top: clamp(80px, 18vw, 160px);
  }
}

/* Small phones: mission text bar should match image width */
@media (max-width: 425px) {
  .mission-text {
    width: 100%;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
}

/* Targeted tweak: extra drop for 400–480px widths (e.g., 425px in DevTools)
   Placed after general mobile styles so it overrides them */
@media (min-width: 400px) and (max-width: 480px) {
  .locations-container .address .location:first-child {
    margin-top: 200px;
  }
}
