/* =========================================================
   APEX STARTER GUIDE V2 — PREMIUM EDITION
   MASTER STYLESHEET — BUILD 1
   ========================================================= */

:root {
  --asg-navy: #12324a;
  --asg-navy-dark: #0b2436;
  --asg-blue: #2f6f8f;
  --asg-green: #2f7d67;
  --asg-green-soft: #eaf5f1;
  --asg-blue-soft: #eef6fa;
  --asg-gold-soft: #f7f1df;
  --asg-red-soft: #fff0f0;
  --asg-text: #23313b;
  --asg-muted: #66737d;
  --asg-border: #d8e1e7;
  --asg-paper: #ffffff;
  --asg-page-bg: #edf2f5;
  --asg-shadow: 0 18px 45px rgba(18, 50, 74, 0.12);
  --asg-radius: 18px;
  --asg-max-width: 860px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--asg-page-bg);
  color: var(--asg-text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--asg-blue);
}

a:hover,
a:focus {
  color: var(--asg-green);
}

.asg-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 12px 18px;
  background: #ffffff;
  color: #000000;
}

.asg-skip-link:focus {
  left: 12px;
  top: 12px;
}

.asg-publication {
  width: 100%;
}

.asg-page {
  position: relative;
  width: min(calc(100% - 32px), var(--asg-max-width));
  min-height: 1120px;
  margin: 34px auto;
  padding: 72px 76px 86px;
  background: var(--asg-paper);
  border-radius: 10px;
  box-shadow: var(--asg-shadow);
  overflow: hidden;
}

.asg-page h1,
.asg-page h2,
.asg-page h3 {
  color: var(--asg-navy);
  line-height: 1.18;
}

.asg-page h1 {
  margin: 0;
  font-size: clamp(3rem, 7vw, 5.8rem);
  letter-spacing: -0.04em;
}

.asg-page h2 {
  margin: 0 0 24px;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: -0.025em;
}

.asg-page h3 {
  margin: 30px 0 12px;
  font-size: 1.35rem;
}

.asg-page p {
  margin: 0 0 20px;
}

.asg-lead {
  color: var(--asg-navy);
  font-size: 1.3rem;
  line-height: 1.55;
}

.asg-eyebrow,
.asg-kicker,
.asg-callout-label {
  margin: 0 0 12px;
  color: var(--asg-green);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.asg-section-heading,
.asg-chapter-header {
  margin-bottom: 34px;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--asg-green);
}

.asg-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 1120px;
  color: #ffffff;
  background:
    radial-gradient(circle at 82% 18%, rgba(66, 156, 130, 0.33), transparent 28%),
    linear-gradient(145deg, var(--asg-navy-dark), var(--asg-navy) 55%, #204b64);
}

.asg-cover::after {
  content: "";
  position: absolute;
  right: -130px;
  bottom: 90px;
  width: 420px;
  height: 420px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.asg-cover-mark {
  align-self: flex-end;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 800;
  letter-spacing: 0.28em;
}

.asg-cover-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.asg-cover .asg-kicker,
.asg-cover h1,
.asg-cover .asg-cover-tagline,
.asg-cover .asg-cover-subtitle,
.asg-cover .asg-edition {
  color: #ffffff;
}

.asg-cover-tagline {
  margin-top: 22px;
  font-size: 1.65rem;
  font-weight: 700;
}

.asg-cover-subtitle {
  max-width: 640px;
  font-size: 1.2rem;
  line-height: 1.55;
}

.asg-cover-rule {
  width: 120px;
  height: 5px;
  margin: 34px 0 24px;
  background: #65b99f;
  border-radius: 999px;
}

.asg-edition {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.asg-cover-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
}

.asg-info-grid,
.asg-card-grid,
.asg-number-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 32px 0;
}

.asg-info-card,
.asg-topic-card,
.asg-number-card,
.asg-panel,
.asg-learning-box,
.asg-check-panel,
.asg-writing-box {
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--asg-border);
  border-radius: var(--asg-radius);
}

.asg-info-card h3,
.asg-topic-card h3,
.asg-number-card h3,
.asg-panel h3 {
  margin-top: 0;
}

.asg-callout {
  margin: 30px 0;
  padding: 24px 26px;
  border-left: 6px solid var(--asg-blue);
  border-radius: 0 var(--asg-radius) var(--asg-radius) 0;
}

.asg-callout p:last-child {
  margin-bottom: 0;
}

.asg-callout-note {
  background: var(--asg-blue-soft);
}

.asg-callout-key {
  background: var(--asg-green-soft);
  border-left-color: var(--asg-green);
}

.asg-callout-tip {
  background: var(--asg-gold-soft);
  border-left-color: #b58a24;
}

.asg-callout-warning {
  background: var(--asg-red-soft);
  border-left-color: #b73d3d;
}

.asg-pull-quote {
  margin: 40px 0;
  padding: 24px 0 24px 28px;
  color: var(--asg-navy);
  border-left: 5px solid var(--asg-green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  line-height: 1.45;
}

.asg-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 30px 0;
}

.asg-number-card {
  position: relative;
  padding-top: 60px;
}

.asg-number {
  position: absolute;
  top: 18px;
  left: 22px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  background: var(--asg-green);
  border-radius: 50%;
  font-weight: 700;
}

.asg-pathway {
  margin-top: 32px;
}

.asg-pathway-step {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 20px 22px;
  background: #ffffff;
  border: 1px solid var(--asg-border);
  border-radius: var(--asg-radius);
}

.asg-pathway-step > span {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: #ffffff;
  background: var(--asg-navy);
  border-radius: 50%;
  font-weight: 700;
}

.asg-pathway-step h3 {
  margin: 0 0 6px;
}

.asg-pathway-step p {
  margin: 0;
}

.asg-pathway-arrow {
  padding: 6px 0;
  color: var(--asg-green);
  text-align: center;
  font-size: 1.7rem;
  font-weight: 700;
}

.asg-toc-list {
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.asg-toc-list li + li {
  margin-top: 12px;
}

.asg-toc-list a {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  color: var(--asg-text);
  text-decoration: none;
  background: #ffffff;
  border: 1px solid var(--asg-border);
  border-radius: 14px;
}

.asg-toc-list a:hover,
.asg-toc-list a:focus {
  border-color: var(--asg-green);
  transform: translateY(-1px);
}

.asg-toc-list span {
  color: var(--asg-green);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.asg-part-opener {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #ffffff;
  background:
    linear-gradient(rgba(11, 36, 54, 0.84), rgba(18, 50, 74, 0.9)),
    linear-gradient(135deg, #1d5572, #12324a);
}

.asg-part-number {
  margin-bottom: 38px;
  color: #78c4ab;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.asg-part-opener h2,
.asg-part-opener .asg-eyebrow,
.asg-part-opener blockquote {
  color: #ffffff;
}

.asg-part-subtitle {
  color: #dbeaf1;
  font-size: 1.45rem;
  font-weight: 700;
}

.asg-part-opener blockquote {
  max-width: 640px;
  margin: 50px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1.5;
}

.asg-check-list,
.asg-checkbox-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.asg-check-list li,
.asg-checkbox-list li {
  position: relative;
  margin: 0 0 12px;
  padding-left: 30px;
}

.asg-check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--asg-green);
  font-weight: 800;
}

.asg-checkbox-list li {
  padding-left: 34px;
}

.asg-checkbox-list li span {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--asg-green);
  font-size: 1.25rem;
}

.asg-process {
  margin: 34px 0;
}

.asg-process-step {
  display: flex;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--asg-border);
}

.asg-process-step:last-child {
  border-bottom: 0;
}

.asg-step-number {
  display: grid;
  flex: 0 0 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: var(--asg-green);
  border-radius: 50%;
  font-weight: 800;
}

.asg-process-step h3 {
  margin: 0 0 8px;
}

.asg-process-step p {
  margin: 0;
}

.asg-card-grid {
  align-items: stretch;
}

.asg-topic-card {
  background: #f9fbfc;
}

.asg-writing-box {
  margin: 24px 0;
}

.asg-writing-lines {
  min-height: 120px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      var(--asg-border) 32px
    );
}

.asg-next-part {
  margin-top: 40px;
  color: var(--asg-navy);
  font-size: 1.15rem;
}

.asg-build-placeholder {
  width: min(calc(100% - 32px), var(--asg-max-width));
  margin: 22px auto;
  padding: 28px 32px;
  background: rgba(255, 255, 255, 0.74);
  border: 2px dashed var(--asg-border);
  border-radius: 14px;
}

.asg-build-placeholder h2 {
  margin: 0;
  color: var(--asg-muted);
  font-size: 1.35rem;
}

.asg-publication-footer {
  width: min(calc(100% - 32px), var(--asg-max-width));
  margin: 26px auto 60px;
  padding: 34px;
  color: #ffffff;
  text-align: center;
  background: var(--asg-navy);
  border-radius: 14px;
}

.asg-publication-footer p {
  margin: 6px 0;
}

@media (max-width: 760px) {
  body {
    font-size: 17px;
  }

  .asg-page {
    width: min(calc(100% - 18px), var(--asg-max-width));
    min-height: auto;
    margin: 14px auto;
    padding: 44px 24px 56px;
    border-radius: 8px;
  }

  .asg-cover {
    min-height: 860px;
  }

  .asg-info-grid,
  .asg-card-grid,
  .asg-number-grid,
  .asg-two-column {
    grid-template-columns: 1fr;
  }

  .asg-toc-list a {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .asg-cover-footer {
    flex-direction: column;
    gap: 8px;
  }

  .asg-pull-quote,
  .asg-part-opener blockquote {
    font-size: 1.3rem;
  }
}

@media print {
  @page {
    size: Letter;
    margin: 0;
  }

  html,
  body {
    background: #ffffff;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .asg-skip-link,
  .asg-build-placeholder {
    display: none !important;
  }

  .asg-page {
    width: 8.5in;
    min-height: 11in;
    margin: 0;
    padding: 0.65in 0.7in 0.75in;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .asg-cover {
    min-height: 11in;
  }

  .asg-publication-footer {
    display: none;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .asg-toc-list a {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .asg-info-card,
  .asg-topic-card,
  .asg-number-card,
  .asg-panel,
  .asg-learning-box,
  .asg-check-panel,
  .asg-writing-box,
  .asg-callout,
  .asg-process-step {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* =========================================================
   MODULAR LOADER AND FALLBACK
   ========================================================= */
.asg-loader-status,
.asg-load-error {
  width: min(calc(100% - 32px), var(--asg-max-width));
  margin: 34px auto;
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid var(--asg-border);
  border-radius: 14px;
  box-shadow: var(--asg-shadow);
}

.asg-loader-status {
  color: var(--asg-navy);
  font-weight: 700;
  text-align: center;
}

.asg-load-error {
  border-left: 6px solid #b73d3d;
}

.asg-load-error h1 {
  margin: 0 0 12px;
  color: var(--asg-navy);
  font-size: 1.7rem;
}

.asg-load-error p:last-child {
  margin-bottom: 0;
}

.asg-publication[hidden] {
  display: none !important;
}

.asg-section-loaded {
  display: contents;
}

@media print {
  .asg-loader-status,
  .asg-load-error {
    display: none !important;
  }
}
