/* ==========================================================================
   Augmenting Decision: site styles
   One stylesheet for every page. Colors and fonts are set once in :root.
   ========================================================================== */

/* Fonts (self-hosted, no third-party requests) ---------------------------- */
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Design tokens ------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  --paper: #f7f4ee;
  --paper-alt: #efeae1;
  --card: #fbf9f5;
  --ink: #131a26;
  --ink-soft: #364154;
  --muted: #5b6475;
  --line: rgba(19, 26, 38, 0.12);
  --dot: rgba(19, 26, 38, 0.17);

  --navy: #10203a;
  --on-navy: #f7f4ee;
  --on-navy-muted: #b9c6da;
  --on-navy-line: rgba(247, 244, 238, 0.16);

  --accent: #ff6a3d;
  --accent-hover: #ff8259;
  --on-accent: #0b1626;
  --accent-text: #b33f19;
  --accent-on-navy: #ff8a65;
  --focus: #2f6fed;
  --error: #b3261e;
  --todo: rgba(255, 106, 61, 0.16);

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --container: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 14px;
  --section-space: clamp(4rem, 9vw, 7.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1220;
    --paper-alt: #0f1828;
    --card: #131e32;
    --ink: #eef0f4;
    --ink-soft: #ccd3df;
    --muted: #9da8bb;
    --line: rgba(238, 240, 244, 0.12);
    --dot: rgba(238, 240, 244, 0.13);

    --navy: #12233e;
    --accent-text: #ff9b78;
    --focus: #8fb3ff;
    --error: #ff8f87;
    --todo: rgba(255, 106, 61, 0.24);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font: 400 1.0625rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p,
ul,
ol {
  margin: 0;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

cite {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.06em;
}

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

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -10rem;
  left: 1rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}

/* Placeholder text you still need to replace. Search the HTML for class="todo". */
.todo {
  background: var(--todo);
  border-radius: 4px;
  padding: 0 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn--small {
  padding: 0.6rem 1.05rem;
  font-size: 0.9rem;
}

/* Header ------------------------------------------------------------------- */
.site-header {
  position: relative;
  z-index: 2;
  padding-block: 1.25rem;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img {
  width: 1.75rem;
  height: 1.75rem;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}
.site-nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang {
  display: flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang a {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.lang a:hover {
  color: var(--ink);
}
.lang a[aria-current] {
  background: var(--ink);
  color: var(--paper);
}

@media (max-width: 52rem) {
  .site-nav {
    display: none;
  }
  .header-actions {
    margin-left: auto;
  }
}
@media (max-width: 32rem) {
  .header-actions .btn {
    display: none;
  }
}

/* Hero --------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(2rem, 5vw, 4.5rem) clamp(4rem, 8vw, 7rem);
}

/* Faint "data field" of dots behind the hero. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.1px, transparent 0);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(55% 65% at 78% 45%, #000 0%, transparent 78%);
  mask-image: radial-gradient(55% 65% at 78% 45%, #000 0%, transparent 78%);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 6rem);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent-text);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.status__dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}
@media (max-width: 30rem) {
  /* Keep the label on one line on phones: just "Coming soon". */
  .status__lead {
    display: none;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 106, 61, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 10px rgba(255, 106, 61, 0);
  }
}

.hero__title {
  font-size: clamp(3rem, 1.5rem + 5.6vw, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.hero__subtitle {
  margin-top: 1.25rem;
  max-width: 32ch;
  text-wrap: balance;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.85rem);
  font-style: italic;
  line-height: 1.3;
}

.hero__lead {
  margin-top: 1.5rem;
  max-width: 36rem;
  font-size: 1.125rem;
}

/* 3D book. To show the real cover, replace assets/img/cover.webp. */
.hero__book {
  position: relative;
  display: grid;
  place-items: center;
  perspective: 1800px;
}
.hero__book::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 85%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 106, 61, 0.22), rgba(255, 106, 61, 0) 68%);
}

.book {
  --thickness: 24px;
  position: relative;
  width: min(100%, 21.5rem);
  transform: rotateY(-20deg) rotateX(3deg);
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.book:hover {
  transform: rotateY(-9deg) rotateX(2deg);
}
.book__cover {
  position: relative;
  width: 100%;
  border-radius: 2px 6px 6px 2px;
  transform: translateZ(calc(var(--thickness) / 2));
  box-shadow:
    0 2px 3px rgba(11, 22, 38, 0.12),
    0 24px 40px -14px rgba(11, 22, 38, 0.5),
    0 50px 80px -30px rgba(11, 22, 38, 0.45);
}
@media (prefers-color-scheme: dark) {
  /* A navy cover on a dark page needs a faint edge and a warmer glow to stand out. */
  .book__cover {
    box-shadow:
      0 0 0 1px rgba(238, 240, 244, 0.1),
      0 24px 40px -14px rgba(0, 0, 0, 0.7),
      0 50px 90px -30px rgba(0, 0, 0, 0.75);
  }
  .hero__book::before {
    background: radial-gradient(circle, rgba(255, 106, 61, 0.2), rgba(70, 110, 170, 0.12) 45%, rgba(70, 110, 170, 0) 70%);
  }
}
/* Spine highlight on the left edge of the cover. */
.book::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6%;
  border-radius: 2px 0 0 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.22) 80%, rgba(255, 255, 255, 0.05));
  transform: translateZ(calc(var(--thickness) / 2 + 0.5px));
  pointer-events: none;
}
/* Edge of the pages, on the right-hand side of the book. */
.book::after {
  content: "";
  position: absolute;
  top: 1.2%;
  bottom: 1.2%;
  left: calc(100% - var(--thickness) / 2 - 2px);
  width: var(--thickness);
  background: repeating-linear-gradient(90deg, #f6f2ea 0 2px, #d8d0c1 2px 3px);
  transform: rotateY(90deg);
}

@media (max-width: 52rem) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero__book {
    padding-block: 1rem 0;
  }
  .book {
    width: min(70%, 17rem);
  }
}

/* Sign-up form --------------------------------------------------------------- */
.signup {
  max-width: 34rem;
  margin-top: 2.25rem;
}

.signup__row {
  display: flex;
  gap: 0.5rem;
  padding: 0.375rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(11, 22, 38, 0.05), 0 12px 28px -18px rgba(11, 22, 38, 0.35);
}
.signup__row:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.signup__input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.signup__input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.signup__input:focus {
  outline: none;
}
.signup .btn:focus-visible {
  outline-offset: 2px;
}

.signup__note {
  margin-top: 0.85rem;
  padding-inline: 1.1rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.signup__note a {
  color: inherit;
}

.signup__status {
  margin-top: 0.5rem;
  padding-inline: 1.1rem;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
}
.signup__status:empty {
  margin: 0;
}
.signup[data-state="error"] .signup__status {
  color: var(--error);
}

/* Variant used on dark (navy) backgrounds. */
.signup--on-dark {
  margin-inline: auto;
}
.signup--on-dark .signup__row {
  border-color: var(--on-navy-line);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}
.signup--on-dark .signup__input {
  color: var(--on-navy);
}
.signup--on-dark .signup__input::placeholder,
.signup--on-dark .signup__note {
  color: var(--on-navy-muted);
}
.signup--on-dark .signup__status {
  color: var(--on-navy);
}
.signup--on-dark[data-state="error"] .signup__status {
  color: #ffb4a8;
}

@media (max-width: 30rem) {
  .signup__row {
    flex-direction: column;
    border-radius: var(--radius);
  }
  .signup__input {
    padding-block: 0.85rem;
  }
}

/* Dark band with a statement --------------------------------------------- */
.band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--navy);
  color: var(--on-navy-muted);
}
.band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 1px 1px, rgba(185, 198, 218, 0.16) 1.1px, transparent 0);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
}
.band h2 {
  color: var(--on-navy);
}

.statement {
  padding-block: clamp(4rem, 9vw, 7rem);
}
.statement__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 2rem;
}
/* The book's "data converging into a decision" motif, on the right. */
.statement__art {
  aspect-ratio: 3 / 2;
  background: url("../img/motif.svg") center / contain no-repeat;
}
@media (max-width: 52rem) {
  .statement__inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .statement__art {
    display: none;
  }
}
.statement p {
  max-width: 24ch;
  color: var(--on-navy);
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 1.2rem + 2.9vw, 3.6rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.statement em {
  color: var(--accent-on-navy);
}

/* Sections ----------------------------------------------------------------- */
.section {
  padding-block: var(--section-space);
}
.section--alt {
  background: var(--paper-alt);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.kicker::before {
  content: "";
  flex: none;
  width: 1.75rem;
  height: 2px;
  background: var(--accent);
}

.section h2 {
  font-size: clamp(2rem, 1.35rem + 2.6vw, 3.25rem);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 6rem);
}

.prose > * + * {
  margin-top: 1.25em;
}
.prose p {
  font-size: 1.125rem;
}
.prose p:first-child {
  color: var(--ink);
}

@media (max-width: 52rem) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }
}

/* Themes ("Inside the book") */
.section__head {
  max-width: 40rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.themes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  padding: 0;
  list-style: none;
}
.theme {
  padding: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.theme__num {
  display: block;
  margin-bottom: 1.25rem;
  color: var(--accent-text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
}
.theme h3 {
  font-size: clamp(1.4rem, 1.2rem + 0.6vw, 1.7rem);
}
.theme p {
  margin-top: 0.75rem;
  color: var(--muted);
}

@media (max-width: 44rem) {
  .themes {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Audience ("Written for") */
.audience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  gap: 1.5rem 3rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}
.audience h3 {
  font-size: 1.6rem;
}
.audience ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem 2rem;
  padding: 0;
  list-style: none;
}
.audience li {
  color: var(--muted);
}
.audience strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 52rem) {
  .audience,
  .audience ul {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Author */
.author {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}
.author__photo {
  width: 100%;
  max-width: 22rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
}
/* Shown until a real portrait is added (see README). */
.author__photo--placeholder {
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  background: var(--paper-alt);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}
.author h2 {
  margin-bottom: 1.25rem;
}

@media (max-width: 52rem) {
  .author {
    grid-template-columns: minmax(0, 1fr);
  }
  .author__photo {
    max-width: 16rem;
  }
}

/* Final call to action */
.cta {
  max-width: 44rem;
  text-align: center;
}
.cta h2 {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.75rem);
}
.cta > p {
  margin: 1.25rem auto 0;
  max-width: 34rem;
  font-size: 1.125rem;
}
.cta .signup__note,
.cta .signup__status {
  text-align: center;
}

/* Legal page --------------------------------------------------------------- */
.page {
  padding-block: clamp(2.5rem, 6vw, 5rem) var(--section-space);
}
.page__inner {
  max-width: 44rem;
}
.page h1 {
  margin-bottom: 2.5rem;
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
}
.page h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.75rem;
}
.page h3 {
  margin: 1.75rem 0 0.5rem;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
}
.page p + p,
.page p + ul,
.page ul + p {
  margin-top: 1em;
}
.page ul {
  padding-left: 1.25rem;
}
.page li + li {
  margin-top: 0.35em;
}
.page address {
  font-style: normal;
}
.page .updated {
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Footer ------------------------------------------------------------------- */
.site-footer {
  padding-block: 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.site-footer .brand {
  font-size: 1.05rem;
}
.site-footer .brand img {
  width: 1.5rem;
  height: 1.5rem;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.site-footer a {
  text-decoration: none;
}
.site-footer nav a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Reduced motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
