/* Harryhandel — themed to patrickjanson.no Launchpad
   Tokens mirrored from hub style.css + Bitcoin research app pattern */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap");

:root {
  /* Exact Launchpad tokens */
  --bg: #06070a;
  --text: #f0f2f6;
  --text-muted: #8d96a8;
  --radius: 14px;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Outfit", system-ui, sans-serif;

  --ember: #ff6a28;
  --forge: #f59e0b;
  --ice: #3b9eff;
  --steel: #34d399;
  --bloom: #f472b6;

  /* Surfaces (hub glass) */
  --bg-elevated: rgba(255, 255, 255, 0.03);
  --bg-soft: rgba(255, 255, 255, 0.025);
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.07);
  --border-soft: rgba(255, 255, 255, 0.05);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-line: rgba(255, 255, 255, 0.06);

  /* Harryhandel hub accent = steel (mark / Research) */
  --accent: var(--steel);
  --accent-hot: var(--ember);
  --link: #7ec8ff;
  --link-hover: #b3e0ff;
  --eyebrow: rgba(255, 184, 138, 0.85);

  --warn-bg: rgba(245, 158, 11, 0.12);
  --warn-border: rgba(245, 158, 11, 0.45);
  --warn-text: #ffe6a8;
  --ok-bg: rgba(52, 211, 153, 0.1);
  --ok-border: rgba(52, 211, 153, 0.35);

  --font-mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
  --max: 72rem;
  --content: 48rem;
  --header-h: 64px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 1.02rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* Ambient vignette — Launchpad family */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% -15%, rgba(255, 106, 40, 0.1), transparent 55%),
    radial-gradient(ellipse 42% 32% at 88% 12%, rgba(52, 211, 153, 0.07), transparent 50%),
    radial-gradient(ellipse 40% 30% at 8% 70%, rgba(59, 158, 255, 0.05), transparent 50%),
    linear-gradient(180deg, transparent 60%, rgba(6, 7, 10, 0.85) 100%);
}

#hub-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.45;
}

::selection {
  background: rgba(52, 211, 153, 0.35);
  color: #fff;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
a:hover {
  color: var(--link-hover);
}
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--steel);
  color: #0a1a12;
  padding: 0.5rem 1rem;
  z-index: 1000;
  font-weight: 600;
  border-radius: 8px;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 7, 10, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-line);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: linear-gradient(145deg, #6ee7b7, var(--steel) 50%, #10b981);
  color: #062016;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-display);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.28);
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}
.brand-text small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.hub-link {
  display: none;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--eyebrow);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.hub-link:hover {
  color: #ffb88a;
  background: rgba(255, 106, 40, 0.08);
  border-color: rgba(255, 106, 40, 0.2);
  text-decoration: none;
}

.header-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.7rem;
  align-items: center;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
  border-bottom-color: var(--steel);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
}

.progress-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--ember), var(--steel));
  transition: width 0.15s ease;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.35);
}

/* —— Main layout —— */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem 0 3rem;
  align-items: start;
  flex: 1;
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.layout--home {
  grid-template-columns: 1fr;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--radius) + 2px);
  padding: 1rem 0.9rem;
  max-height: calc(100vh - var(--header-h) - 1.75rem);
  overflow: auto;
}
.toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  border-bottom: 1px solid var(--border-line);
  padding-bottom: 0.45rem;
}
.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}
.toc-list li {
  margin: 0;
}
.toc-list a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.32rem 0.4rem;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.toc-list a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.toc-list a.is-active {
  color: var(--steel);
  font-weight: 600;
  border-left-color: var(--steel);
  background: rgba(52, 211, 153, 0.06);
}
.toc-list .toc-num {
  color: rgba(255, 255, 255, 0.28);
  font-variant-numeric: tabular-nums;
  margin-right: 0.35rem;
  font-size: 0.75rem;
}
.toc-meta {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-line);
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.content {
  min-width: 0;
  max-width: calc(var(--content) + 6rem);
  animation: hub-rise 0.5s var(--ease-out) both;
}

/* —— Home hero —— */
.hero {
  margin-bottom: 1.5rem;
  text-align: left;
}
.hub-eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--eyebrow);
}
.hero h1 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: #fff;
}
.hero .sub {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  max-width: 40rem;
  font-size: 1.02rem;
  line-height: 1.55;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge--steel {
  color: var(--steel);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}
.badge--ember {
  color: #ffb88a;
  border-color: rgba(255, 106, 40, 0.3);
  background: rgba(255, 106, 40, 0.08);
}

.disclosure {
  background: rgba(52, 211, 153, 0.06);
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  color: #c8e6d8;
  line-height: 1.5;
}
.disclosure strong {
  color: #e8fff4;
}

/* Stats */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.stat {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 0.9rem 0.95rem 1rem;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  bottom: 0.7rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--steel);
  opacity: 0.85;
}
.stat:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-1px);
}
.stat .label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat .value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #fff;
}
.stat .hint {
  color: var(--text-muted);
  font-size: 0.74rem;
  margin-top: 0.2rem;
  line-height: 1.35;
}

.callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--steel);
  padding: 0.95rem 1.05rem;
  border-radius: 0 12px 12px 0;
  margin: 0.5rem 0 1.5rem;
  font-size: 0.95rem;
  color: #d5deea;
}
.callout strong {
  color: #fff;
}

h2.section {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  margin: 2rem 0 0.75rem;
  border-bottom: 1px solid var(--border-line);
  padding-bottom: 0.45rem;
}

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}
.chapter-list a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
  padding-left: 1rem;
}
.chapter-list a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0.65rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--steel);
  opacity: 0.7;
}
.chapter-list a:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}
.chapter-list .num {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 1.4rem;
}
.chapter-list .arrow {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.28);
  transition: transform 0.2s ease, color 0.2s ease;
}
.chapter-list a:hover .arrow {
  color: var(--steel);
  transform: translateX(2px);
}

.three-accounts {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.three-accounts li {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.three-accounts strong {
  color: #fff;
  font-weight: 600;
}

/* —— Article / markdown —— */
.article {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.6rem 1.45rem 2rem;
}
.article h1 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #fff;
}
.article h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-top: 1.85rem;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border-line);
  padding-bottom: 0.35rem;
  color: #fff;
}
.article h3 {
  font-size: 1.02rem;
  margin-top: 1.4rem;
  color: #d0d8e6;
  font-weight: 600;
}
.article p,
.article li {
  color: #c8d0dc;
}
.article strong {
  color: #fff;
}
.article a {
  color: var(--link);
}
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
}
.article th,
.article td {
  border-bottom: 1px solid var(--border-line);
  padding: 0.5rem 0.5rem;
  text-align: left;
  white-space: nowrap;
}
.article th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  font-size: 0.86em;
  color: #c5f0dc;
}
.article pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem;
  overflow-x: auto;
}
.article pre code {
  background: none;
  padding: 0;
  color: #d5deea;
}
.article blockquote {
  margin: 1rem 0;
  padding: 0.55rem 0 0.55rem 1rem;
  border-left: 3px solid var(--forge);
  color: var(--text-muted);
  background: var(--warn-bg);
  border-radius: 0 8px 8px 0;
}
.article hr {
  border: none;
  border-top: 1px solid var(--border-line);
  margin: 1.6rem 0;
}
.article ul,
.article ol {
  padding-left: 1.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.back-link:hover {
  color: var(--steel);
  text-decoration: none;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.chapter-nav a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  max-width: 48%;
}
.chapter-nav a:hover {
  color: #fff;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.loading,
.error {
  color: var(--text-muted);
  padding: 2.5rem 0;
  text-align: center;
}
.error {
  color: #f5a0b8;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-line);
  padding: 1.35rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: auto;
}
.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  text-align: center;
}
.site-footer a {
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.site-footer a:hover {
  color: rgba(255, 255, 255, 0.65);
}
.site-footer .footer-meta {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.28);
}

@keyframes hub-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .content {
    animation: none;
  }
  .stat:hover,
  .chapter-list a:hover {
    transform: none;
  }
}

/* —— Responsive —— */
@media (min-width: 860px) {
  .hub-link {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .toc {
    position: static;
    max-height: none;
    display: none;
  }
  .toc.is-open-mobile {
    display: block;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: rgba(6, 7, 10, 0.96);
    border-bottom: 1px solid var(--border-line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1rem;
    gap: 0.15rem;
  }
  .site-nav.is-open {
    display: flex;
  }
  .site-nav a {
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid var(--border-line);
  }
  .site-header {
    position: sticky;
  }
  .header-inner {
    position: relative;
  }
  .article {
    padding: 1.15rem 1rem 1.5rem;
  }
  .chapter-nav a {
    max-width: 100%;
    flex: 1 1 100%;
  }
  .brand-text small {
    display: none;
  }
}
