/* ==========================================================================
   Become Borderless — shared styles
   One stylesheet for every page. Colors live in tokens below; dark mode
   swaps the tokens, never the components.
   ========================================================================== */

/* Archivo, self-hosted so no visitor data goes to Google Fonts. License: assets/fonts/OFL.txt */
@font-face {
  font-family: "Archivo";
  src: url("../assets/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  /* Brand */
  --orange: #F7931A;          /* Bitcoin orange: surfaces and accents only */
  --orange-text: #A84F00;     /* Orange that passes contrast as text on light bg (5.4:1) */
  --ink: #2A1A0C;             /* Espresso brown. Text on orange passes at 7.3:1 */

  /* Surfaces */
  --bg: #FDFBF8;
  --surface: #FFFFFF;
  --line: #EADFD2;
  --text: #2A1A0C;
  --text-muted: #6B5A4A;
  --link: var(--orange-text);
  --field-border: #9C8670;    /* 3:1 against white, so inputs are visible */
  --focus: #2A1A0C;

  /* Type */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2rem, 1.5rem + 2.4vw, 3.4rem);
  --step-4:  clamp(2.6rem, 1.6rem + 4.8vw, 5.6rem);

  /* Layout */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 1200px;
  --radius: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A130D;
    --surface: #241B13;
    --line: #3A2D21;
    --text: #F5EDE3;
    --text-muted: #B8A794;
    --link: var(--orange);
    --field-border: #7A6450;
    --focus: #F7931A;
    color-scheme: dark;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
}
img { display: block; max-width: 100%; height: auto; }
ul[role="list"] { list-style: none; padding: 0; }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
main { flex: 1; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Display type: the wide, heavy cut echoes the logo lettering ---------- */
.display {
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--orange);
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4rem;
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none;
  font-weight: 800; font-variation-settings: "wdth" 125;
  font-size: 1.05rem; letter-spacing: -0.01em;
}
.brand-mark {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--ink); color: var(--orange);
  font-size: 1.15rem; line-height: 1;
}
.nav-toggle {
  display: none;
  background: none; border: 2px solid var(--ink); border-radius: 8px;
  color: var(--ink); font: inherit; font-weight: 700;
  padding: 0.35rem 0.8rem; cursor: pointer;
}
.site-nav ul { display: flex; gap: 0.25rem; list-style: none; padding: 0; }
.site-nav a {
  display: block; padding: 0.45rem 0.85rem; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.site-nav a:hover { background: rgba(42, 26, 12, 0.12); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--orange); }

@media (max-width: 720px) {
  .js .nav-toggle { display: block; }
  .js .site-nav { display: none; position: absolute; inset: 100% 0 auto 0;
    background: var(--orange); border-bottom: 2px solid var(--ink); padding: 0.5rem var(--gutter) 1rem; }
  .js .site-nav.is-open { display: block; }
  .site-nav ul { flex-wrap: wrap; }
  .js .site-nav ul { flex-direction: column; }
  .js .site-nav a { padding: 0.75rem 1rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.4rem; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid var(--ink);
  transition: background-color .15s, color .15s;
}
.btn-solid { background: var(--ink); color: #FFF4E6; }
.btn-solid:hover { background: #4A2E14; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgba(42, 26, 12, 0.1); }

/* ---------- Home: hero ---------- */
.hero {
  background: var(--orange);
  color: var(--ink);
  padding-block: clamp(2.5rem, 7vw, 6rem);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}
.hero .wrap {
  display: grid; align-items: center; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1.25fr 1fr;
}
.hero h1 { font-size: var(--step-4); }
.hero-lede { margin-top: 1.5rem; max-width: 34rem; font-size: var(--step-1); line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero-art img { width: 100%; max-width: 460px; margin-inline: auto; filter: drop-shadow(0 18px 30px rgba(42,26,12,.35)); }

.block-tip {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-top: 2.25rem; padding: 0.5rem 0.9rem;
  border: 2px solid var(--ink); border-radius: 999px;
  font-size: var(--step--1); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.block-tip[hidden] { display: none; }
.block-tip .pulse { width: .6rem; height: .6rem; border-radius: 50%; background: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .block-tip .pulse { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .25; } }
}

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .hero-art img { max-width: 260px; }
}

/* ---------- Home: the three steps ---------- */
.steps { padding-block: clamp(3rem, 8vw, 6rem); }
.steps h2 { font-size: var(--step-2); max-width: 22ch; }
.steps ol { list-style: none; padding: 0; margin-top: 2.5rem; border-top: 2px solid var(--text); counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: 4rem 1fr auto; gap: 1.5rem; align-items: baseline;
  padding-block: 1.75rem; border-bottom: 1px solid var(--line);
}
.steps li::before {
  content: counter(step);
  font-weight: 800; font-variation-settings: "wdth" 125; font-size: var(--step-2);
  color: var(--orange-text);
}
@media (prefers-color-scheme: dark) { .steps li::before { color: var(--orange); } }
.steps h3 { font-size: var(--step-2); }
.steps p { color: var(--text-muted); max-width: 46ch; margin-top: 0.35rem; }
.steps .step-link { font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
  .steps li { grid-template-columns: 2.5rem 1fr; }
  .steps .step-link { grid-column: 2; }
}

/* ---------- Inner page header ---------- */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; }
.page-head h1 { font-size: var(--step-3); max-width: 18ch; }
.page-head p { margin-top: 1rem; max-width: 60ch; color: var(--text-muted); font-size: var(--step-1); line-height: 1.5; }

/* ---------- Books ---------- */
.page-head .disclosure {
  margin-top: 1.5rem; line-height: 1.5; max-width: 60ch;
  font-size: var(--step--1); color: var(--text-muted);
  padding-left: 0.9rem; border-left: 3px solid var(--orange);
}
.shelf {
  display: grid; gap: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 2.5vw, 2rem);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  padding: 1rem 0 clamp(3rem, 8vw, 5rem); list-style: none;
}
.book a { display: block; color: inherit; text-decoration: none; }
.book-cover {
  aspect-ratio: 2 / 3; overflow: hidden;
  border-radius: 2px 6px 6px 2px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,.18), 0 1px 2px rgba(42,26,12,.2), 0 10px 22px -8px rgba(42,26,12,.45);
  background: var(--line);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book h2 { font-size: 1rem; line-height: 1.3; margin-top: 0.9rem; font-weight: 700; }
.book .subtitle { display: block; font-weight: 400; color: var(--text-muted); font-size: var(--step--1); margin-top: 0.2rem; }
.book .author { font-size: var(--step--1); color: var(--text-muted); margin-top: 0.35rem; }
.book .buy {
  display: inline-block; margin-top: 0.6rem; font-size: var(--step--1); font-weight: 700;
  color: var(--link); text-decoration: underline; text-underline-offset: 0.18em;
}
.book a:hover .buy { text-decoration-thickness: 2px; }
.book a:hover h2 { text-decoration: underline; text-decoration-color: var(--orange); }

/* ---------- Resources ---------- */
.resources-layout {
  display: grid; grid-template-columns: 13rem 1fr; gap: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}
.toc { position: sticky; top: 5.5rem; align-self: start; }
.toc ul { list-style: none; padding: 0; border-left: 2px solid var(--line); }
.toc a {
  display: block; padding: 0.3rem 0 0.3rem 1rem; margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted); text-decoration: none; font-size: var(--step--1); font-weight: 600;
}
.toc a:hover { color: var(--text); border-left-color: var(--orange); }

.filter { margin-bottom: 2.5rem; }
.filter label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.filter input {
  width: 100%; max-width: 28rem; padding: 0.75rem 1rem;
  font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--field-border); border-radius: var(--radius);
}
.filter input:focus { border-color: var(--orange); outline: none; }
.filter-status { margin-top: 0.5rem; font-size: var(--step--1); color: var(--text-muted); min-height: 1.5em; }

.res-group { margin-bottom: 3rem; }
.res-group h2 { font-size: var(--step-2); }
.res-group > p { color: var(--text-muted); margin-top: 0.3rem; max-width: 60ch; }
.res-list {
  list-style: none; padding: 0; margin-top: 1.25rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  border-top: 1px solid var(--line);
}
.res-list a {
  display: flex; flex-direction: column; gap: 0.1rem; height: 100%;
  padding: 0.85rem 1rem 0.85rem 0; border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.res-list .name { font-weight: 700; }
.res-list .domain { font-size: var(--step--1); color: var(--text-muted); }
.res-list a:hover .name { color: var(--link); text-decoration: underline; }

@media (max-width: 860px) {
  .resources-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.85rem; margin: 0; }
}

/* ---------- Contact ---------- */
.contact-layout {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(2rem, 6vw, 5rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}
.contact-aside p { color: var(--text-muted); margin-bottom: 1rem; max-width: 40ch; }
.form { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 0.4rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; }
.field .hint { font-size: var(--step--1); color: var(--text-muted); }
.field input, .field textarea {
  width: 100%; padding: 0.8rem 1rem; font: inherit; color: var(--text);
  background: var(--surface); border: 2px solid var(--field-border); border-radius: var(--radius);
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus { border-color: var(--orange); outline: none; }
.captcha { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.captcha input { width: 6rem; }
.form .btn { justify-self: start; }
.form .hp { position: absolute; left: -9999px; }
@media (prefers-color-scheme: dark) {
  .form .btn-solid { background: var(--orange); color: var(--ink); border-color: var(--orange); }
  .form .btn-solid:hover { background: #FFAA45; }
}
@media (max-width: 760px) {
  .contact-layout, .form { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: #E9DCCB;
  padding-block: 2rem; font-size: var(--step--1);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.site-footer a { color: var(--orange); }
.site-footer ul { display: flex; gap: 1.25rem; list-style: none; padding: 0; }

/* ---------- Text pages (disclosure, privacy) ---------- */
.prose { max-width: 42rem; padding-bottom: clamp(3rem, 8vw, 5rem); }
.prose h2 { font-size: var(--step-2); margin-top: 2.75rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin-top: 1rem; }
.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.4rem; }
.prose .updated { color: var(--text-muted); font-size: var(--step--1); margin-top: 3rem; }
