:root {
  --fg-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fg-accent: #3D6FB2;
  --fg-warm: #C8966A;
  --fg-paper: #ffffff;
}

/* ============================================================
 Layout — app shell and page-level structure
 ============================================================ */

@layer layout {
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--n-700);
  color: var(--n-50);
  display: flex;
  align-items: center;
  padding-inline: var(--page-px);
  gap: var(--sp-6);
}

.app-header .brand {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--n-50);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.app-header .brand:visited { color: var(--n-50); }
.app-header .brand:hover   { color: #fff; text-decoration: none; }

.app-header nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.app-header nav a {
  color: var(--n-200);
  text-decoration: none;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius);
  white-space: nowrap;
}

.app-header nav a:visited { color: var(--n-200); }

.app-header nav a:hover {
  color: var(--n-50);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.app-header nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.app-main {
  display: flex;
  flex-direction: column;
}

.app-main[data-spacing="compact"] { gap: var(--sp-3); }
}

/* ── Shell ───────────────────────────────────────────────── */
section:not([aria-label="Our commitments"]):not(.p2-dark) {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--page-px);
}

/* ── Sticky sub-nav ──────────────────────────────────────── */
nav[aria-label="Page navigation"] {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
nav[aria-label="Page navigation"].visible {
  border-bottom-color: var(--border-subtle);
}
@scope (nav[aria-label="Page navigation"]) {
  > div {
    max-width: 820px;
    margin-inline: auto;
    padding: 10px var(--page-px);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  a {
    font-family: var(--fg-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  a:hover { color: var(--text); }
  a.p2-cta {
    font-weight: 600;
    padding: 7px 16px;
    background: var(--text);
    color: var(--bg);
    border-radius: 999px;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: background 0.15s ease, opacity 0.25s ease, transform 0.25s ease;
  }
  a.p2-cta:hover { background: var(--fg-accent); color: var(--bg); }
  :scope.visible a.p2-cta {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* ── Divider ─────────────────────────────────────────────── */
section > hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 0; }

/* ── Section content wrapper ─────────────────────────────── */
.p2-sec { width: 100%; padding: 40px 0; }
@scope (.p2-sec) {
  > span {
    font-family: var(--fg-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    display: block;
    margin-bottom: 20px;
  }
}

/* ── Hero ────────────────────────────────────────────────── */
.p2-hero { padding-block: 2rem 4rem; }
@scope (.p2-hero) {
  header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }
  header span {
    font-family: var(--fg-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
  }
  > div { margin-bottom: 22px; }
  h1 {
    font-family: var(--fg-mono);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.1;
    margin: 42px 0 28px;
  }
  footer {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 2rem;
  }
  footer a.p2-cta {
    font-family: var(--fg-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 13px 24px;
    background: var(--text);
    color: var(--bg);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: background 0.15s ease;
  }
  footer a.p2-cta:hover { background: var(--fg-accent); color: var(--bg); }
  footer > span {
    font-family: var(--fg-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
  }
}

/* ── Standalone components used inside hero ──────────────── */
.p2-glyph {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--fg-paper);
  display: grid;
  place-items: center;
  color: var(--text);
  flex-shrink: 0;
  border-radius: 6px;
}
.p2-chip {
  font-family: var(--fg-mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 13px;
}

/* ── Promise bar ─────────────────────────────────────────── */
section[aria-label="Our commitments"] {
  background: var(--bg-subtle);
  border-top: 1px solid var(--bg);
  border-bottom: 1px solid var(--bg);
}
@scope (section[aria-label="Our commitments"]) {
  ul {
    margin-inline: auto;
    padding-inline: var(--page-px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    list-style: none;
    padding-block: 0;
    margin-block: 0;
  }
  li {
    padding: 40px 14px;
    text-align: center;
    border-right: 2px solid var(--bg);
  }
  li:last-child { border-right: none; }
  li > div:first-child {
    font-family: var(--fg-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 3px;
  }
  li > div:last-child {
    font-family: var(--fg-mono);
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 0.04em;
  }
}
@media (max-width: 600px) {
  section[aria-label="Our commitments"] ul { grid-template-columns: 1fr 1fr; }
  section[aria-label="Our commitments"] li:nth-child(-n+2) { border-bottom: 2px solid var(--bg); }
  section[aria-label="Our commitments"] li:nth-child(even) { border-right: none; }
}

/* ── How it works — vertical numbered list ───────────────── */
.p2-step {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
}
.p2-step:first-of-type { border-top: none; padding-top: 0; }
@scope (.p2-step) {
  div:first-child {
    font-family: var(--fg-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--fg-warm);
    line-height: 1;
    letter-spacing: -0.04em;
    width: 72px;
    flex-shrink: 0;
    text-align: right;
  }
  div:last-child { flex: 1; padding-top: 6px; }
  p {
    font-family: var(--fg-mono);
    font-size: 13px;
    line-height: 1.65;
    color: var(--text);
    margin: 0;
  }
}
@media (max-width: 480px) {
  .p2-step { flex-direction: column; gap: 2px; }
  .p2-step div:first-child { font-size: 1.8rem; width: auto; text-align: left; }
  .p2-step div:last-child { padding-top: 0; }
}

/* ── Occasions / use cases ───────────────────────────────── */
.p2-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 24px;
  list-style: none;
  padding: 0;
}
@scope (.p2-tags) {
  li {
    font-family: var(--fg-mono);
    font-size: 11px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 14px;
  }
}
.p2-scenarios { display: flex; flex-direction: column; list-style: none; padding: 0; margin: 0; }
@scope (.p2-scenarios) {
  li {
    font-family: var(--fg-mono);
    font-size: 13px;
    color: var(--text);
    line-height: 1.6;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: baseline;
    gap: 12px;
  }
  li:last-child { border-bottom: none; }
  li > span:first-child { color: var(--fg-warm); flex-shrink: 0; font-size: 11px; }
}

/* ── Pricing ─────────────────────────────────────────────── */
.p2-pricing-well {
  border: 1px solid var(--border);
  padding: 24px 28px;
  background: var(--bg-subtle);
}
@scope (.p2-pricing-well) {
  p {
    font-family: var(--fg-mono);
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
    margin: 0;
  }
}

/* ── End CTA ─────────────────────────────────────────────── */
.p2-launch {
  padding-block: 80px 100px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@scope (.p2-launch) {
  > span {
    font-family: var(--fg-mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
  }
  h2 {
    font-family: var(--fg-mono);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.12;
    color: var(--text);
    margin: 0 0 16px;
    max-width: 560px;
  }
  > p {
    font-family: var(--fg-mono);
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 460px;
    margin: 0 0 40px;
  }
  a.p2-launch-btn {
    font-family: var(--fg-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 14px 28px;
    background: var(--text);
    color: var(--bg);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: background 0.15s ease;
    margin-bottom: 20px;
  }
  a.p2-launch-btn:hover { background: var(--fg-accent); color: var(--bg); }
  .p2-launch-note {
    font-family: var(--fg-mono);
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.04em;
    margin: 0;
  }
}

/* ============================================================
 Brand business card — slide-down "about" overlay sourced from
 the brand_info storage table (see app/views/programs/_brand_card.html.erb)
 ============================================================ */

/* ── Trigger (in .app-header) ────────────────────────────── */
.bcard-trigger {
  margin-left: auto;
  font-family: var(--fg-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.07em;
  color: var(--n-300);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  padding: 5px 14px 5px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.bcard-trigger:hover {
  color: var(--n-50);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.25);
}
.bcard-trigger[aria-expanded="true"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(200, 150, 106, 0.7);
}
@media (max-width: 480px) {
  .bcard-trigger > span { display: none; }
  .bcard-trigger { padding: 5px 10px; }
}

/* ── Backdrop ────────────────────────────────────────────── */
#bcard-backdrop {
  position: fixed;
  inset: 0;
  top: var(--header-h);
  z-index: 94;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#bcard-backdrop[data-open] {
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel ───────────────────────────────────────────────── */
.brand-card {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 95;
  background: var(--n-900);
  border-top: 3px solid var(--fg-warm);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  transform: translateY(-110%);
  pointer-events: none;
  visibility: hidden;
  transition:
    transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0.34s;
}
.brand-card[data-open] {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition:
    transform 0.34s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s linear 0s;
}

@scope (.brand-card) {
  /* inner grid */
  > div {
    max-width: 820px;
    margin-inline: auto;
    padding: var(--sp-5) var(--page-px) var(--sp-4);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 var(--sp-5);
  }

  /* lead: logo placeholder + eyebrow + name + tagline */
  > div > div:first-child {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: 52px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: var(--sp-4);
    row-gap: 1px;
    align-items: start;
    padding-bottom: var(--sp-4);
  }

  /* logo placeholder — spans all three text rows, centered */
  > div > div:first-child > div {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 52px;
    height: 58px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-family: var(--fg-mono);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--fg-warm);
    letter-spacing: -0.03em;
    align-self: center;
    user-select: none;
  }

  /* eyebrow */
  > div > div:first-child > p:first-of-type {
    grid-column: 2;
    grid-row: 1;
    font-family: var(--fg-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-weight: 700;
    color: var(--fg-warm);
    margin: 0;
    padding-top: 4px;
  }

  /* brand name */
  > div > div:first-child > strong {
    grid-column: 2;
    grid-row: 2;
    font-family: var(--fg-mono);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: -0.03em;
    display: block;
    line-height: 1.05;
    margin: 4px 0 2px;
  }

  /* tagline — only rendered when present, so strong + p is safe */
  > div > div:first-child > strong + p {
    grid-column: 2;
    grid-row: 3;
    font-family: var(--fg-mono);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.42);
    line-height: 1.5;
    margin: 0;
  }

  /* vitals row — one cell per present BrandInfo field */
  dl {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-6);
    margin: 0;
    padding: var(--sp-4) 0 var(--sp-3);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
  }

  dl > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  dt {
    font-family: var(--fg-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 700;
    white-space: nowrap;
  }

  dd {
    font-family: var(--fg-mono);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
    margin: 0;
    line-height: 1.45;
  }

  dd a {
    color: var(--fg-warm);
    text-decoration: none;
  }
  dd a:hover { color: #fff; }

  /* close button */
  > div > button {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    width: 30px;
    height: 30px;
    margin-top: 3px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.38);
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  > div > button:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.9);
  }
}
