/*
 * bowerjack.com: the house style (paper, ink, the red heart pip, a book serif), and no script
 * (bowerjacknext's apps/site/public/style.css at b8d33e41). The site's pages link it
 * (lib/site/SitePage.svelte); the Studio does not.
 */

:root {
  --paper: #fbf7ef;
  --card: #fffdf8;
  --ink: #101418;
  --muted: #6b6257;
  --rule: #ded5c6;
  --red: #9a2a2a;
  /* The brand red: the heart icon's own fill (favicon.svg). */
  --brand: #dd2e44;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
}

/* ---------- footer (the top bar is lib/site/AppBar.svelte) ---------- */

.footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 15px;
  padding: 24px;
  text-align: center;
}

.footer a {
  color: var(--muted);
}

/* ---------- the sheet ---------- */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

h1 {
  font-size: 44px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
  margin: 64px 0 24px;
}

h3 {
  font-size: 21px;
  margin: 0 0 8px;
}

.lede {
  font-size: 21px;
  color: var(--muted);
  margin: 0 0 28px;
}

.fine {
  color: var(--muted);
  font-size: 15px;
}

.beta {
  color: var(--muted);
  font-size: 15px;
  border-left: 3px solid var(--red);
  padding-left: 10px;
  max-width: 34em;
}

.button {
  display: inline-block;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 4px;
  color: var(--paper);
  font-size: 19px;
  padding: 12px 28px;
  text-decoration: none;
}

.button:hover {
  background: #7f2020;
}

.button.secondary {
  background: transparent;
  color: var(--red);
}

.button.secondary:hover {
  background: #f6e9e3;
}

/* ---------- hero, with a fan of three cards ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
}

/*
 * Real Bowerjack cards (static/cards/, written by scripts/build-hero-cards.mjs from real decks),
 * each the card's trim with its corners rounded here, dealt as hands of three from one deck. A card is 180 x 252 pt,
 * drawn at most a point to a CSS pixel from an image of twice that; its corner radius is the
 * physical format's 3 mm.
 *
 * The fan is sized from its own width (a container), so each card's name reads in full at every
 * width: the three cards turn 8 degrees apart about a point 4.5 card heights below their tops,
 * which spreads their tops so the card above never reaches the name of the card beneath, and the
 * three together are 2.74 cards wide. They may reach 20 px past the fan on each side, into the
 * gap beside it and the page's margin.
 */
.fan {
  --card-width: min(172px, (100cqi + 40px) / 2.74);
  container-type: inline-size;
  position: relative;
}

.fan::before {
  content: '';
  display: block;
  height: calc(var(--card-width) * 1.53 + 40px);
}

.hand {
  position: absolute;
  inset: 0;
  opacity: 0;
  isolation: isolate;
}

.hand:first-child {
  opacity: 1;
}

.hand img {
  position: absolute;
  left: 50%;
  top: 12px;
  width: var(--card-width);
  height: calc(var(--card-width) * 1.4);
  margin-left: calc(var(--card-width) / -2);
  border-radius: 4.724% / 3.375%;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(16, 20, 24, 0.06),
    0 8px 22px rgba(16, 20, 24, 0.14);
  transform-origin: 50% 450%;
}

.hand img:nth-child(1) {
  transform: rotate(-8deg);
}

.hand img:nth-child(3) {
  transform: rotate(8deg);
}

/*
 * The fan deals its hands in turn, one on top at a time: a hand fades in over the one before it,
 * holds, then stays opaque beneath the next until that one has faded in, so the hand behind never
 * shows through. A turn is 5 s (a 1 s fade, then 4 s held), the cycle 8 turns (HAND_COUNT in
 * lib/site/hero.ts), 40 s. The first
 * hand is already in place when the page appears, and the second arrives 4 s later. Asked for
 * reduced motion, the first hand stays, and the others are not drawn (so not fetched).
 */
@media (prefers-reduced-motion: no-preference) {
  .hand {
    animation: fan-cycle 40s ease-in-out infinite both;
    animation-delay: calc(var(--turn) - 1s);
  }

  .hand:nth-child(1) {
    --turn: 0s;
  }

  .hand:nth-child(2) {
    --turn: 5s;
  }

  .hand:nth-child(3) {
    --turn: 10s;
  }

  .hand:nth-child(4) {
    --turn: 15s;
  }

  .hand:nth-child(5) {
    --turn: 20s;
  }

  .hand:nth-child(6) {
    --turn: 25s;
  }

  .hand:nth-child(7) {
    --turn: 30s;
  }

  .hand:nth-child(8) {
    --turn: 35s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hand + .hand {
    display: none;
  }
}

@keyframes fan-cycle {
  0% {
    opacity: 0;
    z-index: 2;
  }
  2.5% {
    opacity: 1;
    z-index: 2;
  }
  12.5% {
    opacity: 1;
    z-index: 2;
  }
  12.51% {
    opacity: 1;
    z-index: 1;
  }
  15% {
    opacity: 1;
    z-index: 1;
  }
  15.01% {
    opacity: 0;
    z-index: 1;
  }
  100% {
    opacity: 0;
    z-index: 1;
  }
}

/* ---------- what it makes, how it works ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid .wide {
  grid-column: 1 / -1;
}

.grid article {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px 22px;
}

.grid p {
  margin: 0;
  color: var(--muted);
}

.grid ul {
  margin: 6px 0 8px;
  padding-left: 20px;
  color: var(--muted);
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 56px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  display: grid;
  place-items: center;
  font-size: 19px;
}

.prompts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.prompts li {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--red);
  border-radius: 4px;
  padding: 14px 18px;
  font-style: italic;
}

.closing {
  margin-top: 64px;
  text-align: center;
}

/* ---------- plain pages ---------- */

.prose {
  max-width: 720px;
}

.prose h1 {
  font-size: 36px;
}

.prose h2 {
  margin-top: 40px;
}

.prose blockquote {
  background: var(--card);
  border-left: 3px solid var(--red);
  margin: 18px 0;
  padding: 12px 18px;
  font-style: italic;
}

.setup-steps {
  gap: 28px;
}

.setup-steps li {
  min-height: 38px;
}

.setup-action {
  margin: 16px 0 8px;
}

.capabilities {
  padding-left: 24px;
}

.capabilities li + li {
  margin-top: 7px;
}

kbd {
  background: var(--card);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82em;
  padding: 2px 6px;
  white-space: nowrap;
}

.credits {
  padding-left: 20px;
}

.credits li + li {
  margin-top: 10px;
}

.credits a {
  overflow-wrap: anywhere;
}

.draft {
  background: #fff4d6;
  border: 1px solid #e3c46a;
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 16px;
  margin: 0 0 28px;
}

@media (max-width: 760px) {
  h1 {
    font-size: 34px;
  }

  .hero,
  .grid,
  .prompts {
    grid-template-columns: 1fr;
  }
}

/* ---------- print (the whitepaper's own print styles hide its footer and masthead) ---------- */

@media print {
  .app-bar {
    display: none;
  }
}
