/* elementsofstrategy.com — one stylesheet for all pages.
   Colours come from the cover: charcoal sheet, gold subtitle words, red-to-gold star. */

/* Self-hosted, Latin subsets from Google Fonts (OFL). EB Garamond stands in for the cover's
   Garamond Premier, Poppins SemiBold for Neulis Sans (the same pairing as the ebook). */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond-Italic-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/Poppins-SemiBold-latin.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #191819;          /* cover charcoal */
  --ink-soft: #46444a;
  --paper: #f5f5f3;
  --paper-2: #ebebe8;
  --hero: #d0d0ce;         /* render background at the left edge */
  --line: #d6d5d1;
  --on-dark: #ecebe8;
  --on-dark-soft: #c6c4bf;
  --gold: #a46322;         /* subtitle helper words on the cover */
  --gold-text: #7a4614;    /* the same gold, dark enough for small text on light grounds */
  --gold-light: #e0a94a;   /* for text on charcoal */
  --star: linear-gradient(90deg, #8c2a1d 0%, #b5562a 45%, #e3b23c 100%);

  --serif: "EB Garamond", Garamond, "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max: 72rem;
  --gutter: 1rem;
  color-scheme: light;
}

@media (min-width: 640px) {
  :root { --gutter: 1.5rem; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  position: relative;   /* the grain layer below spans the whole page */
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Film grain over the whole page, scrolling with it: Gaussian noise on neutral grey (tools/make_grain.py).
   One grain per screen pixel: the 200 px tile is shown at 200 / pixel-ratio CSS px.
   Hard light rather than overlay, so the grain also shows on the near-white and near-black sections. */
body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: url("/assets/img/grain.png") 0 0 / 200px 200px;
  mix-blend-mode: hard-light;
  opacity: 0.08;   /* strength */
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  body::after { background-size: 100px 100px; }
}

@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 3dppx) {
  body::after { background-size: 66.667px 66.667px; }
}

@media print, (prefers-contrast: more) {
  body::after { display: none; }
}

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

[hidden] { display: none !important; }   /* beats display rules like .signup's grid */

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--gold); }

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

h1, h2, h3 { font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--on-dark);
  font-family: var(--sans);
  font-size: 0.85rem;
}
.skip-link:focus { top: 0.75rem; }

/* Small capitals in the cover's sans, used for labels and the byline. */
.label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.5;
}

.it { font-style: italic; }
.nowrap { white-space: nowrap; }

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 5;
  background: var(--hero);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.wordmark {
  font-size: 1.3rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav a {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.nav a:not(.button):hover { color: var(--gold-text); }

.nav__links { display: none; gap: 1.75rem; }

@media (min-width: 900px) {
  .nav__links { display: flex; }
  .page-home .site-header {
    position: absolute;
    inset: 0 0 auto 0;
    background: transparent;
  }
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 3rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-dark);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.button:hover { background: #000; border-color: #000; }
.button:disabled { opacity: 0.6; cursor: default; }

.button--small { min-height: 2.4rem; padding: 0.6rem 1.1rem; font-size: 0.7rem; }

.button--ghost {
  background: transparent;
  color: var(--ink);
}
.button--ghost:hover { background: var(--ink); color: var(--on-dark); }

.button--gold {
  background: var(--gold-light);
  border-color: var(--gold-light);
  color: var(--ink);
}
.button--gold:hover { background: #ecbd66; border-color: #ecbd66; }

/* ---------- Hero ---------- */

.hero {
  background: var(--hero);
  overflow: hidden;
}

.hero__grid { display: grid; }

.hero__media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.hero__text { padding: 2.25rem var(--gutter) 3.5rem; container-type: inline-size; }

.eyebrow { margin-bottom: 1.25rem; color: var(--ink); }
.eyebrow .gold { color: var(--gold-text); }

/* Two words per line: each pair is nowrap, and "The Elements" (~5.1 em) must fit the text column. */
.hero h1 {
  font-size: clamp(3.1rem, 10vw, 5.75rem);
  font-size: min(clamp(3.1rem, 10vw, 5.75rem), 18.5cqi);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin-bottom: 1.9rem;
}

.byline {
  letter-spacing: 0.3em;
  margin-bottom: 1.75rem;
}

.lede {
  font-size: clamp(1.35rem, 2.4vw, 1.6rem);
  line-height: 1.5;
  max-width: 30rem;
  margin-bottom: 2rem;
}

/* equal-width buttons (each as wide as the widest), side by side once the text column fits them */
.actions {
  display: grid;
  width: max-content;
  max-width: 100%;
  gap: 0.75rem 1rem;
}

@container (min-width: 24rem) {
  .actions { grid-template-columns: repeat(2, 1fr); }
}

.formats {
  margin-top: 1.5rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

@media (min-width: 900px) {
  /* 0.9 : 1.2 split, but on screens wider than --max the text column keeps 29rem of text width */
  .hero__grid {
    grid-template-columns: max(42.857vw, (100vw - var(--max)) / 2 + var(--gutter) + 29rem) minmax(0, 1fr);
    min-height: min(92vh, 900px);
  }
  .hero__text {
    order: -1;
    align-self: center;
    padding: 7rem 0 4.5rem max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
  }
  .hero__media { position: relative; }
  /* Starts below the header so the book gets air above it; the left and top edges fade into the hero grey. */
  .hero__media img {
    position: absolute;
    inset: 4.5rem 0 0 0;
    height: calc(100% - 4.5rem);
    aspect-ratio: auto;
    object-position: 50% 40%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24%), linear-gradient(180deg, transparent 0, #000 14%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(90deg, transparent 0, #000 24%), linear-gradient(180deg, transparent 0, #000 14%);
    mask-composite: intersect;
  }
}

/* ---------- Sections ---------- */

.section { padding: clamp(4rem, 9vw, 7.5rem) 0; }

.section--dark {
  background: var(--ink);
  color: var(--on-dark);
}

.section--tint { background: var(--paper-2); }

.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 3.5rem); }

.section-head .label { color: var(--gold-text); margin-bottom: 1rem; }
.section--dark .section-head .label { color: var(--gold-light); }

.section h2 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.005em;
}

.rule {
  width: 5.5rem;
  height: 2px;
  margin: 1.75rem 0 0;
  border: 0;
  background: var(--star);
}

/* The three questions */

.questions {
  list-style: none;
  margin: 0 0 clamp(2.5rem, 6vw, 4rem);
  padding: 0;
  display: grid;
  gap: 2rem;
}

.questions li {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(236, 235, 232, 0.18);
  position: relative;
}

.questions li::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--star);
}

.questions .label { color: var(--gold-light); font-size: 0.78rem; margin-bottom: 0.75rem; }

.questions p {
  font-size: clamp(1.5rem, 2.6vw, 1.8rem);
  line-height: 1.35;
  margin: 0;
}

@media (min-width: 760px) {
  .questions { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
}

.prose { max-width: 40rem; }
.prose p { font-size: 1.32rem; }
.section--dark .prose p { color: var(--on-dark-soft); }
.section--dark .prose p em { color: var(--on-dark); }

/* Key video (a plain link, opens YouTube in a new tab) */

.watch {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 2.5rem;
  color: var(--on-dark);
  text-decoration: none;
}

/* YouTube's rules: at least 24 px tall, clear space of at least the triangle's size, no effects. */
.watch__icon { flex: none; width: 3.5rem; height: auto; position: relative; z-index: 101; }   /* above the grain */

.watch .label { display: block; color: var(--gold-light); margin-bottom: 0.35rem; }
.watch__title { display: block; font-size: 1.5rem; line-height: 1.25; }
.watch:hover .watch__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

/* Contents */

.chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0 2.5rem;
  counter-reset: chapter;
}

.chapters li {
  counter-increment: chapter;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.chapters li::before {
  content: counter(chapter, decimal-leading-zero);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--gold-text);
  padding-top: 0.35rem;
}

.chapters strong { display: block; font-weight: 400; font-size: 1.4rem; line-height: 1.3; }
.chapters span { display: block; font-style: italic; color: var(--ink-soft); font-size: 1.1rem; }

@media (min-width: 700px) {
  .chapters { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(8, auto); grid-auto-flow: column; }
}

@media (min-width: 1040px) {
  .chapters { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(5, auto); }
}

/* Get the book */

.buy {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.buy__cover {
  width: min(16rem, 62vw);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 18px 40px -12px rgba(25, 24, 25, 0.45);
}

/* one column of equal-width buttons */
.editions {
  display: grid;
  gap: 0.75rem;
  width: min(100%, 18rem);
  margin-top: 2rem;
}

@media (min-width: 800px) {
  .buy { grid-template-columns: auto 1fr; gap: 4.5rem; }
}

/* Author */

.author {
  display: grid;
  gap: 2.5rem;
}

.author .prose p:first-child { font-size: 1.55rem; line-height: 1.5; color: var(--ink); }

.contact {
  padding: 1.5rem 1.25rem;
  background: var(--paper-2);
  border-top: 2px solid transparent;
  border-image: var(--star) 1;
  align-self: start;
}

.contact .label { color: var(--gold-text); margin-bottom: 0.75rem; }
.contact p { font-size: 1.15rem; }
.contact a { overflow-wrap: break-word; }

@media (min-width: 860px) {
  .author { grid-template-columns: 1.4fr 1fr; gap: 4.5rem; }
}

/* Newsletter */

.newsletter {
  display: grid;
  gap: 2rem;
  align-items: end;
}

.newsletter p { color: var(--on-dark-soft); }

.signup { display: grid; gap: 0.75rem; }

.signup__row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.signup input[type="email"] {
  flex: 1 1 14rem;
  min-height: 3rem;
  padding: 0.75rem 1.1rem;
  border: 1px solid rgba(236, 235, 232, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--on-dark);
  font: inherit;
  font-size: 1.15rem;
}

.signup input::placeholder { color: #8f8d88; }
.signup input:focus { outline: none; border-color: var(--gold-light); }

.fineprint { font-size: 0.95rem; line-height: 1.5; color: #9d9b96; margin: 0; }
.fineprint a { color: var(--on-dark-soft); }

.signup__status { margin: 0; font-size: 1.05rem; color: var(--gold-light); }
.signup__status:empty { display: none; }

/* Shown in place of the form once Kit has the address (site.js). */
.signup-done:focus { outline: none; }
.signup-done .label { color: var(--gold-light); margin-bottom: 0.75rem; }
.signup-done__title { font-size: 1.8rem; margin-bottom: 0.5rem; }
.signup-done p:not(.label) { margin-bottom: 1.5rem; }

@media (min-width: 860px) {
  .newsletter { grid-template-columns: 1fr 1fr; gap: 4.5rem; }
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 2.5rem 0 3rem;
  background: var(--ink);
  color: var(--on-dark-soft);
  border-top: 1px solid rgba(236, 235, 232, 0.12);
  font-size: 1.05rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }

/* ---------- Text pages (Impressum, privacy, 404) ---------- */

.doc { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(4rem, 8vw, 6rem); }

/* Short text pages (thanks, welcome, 404): keep the footer at the bottom of the window. */
body:has(> main.doc) { display: flex; flex-direction: column; }
main.doc { flex: 1; }
.doc .container { max-width: 46rem; }
.doc h1 { font-size: clamp(2.4rem, 5.5vw, 3.3rem); margin-bottom: 0.5rem; }
.doc .subtitle { color: var(--ink-soft); margin-bottom: 2.5rem; }
.doc h2 { font-size: 1.6rem; margin: 2.5rem 0 0.75rem; }
.doc h3 { font-size: 1.25rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }
.doc p, .doc li { font-size: 1.15rem; }
.doc ul { padding-left: 1.2rem; }
.doc address { font-style: normal; margin-bottom: 1em; }
