/* ============================================================
   THE ELITE EIGHT BOARDING SCHOOLS — Master Stylesheet v1.2
   Updates: hamburger nav, back to top, mobile contents bar,
            full mobile layout for phone portrait / tablet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ---- CSS Variables ---- */
:root {
  --blue:       #2B4594;
  --green:      #154F22;
  --light-blue: #D8EEF0;
  --black:      #111111;
  --dark-gray:  #444444;
  --mid-gray:   #888888;
  --light-gray: #F2F2F2;
  --border:     #CCCCCC;
  --white:      #FFFFFF;

  --fs-h1:      20px;
  --fs-h2:      17.3px;
  --fs-h3:      14.7px;
  --fs-body:    13.3px;
  --fs-note:    10.7px;

  --nav-height: 54px;
  --sidebar-w:  300px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; }

body {
  font-family: 'Hanken Grotesk', 'Segoe UI', sans-serif;
  font-size: var(--fs-body);
  color: var(--black);
  background: var(--white);
  line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   TOP NAVIGATION — DESKTOP
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
}

.nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  white-space: nowrap;
}

/* Desktop nav links */
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  font-size: 12.5px;
  color: var(--black);
  padding: 6px 10px;
  border-radius: 4px;
  transition: background 0.15s;
}

.nav-links a:hover {
  background: var(--light-gray);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--blue);
  font-weight: 600;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  width: 36px;
  height: 36px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--black);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
  transform-origin: center;
}

/* Animate to X when open */
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   PAGE BODY — 3-COLUMN LAYOUT (desktop)
   ============================================================ */
.page-body {
  margin-top: var(--nav-height);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--sidebar-w);
  min-height: calc(100vh - var(--nav-height));
  gap: 0;
  align-items: start;
}

/* Sidebars */
.sidebar {
  padding: 20px 18px;
  background: var(--white);
  border-right: 1px solid var(--light-gray);
}

.sidebar.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--light-gray);
  position: sticky;
  top: var(--nav-height);
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}

/* Ad placeholders */
.ad-box {
  background: var(--light-gray);
  border: 1px dashed var(--border);
  border-radius: 4px;
  text-align: center;
  padding: 16px 8px;
  font-size: 11px;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.ad-box .ad-dims {
  font-size: 10px;
  margin-top: 4px;
}

/* Main content area */
.main-content {
  padding: 24px 32px 48px;
  max-width: 100%;
  overflow: hidden;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  font-size: 12px;
  color: var(--mid-gray);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--mid-gray); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue); text-decoration: underline; }
.breadcrumb .sep { color: var(--border); font-size: 11px; }
.breadcrumb .current { color: var(--dark-gray); }

/* ============================================================
   HOME PAGE
   ============================================================ */
.home-hero {
  text-align: center;
  padding: 32px 24px 28px;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  margin-bottom: 28px;
}

.home-hero p {
  font-size: var(--fs-body);
  color: var(--dark-gray);
  max-width: 580px;
  margin: 0 auto 10px;
  line-height: 1.65;
}

.home-hero .tagline {
  font-size: 12px;
  color: var(--mid-gray);
  margin-bottom: 16px;
}

.search-bar {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.search-bar input {
  flex: 1;
  padding: 9px 14px;
  font-size: var(--fs-body);
  font-family: inherit;
  border: none;
  outline: none;
  color: var(--black);
}

.search-bar button {
  padding: 9px 16px;
  background: var(--blue);
  color: var(--white);
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-bar button:hover { background: #1e3370; }

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.category-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  text-decoration: none;
  color: var(--black);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}

.category-card:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(43,69,148,0.08);
  text-decoration: none;
}

.category-card h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 5px;
}

.category-card .cat-desc {
  font-size: 11.5px;
  color: var(--mid-gray);
  line-height: 1.45;
  margin-bottom: 6px;
}

.category-card .cat-count {
  font-size: 11px;
  color: var(--mid-gray);
  font-style: italic;
}

.category-card.product-card h3 { color: var(--dark-gray); }

/* Popular articles */
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 14px;
}

.popular-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.popular-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  color: var(--black);
  font-size: var(--fs-body);
  text-decoration: none;
  transition: border-color 0.15s;
  gap: 10px;
}

.popular-item:hover {
  border-color: var(--blue);
  color: var(--blue);
  text-decoration: none;
}

.popular-item svg { flex-shrink: 0; color: var(--mid-gray); }

/* ============================================================
   ARTICLES LANDING PAGE
   ============================================================ */
.articles-page-title {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 28px;
  text-align: center;
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pillar-box {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
}

.pillar-box h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--black);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
  margin-bottom: 12px;
}

.pillar-box ul { list-style: none; padding: 0; }
.pillar-box ul li { padding: 3px 0; }
.pillar-box ul li a { font-size: var(--fs-body); color: var(--blue); }
.pillar-box ul li a:hover { text-decoration: underline; }

/* ============================================================
   ARTICLE PAGE
   ============================================================ */
.article-header { margin-bottom: 22px; }

.article-header h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--black);
  line-height: 1.35;
  margin-bottom: 8px;
}

.article-meta {
  font-size: 12px;
  color: var(--mid-gray);
}

.article-body h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--black);
  margin: 24px 0 10px;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.article-body h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--black);
  margin: 18px 0 8px;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.article-body p {
  font-size: var(--fs-body);
  margin-bottom: 12px;
  line-height: 1.65;
}

.article-body ul,
.article-body ol {
  margin: 8px 0 14px 22px;
}

.article-body li {
  font-size: var(--fs-body);
  margin-bottom: 5px;
  line-height: 1.6;
}

.article-body strong { font-weight: 700; }
.article-body em { font-style: italic; }
.article-body a { color: var(--blue); }

.article-body .note,
.article-body figcaption,
.article-body .table-note {
  font-size: var(--fs-note);
  color: var(--dark-gray);
  margin-top: 4px;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 6px;
  font-size: var(--fs-body);
}

.article-body th {
  background: var(--black);
  color: var(--white);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
}

.article-body td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.article-body tr:nth-child(even) td { background: var(--light-gray); }

/* Table scroll wrapper — makes tables scroll horizontally on mobile */
.article-table-wrapper,
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 6px;
}

.article-table-wrapper table,
.table-wrapper table {
  min-width: 500px;
  margin: 0;
}

/* Images — capped at 624px (matches original Word doc sizing) */
.article-body figure {
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 624px;
}

.article-body figure img {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   ON THIS PAGE WIDGET (desktop right sidebar)
   ============================================================ */
.on-this-page {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 14px;
}

.on-this-page h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dark-gray);
  margin-bottom: 10px;
}

.on-this-page ul { list-style: none; padding: 0; }

.on-this-page ul li a {
  font-size: 12px;
  color: var(--dark-gray);
  display: block;
  padding: 2px 0;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.1s;
}

.on-this-page ul li a:hover,
.on-this-page ul li a.active {
  color: var(--blue);
  font-weight: 700;
}

.on-this-page ul li.h3-item { padding-left: 12px; }
.on-this-page ul li.h3-item a { font-size: 11.5px; }

/* ============================================================
   MOBILE CONTENTS BAR (article pages, mobile only)
   Hidden on desktop — shown via media query below
   ============================================================ */
.mobile-contents {
  display: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}

.mobile-contents-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--light-gray);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  text-align: left;
}

.mobile-contents-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--dark-gray);
}

.mobile-contents-toggle.is-open .mobile-contents-chevron {
  transform: rotate(180deg);
}

.mobile-contents-list {
  list-style: none;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.mobile-contents-list.is-open {
  max-height: 600px;
}

.mobile-contents-list li {
  border-top: 1px solid var(--border);
}

.mobile-contents-list li a {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--dark-gray);
  text-decoration: none;
  transition: background 0.1s;
}

.mobile-contents-list li a:hover,
.mobile-contents-list li a.active {
  background: var(--light-blue);
  color: var(--blue);
  font-weight: 600;
}

.mobile-contents-list li.h3-item a {
  padding-left: 26px;
  font-size: 12.5px;
}

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 900;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: #1e3370;
}

/* ============================================================
   PLACEHOLDER PAGES
   ============================================================ */
.placeholder-content {
  text-align: center;
  padding: 60px 20px;
}

.placeholder-content h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  margin-bottom: 12px;
}

.placeholder-content p {
  color: var(--dark-gray);
  font-size: var(--fs-body);
}

.coming-soon-badge {
  display: inline-block;
  background: var(--light-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--light-gray);
  border-top: 1px solid var(--border);
  padding: 32px 20px 20px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 10px;
}

.footer-col p,
.footer-col a {
  font-size: 12.5px;
  color: var(--dark-gray);
  display: block;
  margin-bottom: 5px;
  text-decoration: none;
}

.footer-col a:hover { color: var(--blue); text-decoration: underline; }
.footer-col .footer-email { color: var(--blue); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--mid-gray);
}

/* ============================================================
   UTILITY
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE — TABLET (max 900px)
   ============================================================ */
@media (max-width: 900px) {

  /* Switch to hamburger nav */
  .nav-hamburger { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }

  .nav-links.nav-open { display: flex; }

  .nav-links li { border-bottom: 1px solid var(--light-gray); }
  .nav-links li:last-child { border-bottom: none; }

  .nav-links a {
    display: block;
    padding: 13px 20px;
    font-size: 14px;
    border-radius: 0;
  }

  /* Collapse to single column, hide sidebars */
  .page-body {
    grid-template-columns: 1fr;
  }

  .sidebar { display: none; }

  .sidebar.sidebar-right {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .main-content { padding: 20px 20px 48px; }

  /* Show mobile contents bar on article pages */
  .mobile-contents { display: block; }

  /* Two-column grids go single column */
  .popular-list { grid-template-columns: 1fr; }
  .articles-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr 1fr; }

  /* Footer stacks */
  .footer-inner { grid-template-columns: 1fr; gap: 20px; padding: 0 16px; }

  /* Images full width on mobile */
  .article-body figure { max-width: 100%; }

  /* Back to top slightly smaller and repositioned */
  .back-to-top { bottom: 20px; right: 16px; width: 36px; height: 36px; }
}

/* ============================================================
   RESPONSIVE — PHONE PORTRAIT (max 560px)
   ============================================================ */
@media (max-width: 560px) {

  /* Nav title truncates gracefully */
  .nav-title { font-size: 12.5px; }

  /* Single column category grid */
  .category-grid { grid-template-columns: 1fr; }

  /* Slightly larger body text for readability on small screens */
  .article-body p,
  .article-body li { font-size: 14px; line-height: 1.7; }

  /* Headings scale down slightly */
  .article-header h1 { font-size: 18px; }
  .article-body h2 { font-size: 16px; }
  .article-body h3 { font-size: 14px; }

  /* Comfortable padding */
  .main-content { padding: 16px 16px 48px; }

  /* Hero padding reduced */
  .home-hero { padding: 24px 16px 20px; }

  /* Tables: min-width ensures readability; wrapper handles scroll */
  .article-body table {
    min-width: 500px;
  }
}

/* ============================================================
   PEOPLE ALSO ASK (PAA) PAGE
   ============================================================ */

/* Page header */
.paa-header {
  margin-bottom: 28px;
}

.paa-title {
  font-size: var(--fs-h1);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.paa-subtitle {
  font-size: var(--fs-body);
  color: var(--dark-gray);
  line-height: 1.6;
}

/* Accordion wrapper */
.paa-accordion {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

/* Category section */
.paa-category {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* Category heading */
.paa-category-title {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--white);
  background: var(--black);
  padding: 10px 16px;
  margin: 0;
  letter-spacing: 0.01em;
}

/* Individual accordion item */
.paa-item {
  border-top: 1px solid var(--border);
}

.paa-item:first-of-type {
  border-top: none;
}

/* Question button */
.paa-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: var(--white);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--black);
  text-align: left;
  transition: background 0.15s;
}

.paa-question:hover {
  background: var(--light-gray);
}

.paa-question[aria-expanded="true"] {
  background: var(--light-blue);
  color: var(--blue);
}

.paa-question span {
  flex: 1;
  line-height: 1.45;
}

/* Chevron icon */
.paa-chevron {
  flex-shrink: 0;
  color: var(--mid-gray);
  transition: transform 0.2s ease;
}

.paa-question[aria-expanded="true"] .paa-chevron {
  transform: rotate(180deg);
  color: var(--blue);
}

/* Answer panel */
.paa-answer {
  padding: 12px 16px 16px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
}

.paa-answer p {
  font-size: var(--fs-body);
  color: var(--dark-gray);
  line-height: 1.65;
  margin: 0;
}

/* Placeholder answer style */
.paa-answer .paa-placeholder {
  font-style: italic;
  color: var(--mid-gray);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .paa-accordion {
    gap: 18px;
  }
}

@media (max-width: 560px) {
  .paa-question {
    font-size: 13.5px;
    padding: 12px 14px;
  }

  .paa-answer {
    padding: 10px 14px 14px;
  }

  .paa-answer p {
    font-size: 13.5px;
  }
}
