/* ==========================================================================
   12-scroll-storytelling | layout.css
   Architecture-specific LAYOUT ONLY — no colors, fonts, or visual decoration.
   CSS scroll-driven animations with narrative story flow.
   ========================================================================== */

/* ---------- Header Layout ---------- */
.story-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--color-bg, #ffffff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.story-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 2rem;
}

.story-header .logo {
  flex-shrink: 0;
  margin-right: 2rem;
}

.story-header .nav-list {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  margin-right: 2rem;
}

.story-header .nav-list a {
  white-space: nowrap;
  font-size: 0.8rem;
}

.story-header .header-cta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.story-header .phone-cta {
  white-space: nowrap;
}

.story-header .mobile-toggle {
  display: none;
}
/* Hamburger bars: the toggle uses bare <span>s (no .hamburger-line class),
   so style them here or the menu button is invisible on mobile. */
.story-header .mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text, #1f2933);
  border-radius: 2px;
}

/* ---------- Story Progress Bar ---------- */
.story-progress {
  position: relative;
  width: 100%;
  height: 3px;
  overflow: hidden;
}

.story-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  will-change: width;
}

/* ---------- Story Main ---------- */
.story-main {
  overflow-x: hidden;
}

/* ---------- Story Frame (Section) ---------- */
.story-frame {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  min-height: 80vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6rem 2rem;
  position: relative;
}

.story-frame:first-child {
  min-height: 90vh;
}

/* ---------- Centered Content Frame ---------- */
.story-frame:has(.story-content--centered):not(:has(.story-cards)):not(:has(.story-visual)) {
  grid-template-columns: 1fr;
  text-align: center;
}

.story-content--centered {
  grid-column: 1 / -1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.story-content--full {
  grid-column: 1 / -1;
}

.story-content--prose {
  grid-column: 1 / -1;
  max-width: 800px;
  margin: 0 auto;
}

/* ---------- Story Visual ---------- */
.story-visual {
  overflow: hidden;
  position: relative;
}

.story-visual img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* ---------- Sticky Scene ---------- */
.story-scene--sticky {
  position: sticky;
  top: 20vh;
}

/* ---------- Story Cards ---------- */
.story-cards {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.story-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.story-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* ---------- Story FAQ ---------- */
.story-faq {
  grid-column: 1 / -1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Story List Grid ---------- */
.story-list-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  text-align: left;
}

/* ---------- Story Actions ---------- */
.story-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.story-content--centered .story-actions {
  justify-content: center;
}

/* ---------- Map ---------- */
.map-embed {
  width: 100%;
  min-height: 400px;
}

.map-embed iframe {
  width: 100%;
  height: 100%;
  min-height: 400px;
}

/* ---------- CTA Frame ---------- */
.story-frame--cta {
  grid-template-columns: 1fr;
  text-align: center;
  min-height: 50vh;
}

/* ---------- Scroll Animation Keyframes ---------- */

/* Fade Up */
@keyframes story-fade-up {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In */
@keyframes story-scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In Left */
@keyframes story-slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In Right */
@keyframes story-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Initial hidden states for JS-driven animations */
.story-frame[data-animation] {
  opacity: 0;
}

.story-frame[data-animation].is-visible {
  opacity: 1;
}

.story-frame[data-animation="fade-up"].is-visible {
  animation: story-fade-up 0.8s ease-out forwards;
}

.story-frame[data-animation="scale-in"].is-visible {
  animation: story-scale-in 0.8s ease-out forwards;
}

.story-frame[data-animation="slide-in-left"].is-visible {
  animation: story-slide-in-left 0.8s ease-out forwards;
}

.story-frame[data-animation="slide-in-right"].is-visible {
  animation: story-slide-in-right 0.8s ease-out forwards;
}

.story-frame[data-animation="stagger-up"].is-visible {
  animation: story-fade-up 0.8s ease-out forwards;
}

.story-frame[data-animation="stagger-up"].is-visible .story-card,
.story-frame[data-animation="stagger-up"].is-visible .story-content {
  opacity: 0;
  animation: story-fade-up 0.6s ease-out forwards;
}

.story-frame[data-animation="stagger-up"].is-visible .story-card:nth-child(1),
.story-frame[data-animation="stagger-up"].is-visible .story-content:nth-child(1) { animation-delay: 0ms; }
.story-frame[data-animation="stagger-up"].is-visible .story-card:nth-child(2),
.story-frame[data-animation="stagger-up"].is-visible .story-content:nth-child(2) { animation-delay: 100ms; }
.story-frame[data-animation="stagger-up"].is-visible .story-card:nth-child(3),
.story-frame[data-animation="stagger-up"].is-visible .story-content:nth-child(3) { animation-delay: 200ms; }
.story-frame[data-animation="stagger-up"].is-visible .story-card:nth-child(4),
.story-frame[data-animation="stagger-up"].is-visible .story-content:nth-child(4) { animation-delay: 300ms; }

.story-frame[data-animation="parallax-text"].is-visible {
  animation: story-fade-up 1s ease-out forwards;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
}

.breadcrumb ol {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- Footer Layout ---------- */
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.footer-brand img {
  max-width: 120px;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

.social-links {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1rem;
}

/* ---------- Skip Nav ---------- */
/* Defined in base.css — no override needed */

/* .sr-only — defined in base.css */

/* ---------- Responsive: Tablet ---------- */

/* ---------- Mobile Menu Toggle ---------- */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-menu-toggle span,
.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 1024px) {
  .story-frame {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 4rem 2rem;
  }

  .story-list-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 640px) {
  .story-header .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
  }

  .story-header .main-nav.is-open {
    display: block;
  }

  .story-header .nav-list {
    flex-direction: column;
    gap: 0;
    padding: 1rem;
  }

  .story-header .mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
  }

  .story-frame {
    padding: 3rem 1rem;
    gap: 2rem;
  }

  .story-cards {
    grid-template-columns: 1fr;
  }

  .story-actions {
    flex-direction: column;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .story-frame[data-animation] {
    opacity: 1;
  }

  .story-frame[data-animation].is-visible,
  .story-frame[data-animation="fade-up"].is-visible,
  .story-frame[data-animation="scale-in"].is-visible,
  .story-frame[data-animation="slide-in-left"].is-visible,
  .story-frame[data-animation="slide-in-right"].is-visible,
  .story-frame[data-animation="stagger-up"].is-visible,
  .story-frame[data-animation="parallax-text"].is-visible {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .story-frame[data-animation="stagger-up"].is-visible .story-card,
  .story-frame[data-animation="stagger-up"].is-visible .story-content {
    animation: none;
    opacity: 1;
  }
}

/* ---------- Header Contract — readable white header ----------
   The shared style layer paints every <nav> dark and sets `.site-header a`
   to the inverse color. This architecture uses a white header, so force the
   inner navs transparent and links dark for guaranteed contrast. These rules
   are unlayered, so they beat the style's @layer rules. */
.site-header {
  background: var(--color-bg, #ffffff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-bottom: none;
}
.main-nav,
nav.breadcrumb {
  background: transparent;
  border-bottom: none;
}
.nav-item > a,
.nav-list a {
  color: var(--color-text);
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}
.nav-item > a:hover,
.nav-item.active > a,
.nav-list a:hover,
.nav-list a[aria-current="page"],
.nav-list a.active {
  color: var(--color-primary);
}
.phone-cta,
.header-phone {
  color: var(--color-primary);
}
.breadcrumb,
.breadcrumb a {
  color: var(--color-text-light);
}
.breadcrumb a:hover {
  color: var(--color-primary);
}

/* Content must be visible without relying on scroll/JS reveal animations.
   The story-frame[data-animation] rule starts every section at opacity:0 and
   only reveals on .is-visible (JS scroll trigger) — leaving content invisible
   in screenshots, for crawlers, and if JS fails. Force story content opaque. */
.story-frame[data-animation],
.story-frame[data-animation].is-visible,
.story-frame[data-animation] .story-card,
.story-frame[data-animation] .story-content,
.story-frame[data-animation].is-visible .story-card,
.story-frame[data-animation].is-visible .story-content {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* Header wordmark (replaces the photo-as-logo) */
.logo a, .logo { text-decoration: none; }
.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--color-primary, #1f2933);
  white-space: nowrap;
}
/* Cap long-form prose line length for readability on wide screens */
.story-content p { max-width: 68ch; }
.story-content--centered p { margin-left: auto; margin-right: auto; }

/* ---------- Blog listing — stacked, readable article cards ----------
   The .story-cards grid (built for short program previews) crammed full
   articles into narrow columns. On the blog, stack them as full-width,
   image-left/text-right cards for a real magazine-style reading layout. */
.blog-list {
  display: flex !important;
  flex-direction: column;
  gap: 2rem;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}
.blog-list .story-card {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.75rem;
  align-items: start;
  text-align: left;
  background: var(--color-bg-alt, #f6f8fa);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
  border-radius: 16px;
  padding: 1.5rem;
}
.blog-list .story-card > img {
  grid-row: 1 / -1;
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0;
}
.blog-list .story-card > :not(img) { grid-column: 2; max-width: none; }
.blog-list .story-card .blog-date {
  display: block;
  color: var(--color-primary, #1f6feb);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.blog-list .story-card h3 { margin: 0 0 0.6rem; line-height: 1.25; }
.blog-list .story-card p { margin: 0 0 0.85rem; }
@media (max-width: 768px) {
  .blog-list .story-card { grid-template-columns: 1fr; padding: 1.1rem; }
  .blog-list .story-card > img { grid-row: auto; min-height: 200px; }
  .blog-list .story-card > :not(img) { grid-column: 1; }
}

/* ---------- Page-hero background image ----------
   Every inner page-hero (Blog, Programs, Admissions, Contact, Privacy, About)
   gets a full image banner with a dark overlay so the heading reads as a
   proper hero. The redundant side image (.story-visual) inside a page-hero is
   hidden — the banner background replaces it. The index hero (aria-label
   "Hero") is unaffected. */
.story-frame[aria-label="Page header"] {
  grid-template-columns: 1fr;
  place-items: center;
  text-align: center;
  min-height: 44vh;
  padding: 4rem 2rem;
  border-radius: 16px;
  background-image: linear-gradient(rgba(18, 27, 38, 0.62), rgba(18, 27, 38, 0.62)), url('../images/hero-2.webp');
  background-size: cover;
  background-position: center;
}
.story-frame[aria-label="Page header"]:first-child {
  min-height: 44vh;
}
.story-frame[aria-label="Page header"] .story-visual {
  display: none;
}
.story-frame[aria-label="Page header"] .story-content h1,
.story-frame[aria-label="Page header"] .story-content p {
  color: #ffffff !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
