/* ============================================
   CSS VARIABLE FOR NAVBAR HEIGHT
   ============================================ */
:root {
  --navbar-height: 57px;
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  min-height: 60vh;
}

.hero h1 {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(2em, 10vw, 4em);
  z-index: 1;
  text-align: center;
  color: white;
}

/* ============================================
   CONTENT WRAPPER
   ============================================ */
.content-wrapper {
  display: grid;
  grid-template-columns: 240px 1fr;
  transition: grid-template-columns 0.3s ease;
}

/* Collapsed: no space for sidebar, content goes full width */
.content-wrapper:has(.toc details:not([open]):not(.closing)) {
  grid-template-columns: 0 1fr;
  transition: grid-template-columns 0.3s ease 0.15s;
}

/* When collapsed, make toc fixed so button escapes the grid */
.content-wrapper:has(.toc details:not([open]):not(.closing)) .toc {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  z-index: 100;
}

/* ============================================
   TOC SIDEBAR
   ============================================ */
.toc {
  position: sticky;
  top: var(--navbar-height);
  height: fit-content;
  max-height: calc(100vh - var(--navbar-height));
  overflow: visible;
  align-self: start;
}

.toc details {
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
  width: 240px;
  transition: width 0.3s ease;
}

.toc details[open] {
  overflow-y: auto;
}

/* Closed state */
.toc details:not([open]):not(.closing) {
  width: 0;
  overflow: visible;
}

/* Closing state (JS-controlled animation) */
.toc details.closing {
  width: 0;
  transition: width 0.3s ease 0.1s; /* delay width until fade completes */
}

.toc details.closing nav {
  opacity: 0;
  transition: opacity 0.1s ease; /* fade happens immediately */
}

/* ============================================
   SUMMARY / TOGGLE
   ============================================ */
.toc summary {
  cursor: pointer;
  padding: 1rem;
  font-weight: 600;
  white-space: nowrap;
  list-style: none;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc summary::before {
  content: '\2630';
  margin-right: 0.5rem;
}

/* Collapsed: floating button style */
.toc details:not([open]):not(.closing) summary {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: white;
  padding: 0.75rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 0;
  z-index: 101;
}

.toc details:not([open]):not(.closing) summary::before {
  font-size: 1.25rem;
  margin-right: 0;
}

/* ============================================
   NAV LINKS
   ============================================ */
.toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
  scroll-target-group: auto;
  min-width: 240px;
  opacity: 1;
  transition: opacity 0.15s ease 0.15s;
}

.toc details:not([open]) nav,
.toc details.closing nav {
  opacity: 0;
  transition: opacity 0.1s ease;
}

.toc nav a {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.25rem 0;
  transition: font-weight 0.2s;
}

/* Native CSS scroll-spy (Chrome 140+) */
.toc nav a:target-current {
  font-weight: 700;
  color: var(--aromatic-cedar);
  border-left: 2px solid currentColor;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

/* JS fallback for other browsers */
.toc nav a.active {
  font-weight: 700;
  color: var(--aromatic-cedar);
  border-left: 2px solid currentColor;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

/* ============================================
   ARTICLE - always in second column
   ============================================ */
.article {
  grid-column: 2;
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 768px) {
  .content-wrapper,
  .content-wrapper:has(.toc details:not([open]):not(.closing)) {
    display: block;
  }
  
  .toc {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    z-index: 100;
    height: auto;
    max-height: calc(100vh - var(--navbar-height));
    overflow: visible;
  }
  
  .toc details {
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  }
  
  .toc details[open] summary {
    position: relative;
    top: 0;
    left: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 1rem;
  }
  
  .toc details[open] summary::before {
    margin-right: 0.5rem;
  }
  
  .toc nav {
    padding: 0.5rem 1rem 1rem;
    overflow-y: auto;
  }
}

/* ============================================
   FAQ ACCORDION
   ============================================ */
.faq-accordion {
  max-width: 800px;
  margin-inline: auto;
}

.faq-accordion details {
  border-bottom: 1px solid #e0e0e0;
}

.faq-accordion details[open] {
  padding-bottom: 1.5rem;
}

.faq-accordion summary {
  padding: 1.25rem 0;
  font-family: 'Quando', 'Quando-fallback';
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-accordion summary::-webkit-details-marker {
  display: none;
}

.faq-accordion summary::after {
  content: '+';
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--aromatic-cedar);
  flex-shrink: 0;
}

.faq-accordion details[open] summary::after {
  content: '\2212';
}

.faq-accordion details p {
  padding-right: 2rem;
  color: #4a4a4a;
  line-height: 1.7;
}

/* ============================================
   CTA BUTTONS ROW
   ============================================ */
.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-block: 3rem;
}

.cta-buttons a {
  text-decoration: none;
}

@media (max-width: 576px) {
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

/* ============================================
   HEADINGS
   ============================================ */
h2 {
  text-align: center;
}