/* ============================================
   The Art of Navigation — Black Rock Rangers
   Simple edition
   ============================================ */

:root {
  /* Khaki palette */
  --bg: #f3ead2;
  --bg-elev: #e8dcc0;
  --bg-deep: #ddd0b0;
  --paper: #e8dcc0;
  --ink: #111111;
  --ink-soft: #222222;
  --ink-muted: #555544;
  --rule: #b6a577;
  --rule-soft: #c9b98e;
  --accent: #b04a1f;
  --accent-soft: #d97a4a;
  --accent-ink: #f3ead2;

  --font-sans: Georgia, "Times New Roman", Times, serif;
  --font-mono: Georgia, "Times New Roman", Times, serif;

  --content-max: 760px;
  --nav-h: 58px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-boosted body { font-size: 22px; }
.font-boosted .hero p { font-size: clamp(20px, 2vw, 22px); }
.font-boosted .prospective p { font-size: 22px; }
.font-boosted .toc-card .body .ttl { font-size: 24px; }
.font-boosted .toc-card .body .tag { font-size: 21px; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-soft); }

/* ============================================
   Top nav
   ============================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.1;
  flex-shrink: 0;
}
.nav-brand .mark {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.nav-brand .title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.nav-links {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  align-items: center;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink-muted);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}
.nav-links a:hover { color: var(--ink); border-color: var(--rule-soft); }
.nav-links a.is-current {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.nav-links a.home { width: auto; padding: 0 10px; }

.nav-menu-btn {
  display: inline-flex;
  margin-left: auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}

.font-size-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  padding: 7px 12px;
  border: 1px solid #8f8f88;
  border-radius: 8px;
  background: #d8d5c8;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 0 #8f8f88, 0 5px 8px rgba(0,0,0,0.15);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.font-size-btn .a-icons { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 700; line-height: 1; }
.font-size-btn .a-icons .a-sm { font-size: 12px; }
.font-size-btn .a-icons .a-lg { font-size: 19px; }
.font-size-btn:hover { background: #c9c6b8; border-color: #8f8f88; }
.font-size-btn:active { transform: translateY(3px); box-shadow: 0 0 0 #8f8f88, 0 2px 4px rgba(0,0,0,0.15); }
.font-boosted .font-size-btn { background: #b8b4a4; color: var(--ink); border-color: #8f8f88; box-shadow: 0 3px 0 #8f8f88, 0 5px 8px rgba(0,0,0,0.15); }

@media (max-width: 720px) {
  .font-size-btn span[data-font-size-label] { display: none; }
}

/* Mobile drawer */
.nav-drawer {
  position: fixed;
  inset: var(--nav-h) 0 0 auto;
  width: 280px;
  max-width: 84vw;
  background: var(--bg-elev);
  border-left: 1px solid var(--rule);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 59;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-drawer.is-open { transform: translateX(0); }
.nav-drawer a {
  display: flex;
  gap: 12px;
  padding: 13px 12px;
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--rule-soft);
  font-size: 15px;
}
.nav-drawer a:hover { background: var(--bg-deep); color: var(--ink); }
.nav-drawer a.is-current { color: var(--accent); font-weight: 600; }
.nav-drawer a .n {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  width: 22px;
}
.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 58;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.nav-scrim.is-on { opacity: 1; pointer-events: auto; }

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ============================================
   Content column
   ============================================ */

.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 22px;
}

.page {
  padding: 40px 0 100px;
}

.section-head {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--rule);
}

.section-head h1 {
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.section-head .goal {
  font-size: 1.1em;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}

h2.block {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 52px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  text-wrap: balance;
}
h3.block {
  font-size: 19px;
  font-weight: 600;
  margin: 32px 0 8px;
}

.page p { margin: 0 0 18px; text-wrap: pretty; }
.page ul { margin: 0 0 20px; padding-left: 0; list-style: none; }
.page ul li {
  position: relative;
  padding: 4px 0 4px 22px;
  margin: 2px 0;
}
.page ul li::before {
  content: "▸";
  position: absolute;
  left: 2px;
  color: var(--accent);
}
.page ul.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.page ul.chips li {
  padding: 6px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.page ul.chips li::before { content: none; }

.callout {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 26px 0;
}
.callout .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.callout p:last-child { margin-bottom: 0; }

/* ============================================
   Figures / images
   ============================================ */

figure.fig {
  margin: 28px 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 14px;
}
figure.fig img {
  display: block;
  width: 100%;
  height: auto;
}
figure.fig figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-align: center;
}
figure.fig.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: transparent;
  border: none;
  padding: 0;
}
figure.fig.pair > span {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 14px;
}
figure.fig.pair img { width: 100%; }

/* Pair with a single shared caption below */
figure.fig.pair-single {
  display: flex; flex-direction: column; gap: 0;
  background: var(--paper); border: 1px solid var(--rule); padding: 14px;
}
figure.fig.pair-single .imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
figure.fig.pair-single img { width: 100%; display: block; }
figure.fig.pair-single figcaption { margin-top: 10px; }

/* Trio: three images in a row, single shared caption */
figure.fig.trio {
  display: flex; flex-direction: column; gap: 0;
  background: var(--paper); border: 1px solid var(--rule); padding: 14px;
}
figure.fig.trio .imgs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
figure.fig.trio img { width: 100%; display: block; }
figure.fig.trio figcaption { margin-top: 10px; }

/* Image layout tweak — "stack" puts each image on its own line */
[data-img-layout="stack"] figure.fig.pair { grid-template-columns: 1fr; }
[data-img-layout="stack"] figure.fig.pair-single .imgs { grid-template-columns: 1fr; }
[data-img-layout="stack"] figure.fig.trio .imgs { grid-template-columns: 1fr; }

@media (max-width: 600px) {
  figure.fig.pair { grid-template-columns: 1fr; }
  figure.fig.pair-single .imgs { grid-template-columns: 1fr; }
  figure.fig.trio .imgs { grid-template-columns: 1fr; }
}

/* ============================================
   Image size tweak — how wide figures may grow
   (column = within text column · wide · full-bleed)
   ============================================ */
[data-img-size="wide"] .page figure.fig {
  width: min(1040px, 94vw);
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
[data-img-size="full"] .page figure.fig {
  width: 100vw;
  max-width: none;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}
[data-img-size="full"] .page figure.fig:not(.pair) {
  border-left: none;
  border-right: none;
}

/* ============================================
   Practice tool (full-bleed iframe)
   ============================================ */

.tool {
  margin: 36px 0;
  /* break out of the content column to full viewport width */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  background: var(--bg-elev);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.tool-head {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 22px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  background: var(--bg-elev);
}
.tool-tag {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
  white-space: nowrap;
}
.tool-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.tool-desc {
  flex-basis: 100%;
  max-width: var(--content-max);
  margin: 4px auto 0;
  padding: 0 22px;
  font-size: 14.5px;
  color: var(--ink-soft);
}
.tool-open {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 5px 0 #7a3012, 0 9px 15px rgba(0,0,0,0.18);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.tool-open:hover { background: var(--accent-soft); color: var(--accent-ink); }
.tool-open:active { transform: translateY(5px); box-shadow: 0 0 0 #7a3012, 0 3px 6px rgba(0,0,0,0.18); }
.tool-open-icon { width: 21px; height: 21px; flex-shrink: 0; filter: brightness(0) invert(1); }
.fake-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
  position: relative;
}
.fake-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: 220px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
}
.fake-link:focus::after, .fake-link:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Per-tool open-button toggle */
.tool[data-btn-hidden] .tool-open { display: none; }

/* Per-tool description toggle */
.tool[data-desc-hidden] .tool-desc { display: none; }

/* Big Frame — full-bleed tool with a configurable gap on each side */
:root { --big-frame-gap: 10px; }
[data-big-frame-gap="20"] { --big-frame-gap: 20px; }
[data-big-frame-gap="40"] { --big-frame-gap: 40px; }
.tool.big-frame {
  width: calc(100vw - 2 * var(--big-frame-gap));
  margin-left: calc(-50vw + var(--big-frame-gap));
  margin-right: calc(-50vw + var(--big-frame-gap));
}

/* Column Frame — constrained within the content column */
.tool.column-frame {
  width: auto;
  position: static;
  left: auto;
  right: auto;
  margin-left: 0;
  margin-right: 0;
  border: 2px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-top: none;
  border-bottom: none;
  background: var(--bg-elev);
  box-shadow: 4px 4px 0 var(--bg-deep);
}
.tool.column-frame .tool-head {
  max-width: none;
  padding: 14px 18px 10px;
}
.tool.column-frame .tool-desc {
  max-width: none;
  padding: 0 18px 10px;
}

.tool-frame-wrap {
  border-top: 1px dashed var(--rule);
  background: var(--paper);
}
.tool-frame {
  display: block;
  width: 100%;
  height: 600px; /* initial fallback — JS sizes each frame to its content */
  border: 0;
  background: var(--paper);
}

/* Mobile: optionally collapse to a button */
.tool-mobile-cta {
  display: none;
  margin: 0;
  padding: 22px;
}
.tool-mobile-cta a {
  display: block;
  text-align: center;
  padding: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
}
.tool-mobile-cta a:hover { background: var(--accent-soft); }
.tool-mobile-cta .hint {
  margin-top: 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

@media (max-width: 640px) {
  .tool[data-mobile="button"] .tool-frame-wrap { display: none; }
  .tool[data-mobile="button"] .tool-mobile-cta { display: block; }
  .qr-only-desktop { display: none; }
}
@media (min-width: 641px) {
  .mobile-only-frame { display: none; }
}

/* ============================================
   Page footer nav
   ============================================ */

.page-nav {
  max-width: var(--content-max);
  margin: 64px auto 0;
  padding: 0 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.page-nav a {
  display: block;
  padding: 18px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}
.page-nav a:hover { background: var(--bg-deep); }
.page-nav a.next { text-align: right; }
.page-nav .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.page-nav .ttl { font-weight: 600; margin-top: 4px; font-size: 15px; }
.page-nav a.disabled { opacity: 0.4; pointer-events: none; }

/* ============================================
   Intro page
   ============================================ */

.hero {
  padding: 64px 22px 44px;
  border-bottom: 1px solid var(--rule);
}
.hero-inner { max-width: 820px; margin: 0 auto; }
.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(38px, 6.5vw, 62px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  text-wrap: balance;
}
.hero p {
  font-size: clamp(16px, 2vw, 18px);
  color: var(--ink-soft);
  max-width: 64ch;
  margin: 0 0 16px;
}

.prospective {
  max-width: 820px;
  margin: 36px auto 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 24px 28px;
}
.prospective .label {
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.prospective p { font-size: 18px; color: var(--ink); margin: 0 0 12px; }
.prospective p:last-child { margin: 0; }
.feedback-wrap { max-width: 820px; margin: 90px auto 0; text-align: center; }
:root { --feedback: #2f6a8a; --feedback-soft: #4886a8; --feedback-shadow: #1c4459; }
.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: #ffffff;
  background: var(--feedback);
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid var(--feedback);
  box-shadow: 0 5px 0 var(--feedback-shadow), 0 10px 18px rgba(0,0,0,0.28);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.feedback-btn:hover { background: var(--feedback-soft); color: #ffffff; }
.feedback-btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 var(--feedback-shadow), 0 3px 6px rgba(0,0,0,0.22);
}

.toc {
  padding: 52px 22px 40px;
}
.toc-inner { max-width: 820px; margin: 0 auto; }
.toc h2 {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
}
.toc-list {
  border-top: 1px solid var(--rule);
}
.toc-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 20px 12px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s, padding-left 0.15s;
}
.toc-card:hover { background: var(--bg-elev); padding-left: 18px; }
.toc-card .num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.25;
}
.toc-card .body .ttl {
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  text-wrap: balance;
  margin-bottom: 10px;
}
.toc-card .body .tag {
  font-weight: 400;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
}
.toc-card .arrow { font-family: var(--font-mono); color: var(--ink-muted); align-self: start; }
.toc-card:hover .arrow { color: var(--accent); }

@media print {
  .nav, .nav-drawer, .nav-scrim, .tool-frame-wrap, .page-nav { display: none !important; }
}
