/* aliciakingbooks.com
   One stylesheet for every page. Colours live in :root, so a palette
   change happens in one place. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-600-normal.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --desk: #EDF1F6;        /* page background */
  --paper: #FFFFFF;       /* the worksheet */
  --ink: #1A2447;         /* ballpoint navy: text, lines, borders */
  --ink-soft: #4A5474;    /* secondary text */
  --rule: #C6D2E4;        /* faint printed lines */
  --margin: #E4A1A1;      /* worksheet margin line */
  --mark: #FFE14A;        /* highlighter: buttons, focus, the tick */
  --mark-strong: #FFD41A;
  --error: #B3261E;
  --radius: 6px;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
}

main { flex: 1 0 auto; }

h1, h2, h3 {
  margin: 0;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p, ul { margin: 0; }

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:not(.btn):hover {
  background: linear-gradient(transparent 58%, var(--mark) 58%);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.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;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 48rem) {
  .wrap { padding-inline: 32px; }
}

/* ---------- Header and footer ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 22px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark:hover { background: none; }

.mark { width: 26px; height: 26px; flex: none; }
.mark rect { fill: var(--mark); stroke: var(--ink); stroke-width: 2; }
.mark path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header nav a {
  font-size: 1rem;
  font-weight: 600;
}

.site-footer {
  position: relative;
  display: grid;
  gap: 6px;
  padding-block: 28px 40px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
}
/* The rule lines up with the content, not the page edge. */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1.5px;
  background: var(--rule);
}
@media (min-width: 48rem) {
  .site-footer::before { left: 32px; right: 32px; }
}
.site-footer p { max-width: 44rem; }

/* ---------- Shared text ---------- */

.lede {
  margin-top: 22px;
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  line-height: 1.5;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 22px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--mark);
  color: var(--ink);
  font: 700 1.0625rem/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--mark-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { cursor: progress; opacity: 0.75; }

.btn-quiet { background: transparent; }
.btn-quiet:hover { background: var(--paper); }

.btn-wide {
  width: 100%;
  margin-top: 28px;
}

.text-button {
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  gap: 40px;
  padding-block: clamp(24px, 6vw, 72px) clamp(56px, 8vw, 104px);
}
@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    align-items: center;
    column-gap: 80px;
  }
}
.hero h1 {
  font-size: clamp(2.5rem, 1.3rem + 3.8vw, 4.1rem);
}

/* ---------- Home: books ---------- */

.books {
  display: grid;
  gap: 56px;
  padding-block: 0 88px;
}
@media (min-width: 52rem) {
  .books {
    grid-template-columns: 1fr 1fr;
    column-gap: 56px;
  }
}

.book {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 24px;
  border-top: 5px solid var(--ink);
}
.book h3 { font-size: clamp(1.7rem, 1.25rem + 1.5vw, 2.25rem); }
.book-sub {
  margin-top: -4px;
  color: var(--ink-soft);
  font-weight: 600;
}
.book-hook {
  margin-top: 6px;
  font-size: 1.3rem;
  line-height: 1.45;
}
.book-goal { max-width: 32rem; }
.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

/* Optional cover image: see the comment in index.html */
.cover {
  width: 132px;
  height: auto;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
}

/* ---------- Home: about ---------- */

.about {
  display: grid;
  gap: 28px;
  align-items: start;
  padding-block: 0 88px;
}
.portrait {
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
}
.about-text {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1.5px solid var(--ink);
}
.about-text h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.about-text p { max-width: 38rem; }
@media (min-width: 52rem) {
  .about {
    grid-template-columns: 300px minmax(0, 1fr);
    column-gap: 56px;
  }
}

/* ---------- Toolkit pages ---------- */

.kit {
  display: grid;
  gap: 40px;
  grid-template-areas: "head" "form" "inside";
  padding-block: clamp(20px, 5vw, 64px) clamp(56px, 8vw, 96px);
}
.kit-head { grid-area: head; }
.kit-form { grid-area: form; }
.kit-inside { grid-area: inside; }
@media (min-width: 60rem) {
  .kit {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-areas: "head form" "inside form";
    align-items: start;
    column-gap: 80px;
    row-gap: 48px;
  }
}
.kit-head h1 { font-size: clamp(2.3rem, 1.3rem + 3.8vw, 4.1rem); }

.inside-title {
  margin-bottom: 10px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.inside {
  padding: 0;
  list-style: none;
}
.inside li {
  display: grid;
  gap: 2px;
  padding-block: 14px;
  border-top: 1.5px solid var(--rule);
}
.inside li:last-child { border-bottom: 1.5px solid var(--rule); }
.inside strong { font-weight: 700; }
.inside span { color: var(--ink-soft); }

.also { padding-bottom: 56px; }
.also p {
  padding-top: 20px;
  border-top: 1.5px solid var(--ink);
}

/* ---------- The worksheet (signup form) ---------- */

/* Two sheets peek out underneath: a small stack of printables. */
.stack {
  position: relative;
  isolation: isolate;
  margin: 0 14px 14px 0;
}
.stack::before,
.stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}
.stack::before { transform: translate(7px, 7px); z-index: -1; }
.stack::after { transform: translate(14px, 14px); z-index: -2; }

.sheet {
  position: relative;
  padding: 28px 22px 26px 52px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background:
    radial-gradient(circle closest-side, var(--desk) 70%, var(--rule) 74% 92%, transparent 96%) 10px 20% / 16px 16px no-repeat,
    radial-gradient(circle closest-side, var(--desk) 70%, var(--rule) 74% 92%, transparent 96%) 10px 80% / 16px 16px no-repeat,
    linear-gradient(var(--margin), var(--margin)) 36px 0 / 2px 100% no-repeat,
    var(--paper);
}
@media (min-width: 30rem) {
  .sheet {
    padding: 34px 32px 30px 72px;
    background-position: 16px 20%, 16px 80%, 52px 0, 0 0;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar {
  width: 56px;
  height: 56px;
  flex: none;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  object-fit: cover;
}

.sheet-title {
  font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.85rem);
  letter-spacing: -0.015em;
}
.sheet-note {
  margin-top: 4px;
  color: var(--ink-soft);
}

/* Fill-in lines, like the ones in the printables. */
.field {
  display: grid;
  gap: 2px;
  margin-top: 22px;
}
.field label {
  font-size: 1rem;
  font-weight: 700;
}
.field input {
  width: 100%;
  min-width: 0;
  padding: 8px 6px 6px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: linear-gradient(var(--mark), var(--mark)) 0 90% / 0% 62% no-repeat;
  color: var(--ink);
  font: inherit;
  font-size: 1.1875rem;
  -webkit-appearance: none;
  appearance: none;
  transition: background-size 0.3s ease;
}
.field input::placeholder {
  color: var(--ink-soft);
  opacity: 0.8;
}
/* Focus: the line gets highlighted, as if with a marker. */
.field input:focus {
  outline: none;
  background-size: 100% 62%;
  box-shadow: 0 2px 0 var(--ink);
}
.field input:user-invalid {
  border-bottom-color: var(--error);
  box-shadow: 0 2px 0 var(--error);
}
@media (min-width: 30rem) {
  .field {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    align-items: end;
    column-gap: 12px;
  }
  .field label { padding-bottom: 9px; }
}

/* Bots fill in this field; people never see it. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.status {
  margin-top: 14px;
  font-size: 1rem;
  font-weight: 700;
}
.status:empty { display: none; }
.status.is-error { color: var(--error); }

.fineprint {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* After signup */
.done:focus { outline: none; }
.done-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tick { width: 44px; height: 44px; flex: none; }
.tick rect { fill: var(--mark); stroke: var(--ink); stroke-width: 2.5; }
.tick path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
  animation: tick-draw 0.5s 0.15s cubic-bezier(0.3, 0.7, 0.4, 1) forwards;
}
@keyframes tick-draw { to { stroke-dashoffset: 0; } }

.done-lead {
  margin-top: 18px;
  font-size: 1.2rem;
  font-weight: 700;
}
.downloads {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.downloads:empty { display: none; }
.done-email,
.done-tip { margin-top: 18px; }
.done-tip { color: var(--ink-soft); }

/* ---------- 404 ---------- */

.lost {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 20px;
  padding-block: clamp(40px, 9vw, 112px);
}
.lost h1 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4rem); }
.lost .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .field input { transition: none; }
  .tick path { animation: none; stroke-dashoffset: 0; }
}
