/* Shared styles for every page except the home page, which inlines its
   own. Tokens and type mirror index.html so the pages read as one site.
   The regions between @include and @end are copied from partials/ by
   scripts/sync-components.py; edit the partial, not this file. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin-variable-v17.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #68686d;
  --body: #3d3d43;
  --soft: #FAF9F6;
  --line: #e3e3e6;
  --rule: #d6d6da;
  --cover-blue: #2245ff;
  /* Filled-in answers: typed, in a deeper blue than the cover's, so they
     read as someone's input next to the DM Sans labels. */
  --answer: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --answer-ink: #1a2f99;
  --serif: Charter, Georgia, "Times New Roman", serif;
  --shell: 1080px;
  --reading: 700px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: #a8a8ad; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--ink); }
a:focus-visible, button:focus-visible, [contenteditable]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.shell { width: min(calc(100% - 48px), var(--shell)); margin-inline: auto; }

/* Header */
.site-top { border-bottom: 1px solid var(--line); }
.site-top .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.site-top a { text-decoration: none; }
.site-brand { font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.site-nav { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }

/* Page head */
.crumbs { margin: 28px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: #b5b5ba; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { padding: 36px 0 8px; }
.kicker { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 620;
  letter-spacing: -.05em;
  line-height: .98;
  text-wrap: balance;
}
.lead {
  max-width: 60ch;
  margin: 20px 0 0;
  color: var(--body);
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 20px);
  line-height: 1.55;
  letter-spacing: 0;
}

/* Buttons, same shapes as the home page */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 22px;
  border: 0;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease;
}
.btn:hover { background: #000; text-decoration: none; }
.btn svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-line {
  border: 1px solid #c9c9ce;
  background: none;
  color: var(--ink);
  font-weight: 600;
}
.btn-line:hover { border-color: var(--ink); background: var(--soft); }
.actions-note { flex-basis: 100%; margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* Reading sections under a template or tool */
.page-body { padding: 56px 0 0; }
.prose { max-width: var(--reading); }
.prose h2 { margin: 48px 0 0; font-size: clamp(26px, 3vw, 32px); font-weight: 600; letter-spacing: -.045em; line-height: 1.08; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 28px 0 0; font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
.prose p, .prose li { color: var(--body); font-family: var(--serif); font-size: 18px; line-height: 1.6; letter-spacing: 0; }
.prose p { margin: 14px 0 0; }
.prose ol, .prose ul { margin: 16px 0 0; padding-left: 1.3em; }
.prose li { margin: 8px 0 0; padding-left: 4px; }
.prose li::marker { color: var(--muted); font-family: "DM Sans", sans-serif; font-weight: 600; }
.prose strong { color: var(--ink); }
.prose blockquote { margin: 18px 0 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--ink); }
.prose blockquote p { margin: 8px 0 0; }
.prose blockquote p:first-child { margin-top: 0; }
.source { margin: 20px 0 0; color: var(--muted); font-size: 14px; }

/* A list of links with a label, title and blurb: /templates and /tools */
.tpl-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin: 40px 0 0; padding: 0; list-style: none; }
.tpl-list li { padding: 22px 0 26px; border-top: 1px solid var(--line); }
.tpl-list .ch { color: #9a9aa0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.tpl-list h2 { margin: 14px 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.tpl-list h2 a { text-decoration: none; }
.tpl-list h2 a:hover { text-decoration: underline; }
.tpl-list p { margin: 0; color: var(--body); font-size: 16px; line-height: 1.55; }
.tpl-list .more { display: inline-block; margin-top: 10px; font-size: 14px; font-weight: 600; }

/* Closing call to action, like the home page's dark band */
.cta { margin: 72px 0 0; padding: clamp(28px, 5vw, 52px); background: var(--ink); color: #fff; }
.cta h2 { margin: 0; font-size: clamp(24px, 2.6vw, 30px); font-weight: 600; letter-spacing: -.04em; line-height: 1.1; }
.cta p { max-width: 58ch; margin: 12px 0 0; color: #b9bdc8; }
.cta .actions { margin-top: 24px; }
.cta .btn { background: #fff; color: var(--ink); }
.cta .btn:hover { background: #ededee; }
.cta .btn-line { border-color: #5c5f6b; background: none; color: #fff; }
.cta .btn-line:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
.cta a:focus-visible { outline-color: #fff; }

.site-foot { margin-top: 64px; padding: 26px 0 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-foot p { margin: 0; }

/* Kindle pre-order card, shared with the home page. Right after it, the
   closing call to action doesn't need its own top margin. */
.preorder + .shell > .cta { margin-top: 0; }
/* @include object3d.css */
/* Every [data-tilt] element (the home page's book cover, the Kindle in the
   pre-order card) is a real 3D object: a resting angle, an intro swing, a
   slow idle sway, and the pointer tilt from tilt.js on top. Each part has its
   own registered property so they add up instead of fighting. */
@property --sway { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --in-ry { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --in-z { syntax: "<length>"; inherits: false; initial-value: 0px; }
[data-tilt] {
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  --base-ry: 0deg;
  --base-rx: 0deg;
  transform:
    translate3d(0, var(--lift), var(--in-z))
    rotateX(calc(var(--base-rx) + var(--rx)))
    rotateY(calc(var(--base-ry) + var(--ry) + var(--sway) + var(--in-ry)));
  transform-style: preserve-3d;
  will-change: transform;
}
[data-tilt].tilt-near { animation-play-state: paused; }
@keyframes stage-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes book-sway {
  0%, 100% { --sway: 0deg; }
  30% { --sway: -7deg; }
  70% { --sway: 5deg; }
}
/* @end */
/* @include preorder.css */
/* Pre-order card. Hidden until amazon.js sets the Amazon URL,
   so the page is safe to deploy before the KDP link exists. */
.preorder { padding: clamp(58px, 7vw, 88px) 0; }
.preorder-card {
  display: grid;
  perspective: 1100px;
  max-width: 920px;
  margin-inline: auto;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(30px, 4vw, 60px);
  align-items: center;
  padding: clamp(26px, 3.2vw, 44px);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E") repeat,
    radial-gradient(120% 140% at 12% 0%, #fffefb 0%, #fbfaf7 60%, #f7f5f0 100%);
  background-size: 160px 160px, auto;
}
/* A Kindle Paperwhite-style reader: flat black front with even bezels,
   a slightly thicker bottom with the wordmark, a recessed matte screen,
   and a visible side edge because it is turned. */
.device-stage { perspective: 1100px; }
.device {
  --base-ry: -18deg;
  --base-rx: 3deg;
  position: relative;
  width: clamp(170px, 17vw, 208px);
  padding: 13px 12px 30px;
  border-radius: 16px;
  background:
    radial-gradient(140% 90% at 20% 0%, #2c2c30 0%, #18181b 55%, #0e0e10 100%);
  box-shadow:
    calc(var(--nx, 0) * -14px + 14px) calc(32px + var(--ny, 0) * 8px) 50px -22px rgba(0, 0, 0, .55),
    0 1px 0 rgba(255, 255, 255, .12) inset;
  /* a transparent outline makes Chrome anti-alias the turned edges */
  outline: 1px solid transparent;
  backface-visibility: hidden;
}
.device::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  right: 1px;
  width: 6px;
  transform-origin: right center;
  transform: rotateY(-90deg);
  border-radius: 3px;
  outline: 1px solid transparent;
  background: linear-gradient(90deg, #0b0b0c, #1e1e22 50%, #0b0b0c);
}
.device-screen {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: #f3f2ee;
  outline: 1px solid transparent;
}
.device-screen img {
  display: block;
  width: 100%;
  height: auto;
  /* a colour e-ink panel is a little softer than a phone screen */
  filter: saturate(.88) contrast(1.02);
}
.device-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(100% 80% at
      calc(50% + var(--nx, 0) * 34%) calc(40% + var(--ny, 0) * 24%),
      rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, rgba(0, 0, 0, .06), rgba(0, 0, 0, 0) 8%);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .18);
}
.device-logo {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .42);
  pointer-events: none;
}
html.js .device-stage:not(.in-view) { opacity: 0; }
.device-stage.in-view { animation: stage-in .3s ease-out both; }
.device-stage.in-view .device {
  animation:
    device-in 2s cubic-bezier(.45, .1, .2, 1) both,
    device-float 7s ease-in-out 2s infinite,
    book-sway 12s ease-in-out 2s infinite;
}
.preorder-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.preorder-body h2 {
  margin: 12px 0 0;
  font-size: clamp(25px, 2.4vw, 32px);
  font-weight: 620;
  letter-spacing: -.042em;
  line-height: 1.05;
}
.preorder-price {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 0;
}
.preorder-price strong {
  font-size: clamp(30px, 3vw, 38px);
  font-weight: 640;
  letter-spacing: -.05em;
  line-height: 1;
}
.preorder-price span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.01em;
}
.preorder-price s {
  color: var(--muted);
  font-size: clamp(18px, 1.7vw, 22px);
  font-weight: 500;
  letter-spacing: -.03em;
  text-decoration-thickness: 2px;
}
.preorder-price { flex-wrap: wrap; }
.reading-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 0;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.reading-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cover-blue); }
.preorder-price-note { margin: 12px 0 0; max-width: 44ch; color: var(--ink); font-size: 15px; line-height: 1.5; }
.preorder-actions { margin: 22px 0 0; }
.btn-amazon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 13px 26px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.btn-amazon:hover { background: #000; transform: translateY(-2px); text-decoration: none; }
.btn-amazon svg { width: 15px; height: 15px; flex: none; }
.preorder-reassure { margin: 14px 0 0; max-width: 44ch; color: var(--muted); font-size: 13px; line-height: 1.5; }
@keyframes device-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
@keyframes device-in {
  0% { --in-ry: 70deg; --in-z: -220px; }
  62% { --in-ry: -7deg; --in-z: 0px; }
  82% { --in-ry: 2deg; }
  100% { --in-ry: 0deg; --in-z: 0px; }
}
@media (max-width: 820px) {
  .preorder { padding: 56px 0; }
  .preorder-card { grid-template-columns: 1fr; gap: 30px; }
  .device-stage { justify-self: center; }
  .btn-amazon { width: 100%; justify-content: center; }
  .preorder-reassure { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .device-stage, .device-stage.in-view,
  .device-stage .device { animation: none !important; opacity: 1 !important; }
}
/* @end */

@media (max-width: 820px) {
  .shell { width: min(calc(100% - 32px), var(--shell)); }
  .tpl-list { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .site-brand { font-size: 14px; }
  .actions .btn { flex: 1 1 100%; }
  .prose p, .prose li { font-size: 17px; }
}

/* On paper, only the page's own content. */
@media print {
  body { background: #fff; }
  .noprint, .site-top, .site-foot, .cta, .preorder { display: none !important; }
  .shell { width: 100%; }
  a { text-decoration: none; }
}
