/* =========================================
   AgileAI Public Surface — Institutional CSS v12.1

   Governance State: STABILIZED
   Upgrade Type: Safe Full Replacement

   Institutional Refinement Layer:
   - Stable viewport compensation
   - Fixed mobile header overlap
   - Unified desktop/mobile rendering rhythm
   - Preserved institutional hierarchy
   - Preserved navigation architecture
   - Preserved operational spacing model
   - Improved first viewport rendering stability
   - Refined institutional mobile breathing rhythm
   - Improved editorial hero presentation

   Architecture Upgrade:
   - Global fixed-header compensation
   - Removed excessive manual main offsets
   - Stabilized mobile hero visibility
   - Prevented hidden content rendering
   - Improved responsive alignment consistency
   - Refined mobile visual calmness
   - Improved institutional readability

   Governance Rules:
   - No destructive layout changes
   - No navigation logic changes
   - No structural HTML dependency changes
   - No responsive regressions
========================================= */


/* =========================
   ROOT VARIABLES
========================= */

:root {
  --text-primary: #111111;
  --text-secondary: #555555;

  --border-subtle: rgba(0,0,0,0.06);
  --border-soft: rgba(0,0,0,0.03);

  --background: #ffffff;
  --surface-muted: #f6f6f6;
  --surface-elevated: rgba(255,255,255,0.94);

  --max-width: 720px;
  --header-height: 80px;

  --transition-speed: 180ms;
  --motion-standard: cubic-bezier(.4,0,.2,1);

  --link-color: #2e5c7a;
  --link-hover: #1f3f56;
}

:root[data-theme="dark"] {
  --text-primary: #f2f2f2;
  --text-secondary: #b5b5b5;

  --border-subtle: rgba(255,255,255,0.10);
  --border-soft: rgba(255,255,255,0.04);

  --background: #0f1115;
  --surface-muted: #151821;
  --surface-elevated: rgba(27,31,38,0.94);

  --link-color: #7fb3d5;
  --link-hover: #a8d0ea;
}


/* =========================
   BASE
========================= */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  /*
     Institutional Fixed Header Compensation
     ---------------------------------------
     Reserves viewport space globally for
     the fixed institutional header.

     Prevents hidden rendering underneath
     the header across desktop/mobile views.
  */

  padding-top: var(--header-height);

  background: var(--background);
  color: var(--text-primary);

  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.74;

  text-rendering: optimizeLegibility;

  overflow-x: hidden;

  transition:
    background var(--transition-speed),
    color var(--transition-speed);
}

body.nav-open {
  overflow: hidden;
}


/* =========================
   HEADER
========================= */

#header {
  width: 100%;
}

.site-header {
  width: 100%;
  height: var(--header-height);

  border-bottom: 1px solid var(--border-soft);

  background: var(--background);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  z-index: 5000;

  display: flex;
  align-items: center;

  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.header-inner {
  width: 100%;
  max-width: 1200px;

  margin: 0 auto;
  padding: 0 32px;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand a {
  text-decoration: none;
  color: var(--text-primary);

  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
}


/* =========================
   NAVIGATION
========================= */

.main-nav {
  position: relative;
}

.nav-tree {
  list-style: none;

  margin: 0;
  padding: 0;

  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-item {
  position: relative;
}

.nav-item > a,
.nav-toggle {
  background: none;
  border: none;

  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 400;
  letter-spacing: 0.15px;

  color: var(--text-primary);

  cursor: pointer;
  padding: 0;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  transition: opacity 140ms ease;
}

.nav-item > a:hover,
.nav-toggle:hover {
  opacity: 0.8;
}

.nav-toggle::after {
  content: "▾";
  font-size: 0.7rem;

  transition:
    transform 180ms var(--motion-standard);
}

.nav-item.is-open > .nav-toggle::after {
  transform: rotate(180deg);
}

.sub-menu {
  list-style: none;

  padding: 0;
  margin: 0;

  display: flex;
  flex-direction: column;
  gap: 6px;
}


/* =========================
   DESKTOP NAVIGATION
========================= */

@media (min-width: 769px) {

  .nav-hamburger {
    display: none;
  }

  .nav-item > .sub-menu {
    position: absolute;
    right: 0;
    top: 100%;

    background: var(--surface-elevated);

    border: 1px solid var(--border-soft);
    border-radius: 4px;

    padding: 10px 14px;
    min-width: 240px;

    box-shadow: 0 10px 24px rgba(0,0,0,0.04);

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(4px);

    transition:
      opacity 160ms ease,
      transform 200ms var(--motion-standard),
      visibility 0s linear 160ms;
  }

  .nav-item:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
  }

  .sub-menu .sub-menu {
    position: static;

    background: transparent;
    border: none;
    box-shadow: none;

    padding-left: 14px;
    margin-top: 6px;

    border-left: 1px solid var(--border-soft);
  }
}


/* =========================
   MOBILE NAVIGATION
========================= */

@media (max-width: 768px) {

  .site-header {
    box-shadow: none;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }

  .header-inner {
    padding: 0 20px;
  }

  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;

    background: none;
    border: none;

    cursor: pointer;
  }

  .nav-hamburger span {
    width: 22px;
    height: 2px;

    background: var(--text-primary);

    display: block;
  }

  .main-nav {
    position: fixed;

    top: var(--header-height);
    left: 0;
    right: 0;

    background: var(--background);

    border-bottom: none;

    max-height: 0;
    overflow: hidden;

    transition:
      max-height 260ms var(--motion-standard);
  }

  body.nav-open .main-nav {
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
  }

  .nav-tree {
    flex-direction: column;
    align-items: flex-start;

    gap: 18px;

    padding: 24px 20px;
  }

  .nav-item > .sub-menu {
    max-height: 0;

    overflow: hidden;

    padding-left: 14px;
    margin-top: 6px;

    opacity: 0;

    transition:
      max-height 260ms var(--motion-standard),
      opacity 180ms ease;
  }

  .nav-item.is-open > .sub-menu {
    max-height: 600px;
    opacity: 1;
  }
}

/* =========================
   INSTITUTIONAL IDENTITY BAND
   v12.2 Institutional Surface Layer

   Governance Purpose:
   - Establish institutional visual containment
   - Prevent raw full-width text rendering
   - Preserve editorial hierarchy
   - Improve desktop/mobile readability
   - Align identity band with institutional rhythm

   Safety Rules:
   - Non-destructive
   - No navigation changes
   - No structural dependency changes
   - No layout architecture regressions
========================= */

.institutional-band-wrapper {

  width: 100%;

  background: var(--surface-muted);

  border-bottom: 1px solid var(--border-soft);

}

.institutional-band {

  max-width: 1200px;

  margin: 0 auto;

  padding:
    14px
    32px;

  color: var(--text-secondary);

  font-size: 0.92rem;

  line-height: 1.72;

  letter-spacing: 0.1px;

  text-align: center;

}


/* =========================
   MOBILE — INSTITUTIONAL BAND
========================= */

@media (max-width: 768px) {

  .institutional-band {

    padding:
      12px
      22px;

    font-size: 0.86rem;

    line-height: 1.76;

    text-align: left;

  }

}

/* =========================
   LAYOUT
========================= */

main {
  max-width: var(--max-width);

  margin: 60px auto 100px;

  padding: 0 32px;

  min-height: calc(100vh - 200px);
}


/* =========================
   SECTION RHYTHM
========================= */

main section {
  margin-bottom: 84px;
}

main section:last-of-type {
  margin-bottom: 40px;
}

main > section:first-of-type {
  margin-bottom: 64px;
}


/* =========================
   TYPOGRAPHY
========================= */

h1 {
  font-size: 2.9rem;
  font-weight: 500;

  line-height: 1.18;
  letter-spacing: -0.4px;

  margin-bottom: 34px;
}

h2 {
  font-size: 1.85rem;
  font-weight: 500;

  line-height: 1.28;
  letter-spacing: -0.2px;

  margin-top: 76px;
  margin-bottom: 22px;

  scroll-margin-top: 120px;
}

p {
  margin-top: 0;
  margin-bottom: 24px;

  max-width: 68ch;
  line-height: 1.78;
}


/* =========================
   LISTS
========================= */

main ul {
  margin-top: 18px;
  margin-bottom: 32px;

  padding-left: 22px;
}

main ul li {
  margin-bottom: 12px;

  line-height: 1.68;
  padding-left: 2px;
}


/* =========================
   CTA
========================= */

.btn {
  display: inline-block;

  margin-top: 16px;
  padding: 10px 20px;

  border-radius: 4px;

  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.2px;

  text-decoration: none;

  transition:
    opacity 160ms ease;
}

.btn.primary {
  background: var(--text-primary);
  color: var(--background);
}

.btn.secondary {
  background: transparent;

  border: 1px solid var(--border-soft);
  color: var(--text-primary);
}

.btn:hover {
  opacity: 0.85;
}


/* =========================
   LINKS
========================= */

a {
  color: var(--link-color);

  text-decoration: none;

  transition:
    color 150ms ease,
    opacity 140ms ease;
}

a:hover {
  color: var(--link-hover);
  opacity: 0.88;

  text-decoration: underline;
}

main a {
  font-weight: 500;

  text-decoration-thickness: 0.8px;
  text-underline-offset: 2px;
}


/* =========================
   FOOTER
========================= */

#footer {
  margin-top: 120px;
}

.site-footer {
  border-top: 1px solid var(--border-soft);

  padding: 64px 32px;

  background: var(--surface-muted);
}

.footer-inner {
  max-width: 720px;

  margin: 0 auto;

  font-size: 0.9rem;
  color: var(--text-secondary);

  line-height: 1.78;
}

.footer-inner p {
  margin-bottom: 20px;
}

.footer-links a {
  font-weight: 500;
  opacity: 0.92;
}

.footer-links a:hover {
  opacity: 1;
}


/* =========================
   RESPONSIVE TYPOGRAPHY
========================= */

@media (max-width: 768px) {

  /*
     Mobile Institutional Editorial Layer v12.1
     ------------------------------------------
     Refines first viewport readability and
     editorial spacing for institutional
     learning surfaces.

     Prevents compressed hero rendering while
     preserving stabilized header compensation.
  */

  main {
    margin-top: 72px;

    padding-left: 28px;
    padding-right: 28px;
  }

  h1 {
    font-size: 2.45rem;

    line-height: 1.16;
    letter-spacing: -0.3px;
  }

  p {
    line-height: 1.84;
  }

}