/* ==========================================================================
   IBPLD Home refine — typography scale, spacing, smart header, micro UX
   Does NOT rebuild sections; only visual hierarchy + header behavior.
   ========================================================================== */

:root {
  --font-hero: clamp(3.4rem, 6vw, 6.2rem);
  --font-h1-section: clamp(2.15rem, 3.4vw, 3.85rem);
  --font-h2: clamp(1.85rem, 2.5vw, 2.85rem);
  --font-h3: clamp(1.2rem, 1.55vw, 1.65rem);
  --font-body-lg: clamp(1.02rem, 1.1vw, 1.18rem);
  --font-body: clamp(0.95rem, 0.98vw, 1.05rem);

  --section-space-lg: clamp(5.5rem, 8vw, 9rem);
  --section-space-md: clamp(4rem, 6.5vw, 7rem);
  --section-space-sm: clamp(2.75rem, 4.5vw, 4.5rem);

  --mast-h: 5.5rem;
  --mast-h-scrolled: 4.5rem;

  --z-header: 1000;
  --z-dropdown: 1100;
  --z-modal: 2000;
}

/* Reading width */
.immersion__sub,
.doings__lead,
.conx__lead p,
.conx__panel-text,
.acadx__lead,
.acadx-feature__text,
.knowx__lead,
.cpldif__body,
.market__sub,
.voicex-card__quote p {
  max-width: 65ch;
}

.doings-item__text,
.acadx-cert__text,
.acadx-trail__text,
.conx__panel-text {
  max-width: 56ch;
}

/* Scroll anchors under fixed/floating header */
html {
  scroll-padding-top: calc(var(--header-height, var(--mast-h)) + 12px);
}

section[id],
main [id] {
  scroll-margin-top: calc(var(--header-height, var(--mast-h)) + 20px);
}

[data-header-spacer] {
  display: block;
  width: 100%;
  height: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Global header scroll states (Home + Course)
   Controlled only by ibpld-header.js via site-header--*
   -------------------------------------------------------------------------- */

/* Base chrome — keep specificity low so state classes can win. */
.proto-mast[data-proto-mast].site-header {
  z-index: var(--z-header) !important;
  height: auto !important;
  min-height: var(--mast-h);
  width: 100%;
  border-bottom: 1px solid rgba(23, 25, 29, 0.08) !important;
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition:
    transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease,
    background-color 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
  will-change: transform;
  overflow-anchor: none;
}

/* TOP — in document flow */
.proto-mast[data-proto-mast].site-header.site-header--top {
  position: relative !important;
  top: 0 !important;
  left: auto !important;
  right: auto !important;
  background: #F5F3EE !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

/* FLOATING / HIDDEN — fixed glass bar (must beat stabilize.css) */
.proto-mast[data-proto-mast].site-header.site-header--floating,
.proto-mast[data-proto-mast].site-header.site-header--hidden,
.proto-mast[data-proto-mast].site-header.site-header--scrolled,
.proto-mast[data-proto-mast].proto-mast--scrolled {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  background: rgba(250, 248, 244, 0.9) !important;
  backdrop-filter: blur(16px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(120%) !important;
  border-bottom: 1px solid rgba(23, 25, 29, 0.08) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04) !important;
}

.proto-mast[data-proto-mast].site-header.site-header--hidden,
.proto-mast[data-proto-mast].proto-mast--hidden {
  transform: translate3d(0, -105%, 0) !important;
  opacity: 0;
  pointer-events: none;
}

.proto-mast[data-proto-mast].site-header.site-header--hidden.is-drawer-locked,
.proto-mast[data-proto-mast].proto-mast--hidden.is-drawer-locked,
.proto-mast[data-proto-mast].is-drawer-locked,
.proto-mast[data-proto-mast].is-lang-open,
.proto-mast[data-proto-mast]:focus-within {
  transform: none !important;
  opacity: 1 !important;
  pointer-events: auto;
}

.proto-mast__bar {
  min-height: var(--mast-h);
}

.proto-mast__brand img {
  width: auto;
  height: 46px;
  filter: none;
  opacity: 1;
  object-fit: contain;
}

.inst-video-modal {
  z-index: var(--z-modal) !important;
}

@media (prefers-reduced-motion: reduce) {
  header.proto-mast,
  .proto-mast[data-proto-mast],
  .site-header {
    transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important;
  }
}

.proto-mast__mobile-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.proto-mast__icon {
  display: block;
  flex: 0 0 auto;
}

.proto-mast__lang-wrap {
  position: relative;
}

.proto-mast__lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  background: transparent;
  color: var(--ink, #17191D);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.proto-mast__lang-btn:hover,
.proto-mast__lang-btn:focus-visible {
  color: var(--wine, #4C0911);
  outline: none;
}

.proto-mast__chevron {
  opacity: 0.65;
  transition: transform 180ms ease;
}

.proto-mast__lang-btn[aria-expanded="true"] .proto-mast__chevron {
  transform: rotate(180deg);
}

.proto-mast__lang-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: var(--z-dropdown);
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #FAF8F4;
  border: 1px solid rgba(23, 25, 29, 0.1);
  box-shadow: 0 14px 36px rgba(23, 25, 29, 0.1);
}

.proto-mast__lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.65rem;
  color: var(--ink, #17191D);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.proto-mast__lang-option:hover,
.proto-mast__lang-option:focus-visible,
.proto-mast__lang-option.is-active {
  background: rgba(76, 9, 17, 0.05);
  color: var(--wine, #4C0911);
  outline: none;
}

.proto-mast__lang-check {
  color: var(--wine, #4C0911);
  font-size: 0.875rem;
}

.proto-mast__student {
  gap: 0.45rem;
  transition:
    background-color 200ms ease,
    color 200ms ease,
    border-color 200ms ease;
}

.proto-mast__student:hover,
.proto-mast__student:focus-visible {
  background: var(--ink, #17191D);
  border-color: var(--ink, #17191D);
  color: #F7F6F2 !important;
}

.proto-mast__link {
  position: relative;
  padding-bottom: 0.2rem;
}

.proto-mast__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.15rem;
  height: 2px;
  background: var(--wine, #4C0911);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.proto-mast__link.is-active {
  color: var(--wine, #4C0911);
}

.proto-mast__link.is-active::after {
  transform: scaleX(1);
}

.proto-drawer__sep {
  height: 1px;
  margin: 1rem 0;
  background: rgba(23, 25, 29, 0.1);
}

.proto-drawer__student {
  gap: 0.55rem;
}

.proto-drawer__lang {
  display: block;
  padding: 0.55rem 0;
  font-weight: 600;
}

@media (max-width: 1023px) {
  .proto-mast__aside {
    display: none !important;
  }

  .proto-mast__brand img {
    height: 38px;
  }
}

@media (min-width: 1024px) {
  .proto-mast__mobile-tools {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Typography hierarchy
   -------------------------------------------------------------------------- */

.immersion__title {
  font-size: var(--font-hero) !important;
  line-height: 0.95 !important;
  max-width: 9.5ch !important;
  letter-spacing: -0.045em !important;
}

.immersion__copy {
  max-width: min(100%, 50rem); /* ~800px */
}

.immersion__sub {
  font-size: var(--font-body-lg);
  line-height: 1.5;
}

@media (min-width: 1024px) {
  .immersion__grid {
    column-gap: clamp(2rem, 4vw, 3.5rem) !important;
  }

  .immersion__title {
    font-size: clamp(3.6rem, 5.4vw, 6.1rem) !important;
  }
}

@media (min-width: 1440px) {
  .immersion__title {
    font-size: clamp(4rem, 5vw, 6.2rem) !important;
  }
}

.doings {
  padding-block: var(--section-space-md) !important;
}

.doings__intro {
  max-width: min(100%, 56rem);
}

.doings__title {
  font-size: clamp(2rem, 3vw, 3.35rem) !important; /* clearly below hero */
  line-height: 1.05 !important;
  max-width: 18ch !important;
  letter-spacing: -0.035em !important;
}

@media (min-width: 1024px) {
  .doings__title {
    font-size: clamp(2.65rem, 3.1vw, 3.45rem) !important;
  }
}

.doings__lead {
  font-size: var(--font-body-lg);
}

.doings-item {
  position: relative;
  border-top: 1px solid transparent;
  transition:
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}

.doings-item__index {
  font-size: 0.6875rem !important;
  letter-spacing: 0.16em !important;
  color: var(--champagne, #CBB897) !important;
}

.doings-item__title {
  font-size: var(--font-h3) !important;
  font-weight: 600 !important;
}

.doings-item__text {
  font-size: var(--font-body) !important;
  line-height: 1.5 !important;
}

.doings-item__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--wine, #4C0911);
  transition: color 200ms ease;
}

.doings-item__cta::before {
  content: none !important;
}

.doings-item__cta::after {
  content: "→";
  display: inline-block;
  transition: transform 200ms ease;
}

.doings-item:hover,
.doings-item:focus-visible {
  border-top-color: rgba(76, 9, 17, 0.45);
  background: transparent;
}

.doings-item:hover .doings-item__title,
.doings-item:focus-visible .doings-item__title,
.doings-item:hover .doings-item__cta,
.doings-item:focus-visible .doings-item__cta {
  color: var(--wine, #4C0911);
}

.doings-item:hover .doings-item__cta::after,
.doings-item:focus-visible .doings-item__cta::after {
  transform: translateX(4px);
}

/* Section titles — keep hierarchy without competing with hero */
.market__title,
.cpldif__title,
.acadx__title,
.conx__title,
.voicex__title,
.riskx__title,
.finalx__title {
  font-size: var(--font-h1-section) !important;
  line-height: 1.08 !important;
  max-width: 18ch;
}

.knowx__title {
  font-size: clamp(1.7rem, 2.6vw, 2.55rem) !important;
  line-height: 1.12 !important;
  max-width: 16ch !important;
}

.cpldif__title {
  font-size: clamp(2rem, 3vw, 3.15rem) !important;
}

.acadx-feature__title,
.acadx-trails__title,
.conx__panel-title {
  font-size: var(--font-h2) !important;
}

.acadx-cert__title,
.acadx-trail__title {
  font-size: var(--font-h3) !important;
  font-weight: 600 !important;
}

/* Body copy scale */
.market__sub,
.cpldif__body,
.acadx__lead,
.conx__lead p,
.knowx__lead,
.voicex-card__quote p {
  font-size: var(--font-body-lg);
}

/* Vertical breathing — content-driven, not empty 100vh */
.doings,
.market,
.conx,
.knowx,
.voicex,
.acadx {
  min-height: 0 !important;
}

main > section.doings,
main > section.conx {
  padding-block: var(--section-space-md) !important;
}

/* --------------------------------------------------------------------------
   Final polish — spacing rhythm (no architecture change)
   -------------------------------------------------------------------------- */

.sitefoot__shell {
  padding-block: clamp(2.5rem, 4vw, 3.5rem) !important;
}

a.acadx-feature {
  margin-bottom: clamp(3rem, 5vw, 4.5rem) !important;
}

.knowx__portrait {
  max-width: min(100%, 21.5rem);
}

.knowx__portrait-frame {
  border: 1px solid rgba(200, 182, 154, 0.22);
}

.voicex-card__quote {
  max-width: 36rem;
  margin-inline: auto;
}

@media (min-width: 1366px) {
  .doings__title {
    font-size: clamp(2.75rem, 3vw, 3.35rem) !important;
  }

  .market__title,
  .acadx__title,
  .conx__title,
  .voicex__title,
  .finalx__title {
    font-size: clamp(2.15rem, 2.6vw, 3.1rem) !important;
  }
}

.home-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.home-reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto !important;
  }

  .proto-mast,
  .proto-mast__bar,
  .proto-mast__brand img,
  .proto-mast__link::after,
  .proto-mast__chevron,
  .doings-item,
  .doings-item__cta,
  .doings-item__cta::after,
  .home-reveal {
    transition: none !important;
    animation: none !important;
  }

  .home-reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .proto-mast--hidden,
  .site-header--hidden {
    transform: none !important;
  }
}
