/* Fluid Software Development: the book's site.
   The look follows the book: Lora for text and Lato for headings (as in the PDF), the cover's navy,
   the cream paper of the illustrations, and the yellow of the agents. Light mode is the paper,
   dark mode is the cover. */

@font-face { font-family: "Lora"; font-weight: 400; font-style: normal; font-display: swap; src: url("/assets/fonts/lora-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 400; font-style: italic; font-display: swap; src: url("/assets/fonts/lora-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Lora"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/lora-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 400; font-display: swap; src: url("/assets/fonts/lato-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-display: swap; src: url("/assets/fonts/lato-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 900; font-display: swap; src: url("/assets/fonts/lato-latin-900-normal.woff2") format("woff2"); }

:root {
  color-scheme: light dark;

  /* From the book's art */
  --navy: #061c3b;
  --navy-deep: #04142c;
  --paper: #faefdf;
  --cream: #fdedd2;
  --agent: #f7b538;
  --agent-deep: #e99a1c;
  --teal: #0b6259;
  --coral: #c2481f;

  /* Light mode: the paper of the illustrations */
  --bg: var(--paper);
  --bg-raised: #fff7ea;
  --ink: #0a1d3d;
  --ink-soft: #45506a;
  --rule: rgb(10 29 61 / 0.16);
  --link: var(--teal);
  --focus: var(--coral);
  --shadow: 6 28 59;

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Lato", "Helvetica Neue", Arial, sans-serif;
  --measure: 40rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode: a lighter blue than the cover, so the cover stands out against the page */
    --bg: #1a3a64;
    --bg-raised: #234775;
    --ink: var(--cream);
    --ink-soft: #c5c4c2;
    --rule: rgb(253 237 210 / 0.2);
    --link: #7fd9cb;
    --focus: var(--agent);
    --shadow: 0 6 18;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.125rem/1.65 var(--serif);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--agent-deep);
  caret-color: var(--agent-deep);
}

::selection { background: var(--agent); color: var(--navy); }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.16em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--sans); color: var(--ink); text-wrap: balance; margin: 0; }
h1 { font-weight: 900; font-size: clamp(2.25rem, 1.4rem + 3.8vw, 3.5rem); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-weight: 900; font-size: clamp(1.5rem, 1.25rem + 1.1vw, 1.9rem); line-height: 1.15; letter-spacing: -0.01em; }
h3 { font-weight: 700; font-size: 1.2rem; line-height: 1.25; }
p { margin: 0 0 1em; text-wrap: pretty; }

.wrap { width: 100%; max-width: 70rem; margin-inline: auto; padding-inline: var(--gutter); }

.skip-link { position: absolute; left: var(--gutter); top: -4rem; z-index: 10; padding: 0.6rem 1rem; background: var(--agent); color: var(--navy); font: 700 1rem var(--sans); border-radius: 0 0 10px 10px; }
.skip-link:focus { top: 0; }

/* The button is drawn like one of the agents: yellow, with a navy outline. */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.8em 1.4em;
  background: var(--agent); color: var(--navy);
  border: 2px solid var(--navy-deep); border-radius: 14px;
  font: 900 1.05rem/1.2 var(--sans); text-decoration: none; letter-spacing: 0.005em;
  box-shadow: 0 2px 0 -1px rgb(var(--shadow) / 0.2), 0 10px 22px -12px rgb(var(--shadow) / 0.55);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.25s var(--ease);
}
.button:hover { background: #ffc552; transform: translateY(-2px); box-shadow: 0 3px 0 -1px rgb(var(--shadow) / 0.2), 0 16px 26px -12px rgb(var(--shadow) / 0.6); }
.button:active { transform: translateY(0); box-shadow: 0 1px 0 -1px rgb(var(--shadow) / 0.2), 0 4px 10px -6px rgb(var(--shadow) / 0.5); }
.button-small { padding: 0.5em 0.95em; font-size: 0.95rem; border-radius: 11px; }
@media (prefers-reduced-motion: reduce) { .button, .button:hover { transition: none; transform: none; } }

.text-link { font: 700 1.05rem var(--sans); }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font: 700 1.05rem/1.1 var(--sans); }
.brand img { width: 3rem; height: 3rem; flex: none; transition: transform 0.4s var(--ease); }
.brand:hover img { transform: rotate(-8deg) scale(1.06); }
.brand-fluid { font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; }
.site-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.1rem 1.25rem; }
.site-nav a:not(.button) { display: inline-block; padding: 0.45rem 0; color: var(--ink); font: 700 1rem var(--sans); text-decoration: none; background: linear-gradient(var(--agent), var(--agent)) no-repeat 0 calc(100% - 0.25rem) / 0 3px; transition: background-size 0.3s var(--ease); }
.site-nav a:not(.button):hover, .site-nav a[aria-current="page"] { background-size: 100% 3px; }
@media (prefers-reduced-motion: reduce) { .site-nav a:not(.button), .brand img { transition: none; } }

@media (max-width: 40rem) { .site-nav { gap: 0.1rem 1.25rem; } .site-nav ul { display: contents; } .site-nav li { list-style: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 1rem; }
.site-footer-inner { display: grid; gap: 1.25rem 3rem; padding-block: 2.5rem 3rem; }
.footer-title { margin: 0; font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.footer-by, .footer-legal { color: var(--ink-soft); font-weight: 400; font-size: 0.95rem; }
.footer-legal { margin: 0; }
.site-footer a { color: var(--ink); display: inline-block; padding: 0.3rem 0; text-decoration-color: var(--rule); }
.site-footer a:hover { text-decoration-color: var(--agent-deep); }
@media (min-width: 48rem) {
  .site-footer-inner { grid-template-columns: 1fr auto; align-items: start; }
  .footer-legal { grid-column: 1 / -1; }
}
main > :last-child:not(.book-cta) { padding-bottom: clamp(3rem, 8vw, 6rem); }

/* Landing page */
.hero { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3rem, 8vw, 6rem); overflow: clip; }
.hero-inner { display: grid; gap: clamp(2.5rem, 6vw, 5rem); align-items: center; }
.hero h1 { font-size: clamp(2rem, 1rem + 4.2vw, 3.6rem); font-weight: 700; line-height: 1.02; }
.hero h1 .brand-fluid { display: block; font-size: 1.85em; line-height: 0.92; letter-spacing: -0.02em; margin-left: -0.04em; }
.hero .lede { margin: 1.5rem 0 0; font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.45rem); line-height: 1.5; max-width: 32rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: 2rem; }
.hero-note { margin: 1.5rem 0 0; color: var(--ink-soft); font: 400 1rem/1.5 var(--sans); max-width: 30rem; }
.hero-cover { position: relative; justify-self: center; width: min(100%, 22rem); }
.hero-cover .cover { border-radius: 6px; transform: rotate(2.5deg); box-shadow: 0 1px 0 0 rgb(253 237 210 / 0.18) inset, 0 0 0 1px rgb(253 237 210 / 0.14), 0 2px 4px rgb(var(--shadow) / 0.25), 0 28px 50px -18px rgb(var(--shadow) / 0.6); }
.hero-cover .hero-agent { position: absolute; left: -3.25rem; bottom: -2rem; width: 7.5rem; }
@media (prefers-reduced-motion: no-preference) {
  .hero-cover .cover { animation: cover-settle 1.1s var(--ease) both; }
  .hero-cover .hero-agent { animation: agent-hop 0.9s 0.35s var(--ease) both; }
  @keyframes cover-settle { from { transform: rotate(-4deg) translateY(1.5rem); } }
  @keyframes agent-hop { from { transform: translate(-1.5rem, 1rem) rotate(-10deg); } }
}
@media (min-width: 52rem) {
  .hero-inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .hero-cover { width: min(100%, 25rem); justify-self: end; margin-right: 1rem; }
}
@media (max-width: 30rem) {
  .hero-cover { width: 74%; margin-left: 2.25rem; }
  .hero-cover .hero-agent { width: 5.5rem; left: -2.75rem; bottom: -1.5rem; }
}

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section > .wrap > h2, .section-text > h2 { margin-bottom: 1.1rem; max-width: 24ch; }
.section-text { max-width: var(--measure); }
.section-text > :last-child { margin-bottom: 0; }
.section-split { display: grid; gap: 2rem clamp(2rem, 5vw, 4.5rem); align-items: start; }
@media (min-width: 60rem) { .section-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* The band takes the cover's navy in both modes. */
.band { background: var(--navy); color: var(--cream); --ink: var(--cream); --ink-soft: #c5c4c2; --rule: rgb(253 237 210 / 0.22); --link: #7fd9cb; --focus: var(--agent); }
@media (prefers-color-scheme: dark) { .band { background: var(--navy); } }
.band-inner { display: grid; gap: 1.5rem clamp(2rem, 6vw, 5rem); align-items: center; }
.band-inner > div > p { max-width: 30rem; }
@media (min-width: 56rem) { .band-inner { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }

/* Illustrations sit on the page like they sit on the book's paper. In dark mode they keep their paper. */
figure { margin: 0; }
.figure img, .plate img { border-radius: 14px; background: var(--paper); }
figcaption { margin-top: 0.75rem; color: var(--ink-soft); font: 400 0.95rem/1.45 var(--sans); max-width: 38rem; }
.plate { margin-top: clamp(1.5rem, 4vw, 2.5rem); }
.plate figcaption { margin-inline: auto; text-align: center; }
@media (prefers-color-scheme: dark) { .figure img, .plate img { box-shadow: 0 18px 40px -20px rgb(var(--shadow) / 0.8); } }

/* "X over Y", as in the book */
.manifesto { margin: 0; padding: 0; border-block: 1px solid var(--rule); padding-block: 1.1rem; }
.manifesto p { margin: 0; padding: 0.42rem 0; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.35rem); line-height: 1.35; color: var(--ink-soft); text-wrap: balance; }
.manifesto strong { font: 900 1em var(--sans); color: var(--ink); }
.prose .manifesto { margin-block: 2rem; text-align: center; }

.parts, .start-here, .tool-list { list-style: none; margin: 0; padding: 0; }
.parts li, .start-here li, .tool-list li { padding: 1rem 0; border-top: 1px solid var(--rule); }
.parts li:last-child, .start-here li:last-child, .tool-list li:last-child { border-bottom: 1px solid var(--rule); }
.tool-role { display: block; font: 700 1.05rem/1.3 var(--sans); margin-bottom: 0.2rem; }
.parts strong, .start-here strong { font: 900 0.95em var(--sans); }
.statement { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); line-height: 1.08; letter-spacing: -0.02em; max-width: 16ch; }
.band h2 { margin-bottom: 1rem; }
.bookref { font-style: italic; }

.closing { text-align: left; }
.closing-inner { display: grid; gap: 1.5rem 3rem; align-items: center; }
.closing-inner img { width: 9rem; justify-self: start; }
@media (min-width: 48rem) { .closing-inner { grid-template-columns: minmax(0, 1fr) auto; } .closing-inner img { width: 12rem; } }

/* Reading pages */
.prose { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.prose > * { max-width: var(--measure); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; max-width: 52rem; margin-bottom: clamp(1.75rem, 4vw, 2.75rem); padding-bottom: clamp(1.25rem, 3vw, 2rem); border-bottom: 1px solid var(--rule); }
.page-head .lede { margin: 1rem 0 0; font-size: 1.25rem; line-height: 1.5; color: var(--ink-soft); max-width: 36rem; }
.page-head-spot { width: clamp(5rem, 16vw, 8.5rem); flex: none; margin-bottom: -0.25rem; }
.prose h2 { margin: 2.75rem 0 0.8rem; scroll-margin-top: 1.5rem; }
.prose h3 { margin: 2rem 0 0.6rem; }
.prose ul:not([class]), .prose ol:not([class]) { margin: 0 0 1.2em; padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--agent-deep); }
.prose blockquote:not(.manifesto) { margin: 1.5rem 0; padding-left: 1.25rem; font-style: italic; color: var(--ink-soft); }
.prose code { font-size: 0.9em; }
.spot-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin: 2.75rem 0 0.8rem; }
.spot-heading h2, .spot-heading h3 { margin: 0; }
.spot-heading img { width: 4.75rem; flex: none; }
.spot-end img { width: 6rem; margin: 2.5rem auto 0; }
.prose .figure { margin-block: 2rem; max-width: 52rem; }
.prose .figure.float-right { float: right; width: min(42%, 17rem); margin: 0.35rem 0 1rem 1.75rem; }
.prose .figure.align-left img { max-width: 12rem; }
.about .figure.float-right img { border-radius: 18px; background: none; }
.about .figure.float-right { margin-right: max(0px, calc(100% - 52rem)); }
.about h2 { clear: both; }
@media (max-width: 34rem) { .prose .figure.float-right { float: none; width: 60%; margin: 0 0 1.5rem; } }

.note-ref { font: 700 0.7em var(--sans); line-height: 0; }
.note-ref a { padding: 0.2em 0.25em; text-decoration: none; }
.notes { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-size: 1rem; }
.notes h2 { font-size: 1.1rem; margin: 0 0 0.6rem; letter-spacing: 0; }
.notes ol { margin: 0; padding-left: 1.3em; }
.note-back { font: 700 0.85rem var(--sans); margin-left: 0.35em; }
:target { scroll-margin-top: 1.5rem; }
.notes li:target, dt:target { background: linear-gradient(rgb(247 181 56 / 0.3), rgb(247 181 56 / 0.3)) no-repeat 0 100% / 100% 0.5em; }

/* Glossary: term on the left, definition next to it */
.glossary dl { margin: 0; max-width: 52rem; }
.glossary .entry { padding: 0.95rem 0; border-top: 1px solid var(--rule); }
.glossary .entry:last-child { border-bottom: 1px solid var(--rule); }
.glossary dt { font: 700 1.1rem/1.35 var(--sans); width: fit-content; }
.glossary dd { margin: 0.2rem 0 0; }
@media (min-width: 44rem) {
  .glossary .entry { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 0 2rem; align-items: baseline; }
  .glossary dd { margin: 0; grid-column: 2; }
}

.tools .tool-list { margin-block: 1.5rem 2rem; }
.tool-role { font-size: 1.1rem; }

/* Updates */
.updates { max-width: 52rem; }
.update { display: grid; gap: 0.25rem 2rem; padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.update:last-child { border-bottom: 1px solid var(--rule); }
.update time { font: 700 1rem/1.6 var(--sans); color: var(--ink-soft); }
.update h2 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.update-body > :last-child { margin-bottom: 0; }
@media (min-width: 44rem) { .update { grid-template-columns: 10rem minmax(0, 1fr); } .update time { padding-top: 0.2rem; } }

/* The block under a page that came from the book */
.book-cta { margin-top: clamp(3rem, 8vw, 5.5rem); background: var(--navy); color: var(--cream); --ink: var(--cream); --focus: var(--agent); }
@media (prefers-color-scheme: dark) { .book-cta { background: var(--navy-deep); } }
.book-cta-inner { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.5rem; align-items: center; padding-block: clamp(2rem, 5vw, 3rem); }
.book-cta img { border-radius: 4px; box-shadow: 0 0 0 1px rgb(253 237 210 / 0.16), 0 14px 26px -12px rgb(0 0 0 / 0.7); transform: rotate(-2deg); }
.book-cta h2 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.book-cta p { max-width: 34rem; margin-bottom: 1rem; }
.book-cta p:last-child { margin-bottom: 0; }
@media (min-width: 40rem) { .book-cta-inner { grid-template-columns: 8.5rem minmax(0, 1fr); gap: 2.5rem; } }

.not-found { padding-block: clamp(3rem, 10vw, 7rem); }
.not-found img { width: 10rem; margin-bottom: 1.5rem; }
.not-found p { max-width: 32rem; }

@media print {
  .site-header nav, .site-footer nav, .book-cta, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}
