/*-- -------------------------- -->
<---   How It Works — page CSS   -->
<--- -------------------------- -*/

/* Page-local tokens. These build on the global :root variables
   (--primary, --headerColor, etc.) so nothing here is duplicated. */
#hero-hiw,
#hiw-body {
  --hiwMaxWidth: 46rem;      /* comfortable reading measure for the article */
  --hiwBorder: #e7e5ec;
  --hiwSurface: #f7f6f9;
  --hiwSurfaceMuted: #f1eff4;
}

/*-- -------------------------- -->
<---            Hero            -->
<--- -------------------------- -*/

/* Mobile - 360px */
@media only screen and (min-width: 0rem) {
  #hero-hiw {
    /* Top padding clears a fixed/sticky navbar so it never overlaps the
       title. The clamp min (~7rem) assumes a nav up to ~5rem tall plus
       breathing room — bump the min if your nav is taller. */
    padding: clamp(7rem, 12vw, 10rem) 1rem clamp(3rem, 6vw, 4.5rem);
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, var(--hiwSurface) 0%, #fff 100%);
    border-bottom: 1px solid var(--hiwBorder);
  }
  #hero-hiw:before {
    /* faint brand wash behind the hero */
    content: '';
    width: 100%;
    height: 100%;
    background: var(--primary);
    opacity: 0.04;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    pointer-events: none;
  }
  #hero-hiw .cs-container {
    width: 100%;
    max-width: var(--hiwMaxWidth);
    margin: auto;
  }
  #hero-hiw .cs-content {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }
  #hero-hiw .cs-title {
    /* slightly larger than the global title for a hero feel */
    font-size: clamp(2rem, 6vw, 3.25rem);
    max-width: 20ch;
    margin-bottom: 1.25rem;
  }
  #hero-hiw .cs-text {
    margin-bottom: 2rem;
  }
  #hero-hiw .cs-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
  }
  #hero-hiw .cs-button-solid {
    font-size: 1rem;
    font-weight: 700;
    line-height: clamp(2.875rem, 5.5vw, 3.25rem);
    text-align: center;
    text-decoration: none;
    min-width: 13rem;
    margin: 0;
    box-sizing: border-box;
    padding: 0 1.5rem;
    background-color: var(--primary);
    color: #fff;
    border-radius: 0.375rem;
    display: inline-block;
    position: relative;
    z-index: 1;
    overflow: hidden;
  }
  #hero-hiw .cs-button-solid:before {
    content: "";
    width: 0%;
    height: 100%;
    background: #000;
    opacity: 1;
    border-radius: 0.375rem;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    transition: width 0.3s;
  }
  #hero-hiw .cs-button-solid:hover:before {
    width: 100%;
  }
  #hero-hiw .cs-button-transparent {
    font-size: 1rem;
    font-weight: 700;
    line-height: clamp(2.875rem, 5.5vw, 3.25rem);
    text-decoration: none;
    color: var(--headerColor);
    padding: 0 0.25rem;
    display: inline-block;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s, color 0.3s;
  }
  #hero-hiw .cs-button-transparent:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
  }
}

/*-- -------------------------- -->
<---        Article Body        -->
<--- -------------------------- -*/

/* Mobile - 360px */
@media only screen and (min-width: 0rem) {
  #hiw-body {
    padding: clamp(3rem, 7vw, 4.5rem) 1rem clamp(4rem, 9vw, 6.25rem);
    position: relative;
    z-index: 1;
  }
  #hiw-body .cs-container {
    width: 100%;
    max-width: var(--hiwMaxWidth);
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
  }

  /* ---- Table of contents (jump nav) ---- */
  #hiw-body .hiw-toc {
    background: var(--hiwSurface);
    border: 1px solid var(--hiwBorder);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
  }
  #hiw-body .hiw-toc__label {
    display: block;
    font-size: var(--topperFontSize);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
  }
  #hiw-body .hiw-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem 1.5rem;
  }
  #hiw-body .hiw-toc__list a {
    color: var(--bodyTextColor);
    text-decoration: none;
    font-size: 0.9375rem;
    line-height: 1.4;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
  }
  #hiw-body .hiw-toc__list a:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
  }

  /* ---- Prose column ---- */
  #hiw-body .hiw-prose {
    color: var(--bodyTextColor);
    font-size: 1.0625rem;
    line-height: 1.7;
  }
  #hiw-body .hiw-prose > * {
    max-width: 100%;
  }

  /* Anchored headings get scroll-margin so a sticky navbar doesn't cover
     them when jumped to from the TOC. */
  #hiw-body h2,
  #hiw-body h3 {
    color: var(--headerColor);
    scroll-margin-top: 6rem;
  }
  #hiw-body h2 {
    font-size: clamp(1.5rem, 3.4vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
    margin: 3rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--hiwBorder);
  }
  #hiw-body h2:first-of-type {
    border-top: none;
    padding-top: 0;
  }
  #hiw-body h3 {
    font-size: 1.1875rem;
    font-weight: 700;
    margin: 1.75rem 0 0.5rem;
  }
  #hiw-body p {
    margin: 0 0 1.25rem;
  }
  #hiw-body a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    transition: opacity 0.2s;
  }
  #hiw-body a:hover {
    opacity: 0.7;
  }
  #hiw-body ul,
  #hiw-body ol {
    margin: 0 0 1.5rem;
    padding-left: 1.25rem;
  }
  #hiw-body li {
    margin-bottom: 0.5rem;
  }
  #hiw-body strong {
    color: var(--headerColor);
  }

  /* Lead paragraph */
  #hiw-body .hiw-lead {
    font-size: 1.1875rem;
    line-height: 1.65;
    color: var(--headerColor);
  }

  /* Checklist (opening bullets) */
  #hiw-body .hiw-checklist {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  #hiw-body .hiw-checklist li {
    position: relative;
    padding-left: 1.75rem;
  }
  #hiw-body .hiw-checklist li:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 0.75rem;
    height: 0.375rem;
    border-left: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(-45deg);
  }

  /* ---- Figure / image placeholder ---- */
  #hiw-body .hiw-figure {
    margin: 2rem 0;
  }
  #hiw-body .hiw-figure__placeholder {
    border: 2px dashed var(--hiwBorder);
    border-radius: 0.75rem;
    background: var(--hiwSurfaceMuted);
    color: var(--bodyTextColor);
    font-size: 0.9375rem;
    text-align: center;
    padding: 3rem 1.5rem;
    line-height: 1.5;
  }
  #hiw-body .hiw-figure figcaption {
    font-size: 0.875rem;
    color: var(--bodyTextColor);
    text-align: center;
    margin-top: 0.75rem;
    opacity: 0.8;
  }

  /* ---- Callouts ---- */
  #hiw-body .hiw-callout {
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid var(--primary);
    background: var(--hiwSurface);
  }
  #hiw-body .hiw-callout h3 {
    margin-top: 0;
  }
  #hiw-body .hiw-callout p:last-child {
    margin-bottom: 0;
  }
  #hiw-body .hiw-callout__note {
    font-size: 0.9375rem;
    color: var(--bodyTextColor);
  }
  #hiw-body .hiw-callout--info {
    border-left-color: var(--primary);
  }
  #hiw-body .hiw-callout--success {
    border-left-color: #2e9e5b;
    background: #eef7f1;
  }
  #hiw-body .hiw-callout--muted {
    border-left-color: #b8b5c2;
    background: var(--hiwSurfaceMuted);
  }

  /* ---- Glossary ---- */
  #hiw-body .hiw-glossary {
    margin: 0 0 1.5rem;
  }
  #hiw-body .hiw-glossary dt {
    font-weight: 800;
    color: var(--headerColor);
    margin-top: 1.25rem;
  }
  #hiw-body .hiw-glossary dt:first-child {
    margin-top: 0;
  }
  #hiw-body .hiw-glossary dd {
    margin: 0.25rem 0 0;
    padding-left: 1rem;
    border-left: 2px solid var(--hiwBorder);
  }

  /* ---- Steps ---- */
  #hiw-body .hiw-steps {
    list-style: none;
    counter-reset: none;
    padding: 0;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  #hiw-body .hiw-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 0;
  }
  #hiw-body .hiw-step__num {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 1.0625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.25rem 0.75rem rgba(255, 106, 62, 0.3);
  }
  #hiw-body .hiw-step__body h3 {
    margin: 0.25rem 0 0.5rem;
  }
  #hiw-body .hiw-step__body p:last-child {
    margin-bottom: 0;
  }

  /* Tip / streak highlight inside steps */
  #hiw-body .hiw-tip {
    background: var(--hiwSurfaceMuted);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    margin-top: 0.75rem !important;
  }

  /* ---- Three Pillars ---- */
  #hiw-body .hiw-pillars {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 2rem 0;
  }
  #hiw-body .hiw-pillar {
    background: var(--hiwSurface);
    border: 1px solid var(--hiwBorder);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
  }
  #hiw-body .hiw-pillar__value {
    display: block;
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
  }
  #hiw-body .hiw-pillar__label {
    display: block;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--headerColor);
    margin: 0.375rem 0 0.75rem;
  }
  #hiw-body .hiw-pillar p {
    font-size: 0.9375rem;
    margin: 0;
  }

  /* ---- FAQ ---- */
  #hiw-body .hiw-faq {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
  }
  #hiw-body .hiw-faq__item {
    border: 1px solid var(--hiwBorder);
    border-radius: 0.75rem;
    background: #fff;
    overflow: hidden;
  }
  #hiw-body .hiw-faq__item summary {
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--headerColor);
    list-style: none;
    position: relative;
    padding-right: 3rem;
  }
  #hiw-body .hiw-faq__item summary::-webkit-details-marker {
    display: none;
  }
  #hiw-body .hiw-faq__item summary:after {
    content: '+';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--primary);
    transition: transform 0.2s;
  }
  #hiw-body .hiw-faq__item[open] summary:after {
    content: '\2212'; /* minus */
  }
  #hiw-body .hiw-faq__item p {
    padding: 0 1.25rem 1.25rem;
    margin: 0;
  }

  /* ---- Final CTA ---- */
  #hiw-body .hiw-cta {
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primaryLight) 100%);
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    margin-top: 3rem;
    color: #fff;
  }
  #hiw-body .hiw-cta h2 {
    color: #fff;
    border: none;
    padding: 0;
    margin: 0 0 0.5rem;
  }
  #hiw-body .hiw-cta p {
    color: #fff;
    opacity: 0.95;
    margin-bottom: 1.5rem;
  }
  #hiw-body .hiw-cta .cs-button-solid {
    font-size: 1rem;
    font-weight: 700;
    line-height: 3.25rem;
    text-decoration: none;
    min-width: 13rem;
    padding: 0 1.5rem;
    background-color: #fff;
    color: var(--headerColor);
    border-radius: 0.375rem;
    display: inline-block;
    transition: transform 0.2s;
  }
  #hiw-body .hiw-cta .cs-button-solid:hover {
    transform: translateY(-2px);
  }
}

/* Tablet - 768px */
@media only screen and (min-width: 48rem) {
  #hiw-body .hiw-toc__list {
    grid-template-columns: 1fr 1fr;
  }
  #hiw-body .hiw-pillars {
    grid-template-columns: repeat(3, 1fr);
  }
}

/*-- -------------------------- -->
<---          Dark Mode         -->
<--- -------------------------- -*/
@media only screen and (min-width: 0rem) {
  body.dark-mode #hero-hiw {
    background: linear-gradient(180deg, #16151a 0%, #0e0d11 100%);
    border-bottom-color: #2a2830;
  }
  body.dark-mode #hero-hiw .cs-title {
    color: var(--bodyTextColorWhite);
  }
  body.dark-mode #hero-hiw .cs-text {
    color: var(--bodyTextColorWhite);
    opacity: 0.85;
  }
  body.dark-mode #hero-hiw .cs-button-transparent {
    color: var(--bodyTextColorWhite);
  }

  body.dark-mode #hiw-body {
    --hiwBorder: #2a2830;
    --hiwSurface: #16151a;
    --hiwSurfaceMuted: #1d1c22;
  }
  body.dark-mode #hiw-body .hiw-prose,
  body.dark-mode #hiw-body .hiw-toc__list a,
  body.dark-mode #hiw-body p,
  body.dark-mode #hiw-body li,
  body.dark-mode #hiw-body .hiw-glossary dd {
    color: var(--bodyTextColorWhite);
    opacity: 0.85;
  }
  body.dark-mode #hiw-body h2,
  body.dark-mode #hiw-body h3,
  body.dark-mode #hiw-body strong,
  body.dark-mode #hiw-body .hiw-lead,
  body.dark-mode #hiw-body .hiw-glossary dt,
  body.dark-mode #hiw-body .hiw-faq__item summary {
    color: var(--bodyTextColorWhite);
    opacity: 1;
  }
  body.dark-mode #hiw-body .hiw-faq__item {
    background: var(--hiwSurface);
  }
  body.dark-mode #hiw-body .hiw-callout--success {
    background: #12241a;
  }
  body.dark-mode #hiw-body .hiw-cta h2,
  body.dark-mode #hiw-body .hiw-cta p {
    color: #fff;
    opacity: 1;
  }
  body.dark-mode #hiw-body .hiw-cta .cs-button-solid {
    color: var(--headerColor);
  }
}
#hiw-body .hiw-figure__img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--hiwBorder);
  display: block;
}

body.dark-mode #hiw-body .hiw-figure figcaption {
  color: var(--bodyTextColorWhite);
}

body.dark-mode #hiw-body .hiw-pillar__label {
  color: var(--primaryLight);
}