/**
 * How-To section — elevated dark theme (v2)
 * Works with site-nav marketing pad + Imagine mesh background.
 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap");

:root {
  --ht-bg: #070b14;
  --ht-card: rgba(15, 23, 42, 0.92);
  --ht-card-solid: #0f172a;
  --ht-border: rgba(148, 163, 184, 0.2);
  --ht-border-strong: rgba(148, 163, 184, 0.32);
  --ht-blue: #3b82f6;
  --ht-blue-soft: rgba(59, 130, 246, 0.14);
  --ht-green: #4ade80;
  --ht-green-soft: rgba(74, 222, 128, 0.1);
  --ht-amber: #fbbf24;
  --ht-muted: #94a3b8;
  --ht-text: #e8eef8;
  --ht-link: #7dd3fc;
  --ht-radius: 14px;
  --ht-sticky-h: 4.25rem;
}

body.how-to-page {
  margin: 0;
  min-height: 100vh;
  background: var(--ht-bg);
  color: var(--ht-text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Content column — clear sticky CTA + mobile nav fab */
.ht-wrap {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.35rem 1.15rem calc(var(--ht-sticky-h) + 2.5rem);
  position: relative;
  z-index: 1;
}
.ht-wrap.wide {
  max-width: 56rem;
}

/* In-section subnav */
.ht-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.15rem;
  padding: 0.45rem;
  border-radius: 12px;
  border: 1px solid var(--ht-border);
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0.5rem;
  z-index: 40;
}
.ht-subnav a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ht-muted) !important;
  border: 1px solid transparent;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.ht-subnav a:hover,
.ht-subnav a:focus-visible {
  color: var(--ht-text) !important;
  background: var(--ht-blue-soft);
  border-color: rgba(59, 130, 246, 0.35);
  outline: none;
}
.ht-subnav a.is-active {
  color: #052e16 !important;
  background: linear-gradient(135deg, #15803d, #22c55e);
  border-color: transparent;
}

.ht-kicker {
  font-size: 0.8rem;
  color: var(--ht-muted);
  margin: 0 0 0.4rem;
}
.ht-kicker a {
  color: var(--ht-link);
}

.ht-wrap h1 {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(1.5rem, 3.2vw, 1.95rem);
  font-weight: 700;
  margin: 0.2rem 0 0.55rem;
  line-height: 1.22;
  letter-spacing: -0.02em;
}
.ht-wrap h2 {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  color: #c7d2fe;
  margin: 1.85rem 0 0.7rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  scroll-margin-top: 4rem;
}
.ht-wrap h2:first-of-type {
  border-top: 0;
  padding-top: 0.15rem;
  margin-top: 1.25rem;
}
.ht-wrap h3 {
  font-size: 0.98rem;
  font-weight: 650;
  margin: 1.15rem 0 0.4rem;
  color: #e2e8f0;
  scroll-margin-top: 4rem;
}

.ht-lede {
  color: var(--ht-muted);
  font-size: 0.96rem;
  max-width: 40rem;
  margin: 0 0 1.15rem;
  line-height: 1.55;
}

.ht-honest {
  border: 1px solid rgba(74, 222, 128, 0.35);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(59, 130, 246, 0.06));
  border-radius: var(--ht-radius);
  padding: 0.9rem 1.05rem;
  margin: 1rem 0 1.35rem;
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.ht-honest strong {
  color: #86efac;
}

.ht-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 1.5rem;
}
.ht-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius);
  padding: 1.05rem 1.1rem;
  background: var(--ht-card);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 7.5rem;
}
a.ht-card:hover,
a.ht-card:focus-visible {
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  outline: none;
}
.ht-card strong {
  display: block;
  color: #93c5fd;
  margin-bottom: 0.4rem;
  font-size: 1rem;
  font-family: "Space Grotesk", Inter, sans-serif;
}
.ht-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ht-muted);
  line-height: 1.45;
  flex: 1;
}
.ht-card .ht-meta {
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: #86efac;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.ht-step {
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius);
  padding: 0.95rem 1.05rem;
  margin: 0.6rem 0;
  background: var(--ht-card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}
.ht-step .n {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--ht-blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  font-weight: 800;
  font-size: 0.78rem;
  margin-right: 0.45rem;
  vertical-align: middle;
}
.ht-step pre {
  margin: 0.65rem 0 0;
}

.ht-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 0.95rem;
  border-radius: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
  margin: 0.25rem 0.35rem 0.25rem 0;
  transition: filter 0.12s ease, transform 0.12s ease;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.ht-btn:hover {
  filter: brightness(1.06);
}
.ht-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}
.ht-btn-primary {
  background: linear-gradient(135deg, #15803d, #22c55e);
  color: #052e16;
}
.ht-btn-mm {
  background: linear-gradient(135deg, #f6851b, #e2761b);
  color: #0b1220;
}
.ht-btn-ghost {
  border: 1px solid var(--ht-border-strong);
  color: var(--ht-text);
  background: rgba(15, 23, 42, 0.55);
}

.ht-muted {
  color: var(--ht-muted);
  font-size: 0.88rem;
}
.ht-wrap a:not(.ht-card):not(.ht-btn):not(.ht-subnav a) {
  color: var(--ht-link);
}
.ht-wrap a:not(.ht-card):not(.ht-btn):hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ht-wrap code {
  background: rgba(11, 18, 32, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  font-size: 0.84em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Code blocks + copy */
.ht-pre-wrap {
  position: relative;
  margin: 0.65rem 0 1rem;
}
.ht-wrap pre,
.ht-pre-wrap pre {
  background: #0a101c;
  border: 1px solid var(--ht-border);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  padding-top: 2.1rem;
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
  -webkit-overflow-scrolling: touch;
}
.ht-copy {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--ht-border-strong);
  background: rgba(15, 23, 42, 0.92);
  color: #93c5fd;
  cursor: pointer;
  font-family: inherit;
}
.ht-copy:hover {
  border-color: rgba(59, 130, 246, 0.5);
  color: #e0f2fe;
}
.ht-copy.copied {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.45);
}

/* Tables */
.ht-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0.75rem 0 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--ht-border);
  -webkit-overflow-scrolling: touch;
}
.ht-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0;
  min-width: 28rem;
}
.ht-wrap th,
.ht-wrap td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.ht-wrap th:last-child,
.ht-wrap td:last-child {
  border-right: 0;
}
.ht-wrap tr:last-child td {
  border-bottom: 0;
}
.ht-wrap th {
  background: rgba(30, 41, 59, 0.88);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ht-wrap tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.45);
}

.ht-toc {
  border: 1px solid var(--ht-border);
  border-radius: var(--ht-radius);
  padding: 0.85rem 1.05rem;
  background: rgba(15, 23, 42, 0.78);
  margin: 0 0 1.3rem;
  font-size: 0.88rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.ht-toc strong {
  color: #c7d2fe;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ht-toc ul {
  margin: 0.45rem 0 0;
  padding-left: 1.15rem;
}
.ht-toc li {
  margin: 0.28rem 0;
}

.ht-fail {
  border-left: 3px solid var(--ht-amber);
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0;
  background: rgba(251, 191, 36, 0.07);
  border-radius: 0 10px 10px 0;
  font-size: 0.88rem;
  line-height: 1.5;
}
.ht-fail strong {
  color: #fde68a;
}

.ht-nav-foot {
  margin-top: 2.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--ht-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.9rem;
}

.ht-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--ht-border);
  margin-right: 0.35rem;
  vertical-align: middle;
}
.ht-badge-deep {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.4);
  background: var(--ht-green-soft);
}
.ht-badge-std {
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
  background: var(--ht-blue-soft);
}
.ht-badge-outline {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

/* Bottom CTA — above content, below mobile menu (95) but clear of fab */
.ht-sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  align-items: center;
  padding: 0.7rem 1rem;
  padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(4.5rem, env(safe-area-inset-right)); /* clear nav fab */
  background: rgba(7, 11, 20, 0.94);
  border-top: 1px solid rgba(74, 222, 128, 0.32);
  box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* When site-nav adds left sidebar on desktop, shift sticky bar */
body.lvl-has-site-nav .ht-sticky {
  left: var(--lvl-sidebar-w, 0px);
}
@media (max-width: 960px) {
  body.lvl-has-site-nav .ht-sticky {
    left: 0;
  }
}

.ht-wrap ul,
.ht-wrap ol {
  padding-left: 1.25rem;
}
.ht-wrap li {
  margin: 0.3rem 0;
}

/* Selection */
.ht-wrap ::selection {
  background: rgba(59, 130, 246, 0.35);
  color: #fff;
}

@media (max-width: 560px) {
  .ht-card-grid {
    grid-template-columns: 1fr;
  }
  .ht-wrap pre,
  .ht-pre-wrap pre {
    font-size: 0.7rem;
  }
  .ht-subnav {
    top: 0.25rem;
    gap: 0.25rem;
  }
  .ht-subnav a {
    font-size: 0.74rem;
    padding: 0.3rem 0.55rem;
  }
  .ht-wrap table {
    min-width: 22rem;
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ht-card,
  .ht-btn,
  .ht-subnav a {
    transition: none;
  }
  a.ht-card:hover {
    transform: none;
  }
}
