/* ============================================================
   CATBACK guide.css — HOW TO BUY pixel instruction manual.
   Companion to js/guide.js (module "guide"). All colors/fonts
   come from tokens.css custom properties only.
   ============================================================ */

/* ---- DESK 04: the printed customer manual on its stand -------
   #howtobuy-body is a literature rack: a forest-green lip runs
   along the top, the step cards are printed leaflets resting in
   it, and a stand foot carries the whole thing. */
#howtobuy-body {
  position: relative;
  padding: 24px 0 22px;
}
#howtobuy-body::before {
  content: 'CUSTOMER MANUAL · TAKE ONE';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  padding-left: 22px;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 16px;
  letter-spacing: 2px;
  color: var(--ink-3);
  background: linear-gradient(180deg, var(--c-forest) 0 62%, var(--charcoal) 62% 100%);
  box-shadow: 0 0 0 var(--px) var(--shade-soft);
  pointer-events: none;
}
/* the rack foot */
#howtobuy-body::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(300px, 62%);
  height: 14px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    linear-gradient(180deg,
      var(--charcoal) 0 4px,
      var(--forest-2) 4px 6px,
      var(--charcoal) 6px 10px,
      var(--shade) 10px 14px);
  box-shadow: 0 0 0 var(--px) var(--shade-soft);
}

.guide-kicker {
  margin: 0 0 22px;
  font-family: var(--font-term);
  font-size: 19px;
  letter-spacing: 1px;
  color: var(--terminal-dim);
}

/* ---- step cards (pixel manual pages) ----------------------- */
.guide-steps {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.guide-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px 24px;
  /* printed leaflet stock: opaque warm paper, a faint fibre tooth and a
     sheen where the ceiling light falls across the top of the sheet */
  background-color: var(--ink-3);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0, rgba(255, 255, 255, 0) 52px),
    repeating-linear-gradient(90deg, transparent 0 5px, var(--scanline) 5px 6px),
    linear-gradient(180deg, var(--ink-3) 0 72%, var(--ink-2) 100%);
  border: var(--px) solid var(--forest-2);
  box-shadow: 0 0 0 var(--px) var(--ink-3), 0 0 14px var(--glow-soft);
  transition: transform var(--dur-fast) var(--ease-snap);
}
.guide-step:hover {
  transform: translateY(-2px);
  border-color: var(--moss);
}

.guide-num {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-pixel);
  font-size: 26px;
  line-height: 1;
  color: var(--moss);               /* "bright" end state of the reveal fill */
  text-shadow: 2px 2px 0 var(--ink);
  pointer-events: none;
  user-select: none;
  transition: color var(--dur-med) var(--ease-mech);
}

.guide-icon {
  flex: 0 0 auto;
  width: 96px;             /* 32px sprite x3 — integer scale, stays crisp */
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--ink);
  border: var(--px) solid var(--forest);
}

.guide-text { min-width: 0; }

.guide-title {
  margin: 2px 0 9px;
  padding-right: 40px;      /* keep clear of the big numeral */
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 1px;
  color: var(--terminal);
}

.guide-copy {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--terminal-soft);
}

/* ---- official CA strip (between steps 4 and 5) -------------- */
.guide-ca {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  margin: 0 0 18px;
}
.guide-ca-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--c-emerald);      /* branch ink, clears 4.5:1 on cream */
  white-space: nowrap;
}
.guide-ca-value {
  flex: 1 1 140px;
  min-width: 0;
  font-family: var(--font-term);
  font-size: 21px;
  line-height: 1.2;
  color: var(--terminal);
  overflow-wrap: anywhere;   /* long base58 CA can never overflow */
}
.guide-ca-copy {
  min-height: 40px;          /* touch target floor */
  min-width: 76px;
}
.guide-ca-copy.is-copied { background: var(--gold); }
.guide-ca-note {
  font-family: var(--font-term);
  font-size: 17px;
  color: var(--amber);
}

/* ---- security warnings panel (amber) ------------------------ */
.guide-warn {
  border-color: var(--amber);
  box-shadow: 0 0 0 var(--px) var(--forest);
  padding: 18px 20px;
}
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .guide-warn {
    box-shadow:
      0 0 0 var(--px) var(--forest),
      0 0 18px color-mix(in srgb, var(--amber) 16%, transparent);
  }
}
.guide-warn-title {
  margin: 0 0 12px;
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--amber);
}
.guide-warn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-term);
  font-size: 19px;
  line-height: 1.4;
}
.guide-warn-list li {
  position: relative;
  margin: 7px 0;
  padding-left: 22px;
}
.guide-warn-list li::before {
  content: '!';
  position: absolute;
  left: 4px;
  top: 2px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--amber);
}

/* ---- staggered step-in reveal (guide.js drives the classes) --
   .guide-anim is only added when motion is allowed; without JS or
   with reduced motion everything below is simply visible. */
.guide-anim .guide-reveal {
  opacity: 0;
  transform: translateY(16px);
}
.guide-anim.guide-in .guide-reveal {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 460ms var(--ease-snap),
    transform 460ms var(--ease-snap);
  transition-delay: var(--gd, 0ms);
}

/* ============================================================
   Micro-interaction + depth pass (additive).
   .guide-live is toggled by guide.js while the section is on
   screen — ambient loops only run when visible.
   ============================================================ */

/* ---- a printed sheet sitting on a small stack ---------------- */
.guide-step {
  box-shadow:
    0 0 0 var(--px) var(--ink-3),
    0 0 0 calc(2 * var(--px)) var(--forest),
    calc(3 * var(--px)) calc(3 * var(--px)) 0 var(--px) var(--ink-2),
    calc(5 * var(--px)) calc(5 * var(--px)) 0 var(--px) var(--forest),
    0 14px 22px var(--shade-soft);
}
/* the folded top corner of the leaflet */
.guide-step::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 12px; height: 12px;
  background: var(--ink-2);
  border-right: var(--px) solid var(--forest-2);
  border-bottom: var(--px) solid var(--forest-2);
  pointer-events: none;
  transition: border-color var(--dur-fast) var(--ease-snap);
}

/* hover: the existing 2px lift, deepened in sync with the twinkle */
.guide-step:hover {
  box-shadow:
    0 0 0 var(--px) var(--ink-3),
    0 0 0 calc(2 * var(--px)) var(--moss),
    calc(3 * var(--px)) calc(3 * var(--px)) 0 var(--px) var(--ink-2),
    calc(5 * var(--px)) calc(5 * var(--px)) 0 var(--px) var(--forest),
    0 18px 28px var(--shade);
}
.guide-step:hover::before { border-color: var(--moss); }
.guide-step:hover .guide-icon { border-color: var(--moss); }
.guide-step:hover .guide-num { color: var(--atm-green); }

/* ---- step number: dim -> bright fill as each card reveals ---- */
.guide-anim .guide-reveal .guide-num { color: var(--forest-2); }
.guide-anim.guide-in .guide-reveal .guide-num {
  color: var(--moss);
  transition: color 760ms var(--ease-mech);
  transition-delay: calc(var(--gd, 0ms) + 240ms);
}

/* ---- CA strip: subtle cyan edge pulse every ~10s -------------- */
.guide-ca { position: relative; }
.guide-ca::after {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--px));
  border: var(--px) solid var(--sol-cyan);
  opacity: 0;
  pointer-events: none;
}
.guide-live .guide-ca::after {
  animation: guide-ca-pulse 10s var(--ease-mech) infinite;
}
@keyframes guide-ca-pulse {
  0%, 86%  { opacity: 0; }
  90%      { opacity: 0.8; }
  94%      { opacity: 0.25; }
  97%      { opacity: 0.6; }
  100%     { opacity: 0; }
}
body[data-motion="reduce"] .guide-ca::after {
  animation: none;
  opacity: 0.3;                     /* static faint cyan edge instead */
}

/* ---- warning panel: stepped amber caution crawl on top border - */
.guide-warn {
  position: relative;
  overflow: hidden;
}
.guide-warn::before {
  content: '';
  position: absolute;
  top: 0; left: -32px; right: 0;
  height: calc(2 * var(--px));
  opacity: 0.45;
  pointer-events: none;
  background: repeating-linear-gradient(90deg,
    var(--amber) 0 10px,
    transparent 10px 16px);
}
.guide-live .guide-warn::before {
  animation: guide-warn-crawl 2.4s steps(8, end) infinite;
}
@keyframes guide-warn-crawl {
  from { transform: translateX(0); }
  to   { transform: translateX(32px); }   /* exactly 2 pattern periods */
}
body[data-motion="reduce"] .guide-warn::before { animation: none; }

/* ---- mobile -------------------------------------------------- */
@media (max-width: 780px) {
  .guide-steps { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 480px) {
  .guide-step { padding: 16px 14px; gap: 12px; }
  .guide-icon { width: 64px; height: 64px; }  /* 2x — still integer scale */
  .guide-num { font-size: 20px; }
  .guide-title { font-size: 10px; padding-right: 32px; }
}
