/* ==========================================================================
   Guidelines — page-specific design
   Scoped under .gl- namespace so it never leaks into the rest of the theme.
   Mobile-first: base rules target phone width, min-width queries layer on
   desktop. Uses the theme's existing tokens so it inherits light/dark mode.
   ========================================================================== */

.gl {
  --gl-rule: var(--clr-border-light);
  overflow-x: clip;
}

/* ---------- Hero : editorial masthead ---------- */
.gl-hero {
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--gl-rule);
}

.gl-hero__kicker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clr-text-faint);
  margin-bottom: var(--space-5);
}

.gl-hero__kicker::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--clr-primary);
  flex-shrink: 0;
}

.gl-hero__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  align-items: end;
}

@media (min-width: 900px) {
  .gl-hero__row { grid-template-columns: 1.4fr 0.6fr; }
}

.gl-hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 7.4vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--clr-white);
  margin: 0;
}

.gl-hero__title em {
  font-style: italic;
  color: var(--clr-primary);
}

.gl-hero__lede {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
  color: var(--clr-text-muted);
  max-width: 36ch;
  margin: 0;
}

/* ---------- Layout : sticky chapter nav + chapters ---------- */
.gl-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 7vw, 5rem);
}

@media (min-width: 900px) {
  .gl-layout { grid-template-columns: 220px 1fr; gap: var(--space-14); }
}

/* Mobile: horizontal scrolling chip nav. Desktop: sticky vertical rail. */
.gl-nav {
  order: -1;
}

.gl-nav__list {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
  list-style: none;
  margin: 0;
}

.gl-nav__list::-webkit-scrollbar { display: none; }

.gl-nav__link {
  flex: 0 0 auto;
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  white-space: nowrap;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-full);
  transition: border-color .2s var(--ease-out, ease), color .2s var(--ease-out, ease), background .2s var(--ease-out, ease);
}

.gl-nav__link:hover { border-color: var(--clr-primary); color: var(--clr-text); }

.gl-nav__link.is-active {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  background: var(--clr-primary-glow);
}

@media (min-width: 900px) {
  .gl-nav { position: sticky; top: var(--space-8); align-self: start; }
  .gl-nav__list { flex-direction: column; overflow-x: visible; gap: var(--space-1); }
  .gl-nav__link { border: none; border-radius: 0; padding: 0.5rem 0 0.5rem var(--space-4); border-left: 2px solid transparent; }
  .gl-nav__link:hover { border-left-color: var(--clr-border-light); background: none; }
  .gl-nav__link.is-active { border-left-color: var(--clr-primary); background: none; }
}

/* ---------- Chapters ---------- */
.gl-chapters {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 6vw, 4rem);
  max-width: 720px;
}

.gl-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease-out, ease), transform .6s var(--ease-out, ease);
}
.gl-reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gl-reveal { opacity: 1; transform: none; transition: none; }
}

.gl-chapter {
  padding-top: clamp(1.5rem, 4vw, 2rem);
  border-top: 1px solid var(--gl-rule);
  scroll-margin-top: var(--space-8);
}

.gl-chapter:first-child { border-top: none; padding-top: 0; }

.gl-chapter__num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--clr-primary);
  margin-bottom: var(--space-3);
}

.gl-chapter__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--clr-white);
  margin: 0 0 var(--space-4);
}

.gl-chapter__intro {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--clr-text-muted);
  max-width: 60ch;
  margin: 0 0 var(--space-6);
}

.gl-rules {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.gl-rules__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--clr-text-muted);
}

.gl-rules__item strong { color: var(--clr-text); }

.gl-rules__icon {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--clr-primary);
}

/* ---------- Closing CTA ---------- */
.gl-cta {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 3rem);
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.gl-cta__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  color: var(--clr-white);
  margin: 0 0 var(--space-3);
}

.gl-cta__sub {
  color: var(--clr-text-muted);
  max-width: 380px;
  margin: 0 auto var(--space-7);
  font-size: 0.98rem;
}

.gl-cta__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a0a00;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  padding: 0.85rem 1.6rem;
  box-shadow: var(--shadow-glow);
  transition: transform .25s var(--ease-out, ease), box-shadow .25s var(--ease-out, ease);
}

.gl-cta__btn svg { transition: transform .25s var(--ease-out, ease); }

.gl-cta__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(212,137,26,0.28);
}

.gl-cta__btn:hover svg { transform: translateX(3px); }

[data-theme="dark"] .gl-cta__btn:hover {
  box-shadow: 0 8px 28px rgba(255,176,32,0.3);
}
