/* Caravel Pay: guides index, guide articles and the 404 page. Depends on base.css.
   Pages are generated by site/_build/guides.py and build.py. No JavaScript needed. */

body.guide, body.guides-index, body.lost { background: var(--cream); }
[id] { scroll-margin-top: 24px; }

/* =========================================================
   NIGHT BAND: nav, stars, small ASCII caravel, one wave line
   ========================================================= */
.band {
  position: relative;
  overflow: hidden;
  color: var(--moon);
  background:
    radial-gradient(60% 70% at 50% 0%, rgba(54, 78, 128, 0.24), transparent 72%),
    linear-gradient(180deg, #060a12 0%, #08101d 58%, #0d1a2f 100%);
}
.band-sky { position: absolute; inset: 0; pointer-events: none; user-select: none; }
.star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font: 400 13px / 1 var(--font-mono);
  color: var(--moon);
  opacity: var(--o, 0.4);
  animation: pg-twinkle var(--t, 7s) ease-in-out var(--d, 0s) infinite;
}
@keyframes pg-twinkle {
  0%, 100% { opacity: var(--o, 0.4); }
  50% { opacity: calc(var(--o, 0.4) * 0.22); }
}

/* ---- nav ---- */
.site-nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 76px;
}
.site-nav .brand { color: var(--moon); margin-right: auto; }
.site-nav-links { display: flex; gap: 28px; margin: 0; padding: 0; list-style: none; }
.site-nav-links a {
  color: var(--moon-2);
  font-size: 15px;
  font-weight: 450;
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-nav-links a:hover { color: var(--moon); }
.site-menu { display: none; position: relative; }
.site-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(243, 238, 227, 0.18);
  color: var(--moon);
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
}
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu summary svg { width: 16px; height: 16px; }
.site-menu-panel {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 20;
  width: min(320px, calc(100vw - 2 * var(--gutter)));
  padding: 10px;
  border-radius: 18px;
  background: var(--night-2);
  border: 1px solid rgba(243, 238, 227, 0.1);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
}
.site-menu-panel ul { list-style: none; margin: 0; padding: 0; }
.site-menu-panel a:not(.btn) {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--moon);
  text-decoration: none;
}
.site-menu-panel a:not(.btn):hover { background: rgba(243, 238, 227, 0.06); }
.site-menu-panel .btn { width: 100%; margin-top: 8px; }

/* ---- band copy ---- */
.band-in { position: relative; z-index: 3; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(243, 238, 227, 0.14);
  background: rgba(243, 238, 227, 0.035);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moon-2);
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(242, 181, 68, 0.14);
}
.band h1 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--moon);
  text-wrap: balance;
}
.band .accent {
  display: inline-block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  line-height: 0.92;
  letter-spacing: -0.015em;
  padding-right: 0.06em;
  color: var(--amber);
}
.band .dek {
  margin-top: 20px;
  font-size: clamp(17px, 1.4vw, 19px);
  line-height: 1.6;
  color: var(--moon-2);
  text-wrap: pretty;
}

.band-index { text-align: center; padding-top: clamp(40px, 7vh, 84px); }
.band-index h1 {
  margin-top: 24px;
  font-size: clamp(46px, 7.4vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.band-index .dek { max-width: 580px; margin-inline: auto; }

.band-article { max-width: calc(760px + 2 * var(--gutter)); padding-top: clamp(24px, 4vh, 48px); }
.band-article h1 {
  margin-top: 18px;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--moon-3);
}
.crumbs li + li::before { content: "/"; margin: 0 10px; opacity: 0.6; }
.crumbs a { color: var(--moon-2); text-decoration: none; }
.crumbs a:hover { color: var(--moon); text-decoration: underline; text-underline-offset: 3px; }
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--moon-3);
}
.byline span + span::before { content: "\00b7"; margin: 0 10px; opacity: 0.7; }
.byline span:first-child { color: var(--moon-2); }

/* ---- sea ---- */
.band-sea {
  --ascii: 12px;
  position: relative;
  z-index: 2;
  margin-top: 30px;
  pointer-events: none;
  user-select: none;
}
.band-ship {
  width: max-content;
  margin: 0 max(var(--gutter), calc(50% - 560px)) 0 auto;
  font: 400 var(--ascii) / 1.2 var(--font-mono);
  color: rgba(243, 238, 227, 0.72);
  white-space: pre;
  transform-origin: 50% 92%;
  animation: pg-bob 7.5s ease-in-out infinite;
}
.band-wave {
  overflow: hidden;
  font: 400 var(--ascii) / 1.2 var(--font-mono);
  white-space: pre;
  color: rgba(243, 238, 227, 0.4);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 14%, #000 86%, transparent 100%);
}
.band-wave > span { display: inline-block; animation: pg-drift 160s linear infinite; }
@keyframes pg-bob {
  0%, 100% { transform: translateY(0) rotate(-0.7deg); }
  50% { transform: translateY(-3px) rotate(0.7deg); }
}
@keyframes pg-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (min-width: 1100px) {
  .band-article + .band-sea, .band-index + .band-sea, .lost-in + .band-sea { margin-top: -96px; }
}

/* =========================================================
   ARTICLE
   ========================================================= */
.g-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr);
  column-gap: 48px;
  padding-block: clamp(40px, 6vw, 72px) 0;
}
.g-body { grid-column: 2; min-width: 0; }
.g-toc { font-size: 14px; }
.g-toc-side {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  position: sticky;
  top: 24px;
  width: 220px;
}
.g-toc-inline { display: none; }
.g-toc-title, .g-toc summary {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.g-toc summary { cursor: pointer; list-style: none; }
.g-toc summary::-webkit-details-marker { display: none; }
.g-toc summary::after { content: " +"; }
.g-toc[open] summary::after { content: " \2212"; }
.g-toc ol { list-style: none; margin: 14px 0 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); display: grid; gap: 8px; }
.g-toc li.lvl3 { padding-left: 12px; font-size: 13.5px; }
.g-toc a { color: var(--ink-2); text-decoration: none; line-height: 1.4; display: block; }
.g-toc a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.g-body {
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink);
  overflow-wrap: break-word;
}
.g-body > * + * { margin-top: 1.15em; }
.g-body > :first-child { margin-top: 0; }
.g-body p, .g-body li { text-wrap: pretty; }
.g-body h2 {
  margin-top: 2.1em;
  font-family: var(--font-display);
  font-weight: 550;
  font-size: clamp(25px, 2.4vw, 31px);
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.g-body h3 {
  margin-top: 1.7em;
  font-size: 20.5px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.g-body h2 + *, .g-body h3 + * { margin-top: 0.6em; }
.g-body .anchor {
  margin-left: 0.35em;
  color: var(--ink-3);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.g-body h2:hover .anchor, .g-body h3:hover .anchor, .g-body .anchor:focus-visible { opacity: 1; }
.g-body a:not(.btn):not(.anchor) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.g-body a:not(.btn):not(.anchor):hover { text-decoration-color: var(--ink); }
.g-body strong { font-weight: 620; }
.g-body ul, .g-body ol { padding-left: 1.35em; }
.g-body li + li { margin-top: 0.45em; }
.g-body li::marker { color: var(--ink-3); }
.g-body :not(pre) > code {
  padding: 0.12em 0.36em;
  border-radius: 6px;
  background: var(--cream-2);
  border: 1px solid var(--line-2);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
.g-body .code { margin-top: 1.4em; font-size: 15px; }
.g-body blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.1em;
  border-left: 3px solid var(--amber);
  color: var(--ink-2);
}
.g-body .note, .g-body .callout {
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 16.5px;
}
.g-body .callout.warn, .g-body .note.warn { background: #fbf0d9; border-color: rgba(138, 90, 6, 0.18); }
.g-body .callout > svg { display: none; }
.g-body .note > * + *, .g-body .callout > * + * { margin-top: 0.6em; }
.g-body figure { margin-left: 0; margin-right: 0; }
.g-body img { height: auto; border-radius: var(--radius); }
.g-body figcaption { margin-top: 10px; font-size: 14.5px; color: var(--ink-3); }
.g-body hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.2em; }
.g-body .table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  /* Wide tables scroll sideways on small screens. A soft shadow on the edge that has more to show
     is the only cue, so it is drawn with fixed and scrolling backgrounds: no script. */
  background:
    linear-gradient(to right, var(--paper) 40%, rgba(255, 253, 248, 0)) left center / 36px 100% no-repeat local,
    linear-gradient(to left, var(--paper) 40%, rgba(255, 253, 248, 0)) right center / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(20, 24, 33, 0.18), rgba(20, 24, 33, 0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(20, 24, 33, 0.18), rgba(20, 24, 33, 0)) right center / 12px 100% no-repeat scroll,
    var(--paper);
}
.g-body table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.55; }
.g-body th, .g-body td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.g-body thead th { font-weight: 600; background: var(--cream); white-space: nowrap; }
.g-body tbody tr:last-child > * { border-bottom: 0; }
.g-body .sources, .g-body .sources li { font-size: 15px; color: var(--ink-2); }
.g-body ol.steps { list-style: none; padding: 0; counter-reset: step; }
.g-body ol.steps > li {
  position: relative;
  padding-left: 46px;
  counter-increment: step;
}
.g-body ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font: 500 13px / 1 var(--font-mono);
}
.g-body ol.steps > li + li { margin-top: 1em; }

.faq-block {
  margin-top: 2.6em !important;
  padding: clamp(22px, 3vw, 34px);
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--line-2);
}
.faq-block h2 { margin-top: 0; }
.faq-block .faq-q { margin-top: 1.4em; font-size: 18.5px; }
.faq-block .faq-a { margin-top: 0.45em; color: var(--ink-2); }
.faq-block .faq-a > * + * { margin-top: 0.8em; }

/* ---- after the article: CTA + related ---- */
.g-after { max-width: calc(1000px + 2 * var(--gutter)); padding-block: clamp(56px, 7vw, 88px) clamp(72px, 9vw, 112px); }
.guide-cta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(20px, 4vw, 48px);
  padding: clamp(26px, 4vw, 44px);
  border-radius: var(--radius-xl);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.cta-ship {
  margin: 0;
  font: 400 12.5px / 1.2 var(--font-mono);
  color: rgba(20, 24, 33, 0.62);
  white-space: pre;
}
.cta-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.cta-text { margin-top: 10px; color: var(--ink-2); max-width: 520px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.g-related { margin-top: clamp(56px, 7vw, 80px); }
.g-related h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.03em;
}
.g-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.g-card a {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.g-card a:hover { border-color: rgba(20, 24, 33, 0.22); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.g-kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-ink);
}
.g-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.g-desc { color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.g-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.g-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  font-weight: 550;
  font-size: 15px;
}
.g-go svg { width: 14px; height: 14px; transition: transform 0.18s ease; }
.g-card a:hover .g-go svg { transform: translateX(3px); }

/* ---- guides index ---- */
.g-index { padding-block: clamp(48px, 7vw, 88px) clamp(72px, 9vw, 112px); }
.g-cards-index { margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.g-cards-index .g-card a { padding: 30px; }
.g-cards-index .g-title { font-size: 24px; }
.g-empty {
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 44px);
  text-align: center;
  border-radius: var(--radius-xl);
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.g-empty-title {
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.g-empty .cta-actions { justify-content: center; }

/* ---- 404 ---- */
.lost-in { text-align: center; padding-top: clamp(40px, 8vh, 96px); }
.lost-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moon-3);
}
.lost-in h1 {
  margin-top: 18px;
  font-size: clamp(46px, 7.4vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.lost-in .dek { max-width: 520px; margin-inline: auto; }
.lost-links { padding-block: clamp(48px, 7vw, 80px) clamp(72px, 9vw, 112px); }
.lost-links .g-cards { margin-top: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pill-draft { margin-bottom: 4px; color: var(--amber); border-color: rgba(242, 181, 68, 0.4); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-foot {
  padding: 64px 0 40px;
  background: var(--cream-2);
  border-top: 1px solid var(--line-2);
}
.site-foot-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 48px; }
.site-foot .brand { color: var(--ink); }
.site-foot-brand p { margin-top: 16px; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.site-foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.site-foot-cols h2 { font-family: var(--font-sans); font-size: 14.5px; font-weight: 600; letter-spacing: 0; }
.site-foot-cols ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.site-foot-cols a { color: var(--ink-2); text-decoration: none; font-size: 15px; }
.site-foot-cols a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.site-foot-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-3);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1099px) {
  .g-layout { grid-template-columns: minmax(0, 1fr); max-width: calc(720px + 2 * var(--gutter)); }
  .g-body { grid-column: 1; }
  .g-toc-side { display: none; }
  /* touch layouts: each contents link is a 28px-tall target (was 20px) */
  .g-toc-inline ol { gap: 2px; }
  .g-toc-inline a { padding: 4px 0; }
  .g-toc-inline {
    display: block;
    margin-bottom: 32px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--paper);
    border: 1px solid var(--line);
  }
  .g-cards, .lost-links .g-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 641px) and (max-width: 1099px) {
  .lost-links .g-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .site-nav-links, .site-nav-cta { display: none; }
  .site-menu { display: block; }
  .site-foot-top { grid-template-columns: minmax(0, 1fr); }
  .g-cards-index { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .band-sea { --ascii: 10px; margin-top: 24px; }
  .band-ship { margin-right: auto; margin-left: auto; }
  .band-article + .band-sea .band-ship { display: none; }
  .g-body { font-size: 17px; }
  .g-body th, .g-body td { padding: 10px 12px; }
  .guide-cta { grid-template-columns: minmax(0, 1fr); }
  .cta-ship { font-size: 10.5px; }
  .site-foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .star, .band-ship, .band-wave > span { animation: none !important; }
  .g-card a, .g-go svg, .g-body .anchor { transition: none; }
}
