/* Tintalume. Colors are sampled from the Book 1 cover. */

@font-face {
  font-family: "Titan One";
  src: url("fonts/titan-one.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #fff4e0;
  --cream-deep: #f5e2c2;
  --snow: #ffffff;
  --cocoa: #5b3420;
  --ink: #2b170e;
  --ember: #c4441c;
  --caramel: #d09040;
  --cranberry: #b3263a;
  --cranberry-deep: #86192a;
  --dusk: #3e6a98;
  --dusk-dot: #537aa3;
  --muted: #7a5440;

  --font-display: "Titan One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;

  --max: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --shadow: 0 24px 48px -24px rgb(43 23 14 / 0.55), 0 6px 14px -6px rgb(43 23 14 / 0.25);
  --header-offset: 0px;

  color-scheme: light;
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--cocoa);
  font: 400 1.0625rem/1.65 var(--font-body);
}

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

h1,
h2,
h3,
h4 {
  margin: 0 0 0.4em;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  color: var(--cocoa);
  text-wrap: balance;
}

h2 {
  font-size: clamp(2.1rem, 5vw, 3rem);
}

p {
  margin: 0 0 1em;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

a:hover {
  color: var(--cranberry-deep);
}

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

.container {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: 0;
  left: var(--gutter);
  padding: 10px 16px;
  border-radius: 0 0 12px 12px;
  background: var(--cocoa);
  color: var(--cream);
  font-weight: 700;
  transform: translateY(-120%);
}

.skip-link:focus {
  transform: none;
}

.eyebrow {
  margin-bottom: 0.6em;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cranberry);
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  color: var(--cocoa);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Snow: white flakes on cream, like the cover sky. */
.snow {
  background-color: var(--cream);
  background-image:
    radial-gradient(circle, rgb(255 255 255 / 0.95) 0 2.5px, transparent 3px),
    radial-gradient(circle, rgb(255 255 255 / 0.8) 0 1.5px, transparent 2px);
  background-size: 56px 56px, 34px 34px;
  background-position: 0 0, 17px 21px;
}

/* Buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.8em 1.5em;
  border: 2px solid transparent;
  border-radius: 999px;
  font: 400 1.05rem/1.15 var(--font-display);
  letter-spacing: 0.02em;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(3px);
}

.btn-primary {
  background: var(--cranberry);
  color: var(--snow);
  box-shadow: 0 4px 0 var(--cranberry-deep);
}

.btn-primary:hover {
  background: #c22d42;
  color: var(--snow);
}

.btn-primary:active {
  box-shadow: 0 1px 0 var(--cranberry-deep);
}

.btn-secondary {
  border-color: var(--cocoa);
  background: var(--snow);
  color: var(--cocoa);
  box-shadow: 0 4px 0 var(--cocoa);
}

.btn-secondary:hover {
  background: var(--cream);
  color: var(--cocoa);
}

.btn-secondary:active {
  box-shadow: 0 1px 0 var(--cocoa);
}

/* Not on Amazon yet: a book's amazon URL in books.js turns these into live links. */
.btn[aria-disabled="true"],
.btn[aria-disabled="true"]:hover,
.btn[aria-disabled="true"]:active {
  border: 2px dashed #d6bb8f;
  background: var(--cream-deep);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
  transform: none;
}

/* Header */

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 2px solid var(--cream-deep);
  background: var(--cream);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 28px;
  padding-block: 14px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--cocoa);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--cocoa);
}

.site-header nav {
  flex: 1 1 100%;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 8px;
  font-size: 0.9rem;
}

.nav-list a {
  display: inline-block;
  padding-block: 6px;
  color: var(--cocoa);
  font-weight: 700;
  text-decoration: none;
}

.nav-list a:hover {
  color: var(--cranberry);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

@media (min-width: 760px) {
  :root {
    --header-offset: 76px;
  }

  .site-header nav {
    flex: 0 1 auto;
  }

  .nav-list {
    gap: 0 18px;
    font-size: 1rem;
  }

  .site-header {
    position: sticky;
    top: 0;
  }
}

section[id] {
  scroll-margin-top: var(--header-offset);
}

/* The /hay short link lands on a book card (#hay-and-hot-cocoa); keep the sticky header off it. */
.book[id] {
  scroll-margin-top: calc(var(--header-offset) + 16px);
}

/* Sections */

.section {
  padding-block: clamp(56px, 8vw, 104px);
}

.section-head {
  max-width: 40rem;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.section-head p:last-child {
  margin-bottom: 0;
  font-size: 1.1rem;
}

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(36px, 6vw, 88px) clamp(96px, 12vw, 160px);
}

/* Two white snowbanks that run into the Books section. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  bottom: -2px;
  height: clamp(56px, 8vw, 110px);
  background: var(--snow);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hero::before {
  left: -12%;
  width: 72%;
}

.hero::after {
  right: -14%;
  width: 80%;
  height: clamp(40px, 6vw, 84px);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}

.hero h1 {
  margin-bottom: 0.3em;
  font-size: clamp(2.7rem, 7vw, 4.75rem);
  line-height: 1.02;
  text-shadow: 0 3px 0 rgb(43 23 14 / 0.12);
}

.hero h1 span {
  display: block;
}

.hero h1 .ember {
  color: var(--ember);
}

.strap {
  margin-bottom: 1.1em;
  text-wrap: balance;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cranberry);
}

.lede {
  max-width: 32rem;
  margin-bottom: 1.6em;
  font-size: 1.2rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.facts li {
  padding: 5px 12px;
  border: 2px solid var(--cream-deep);
  border-radius: 999px;
  background: var(--snow);
  font-size: 0.92rem;
  font-weight: 700;
}

.hero-art {
  position: relative;
  width: min(86%, 440px);
  margin-inline: auto;
}

/* A line-art page tucked behind the cover. */
.hero-art::before {
  content: "";
  position: absolute;
  inset: 5% -5% -3% 9%;
  border-radius: 6px;
  background: var(--snow) url("images/pages/page-01-400.webp") center / cover;
  box-shadow: var(--shadow);
  transform: rotate(-6deg);
}

.cover-card {
  position: relative;
  border-radius: 6px;
  box-shadow: 0 34px 60px -26px rgb(43 23 14 / 0.6), 0 10px 22px -10px rgb(43 23 14 / 0.35);
  transform: rotate(3deg);
}

@media (min-width: 900px) {
  .hero-inner {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .hero-art {
    width: min(100%, 440px);
  }
}

/* Books: series by series, rendered from books.js. A series with one book shows it as a wide card. */

.books {
  background: var(--snow);
}

.series + .series {
  margin-top: clamp(48px, 7vw, 80px);
}

.series-head {
  margin-bottom: 22px;
}

.series-head h3 {
  margin-bottom: 0.15em;
  font-size: clamp(1.6rem, 3.5vw, 2rem);
}

.series-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.book-list {
  display: grid;
  gap: 24px;
}

.book {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: clamp(18px, 3vw, 28px);
  border-radius: 24px;
  background: var(--cream);
}

.book-cover img {
  width: 100%;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.book h4 {
  margin-bottom: 0.2em;
  font-size: 1.5rem;
}

.book-sub {
  font-weight: 700;
  color: var(--muted);
}

.book .facts {
  margin-block: 0 22px;
}

.book-wide {
  grid-column: 1 / -1;
  gap: clamp(28px, 4vw, 52px);
  align-items: center;
  padding: clamp(22px, 4vw, 44px);
  border-radius: 28px;
}

.book-wide .book-cover {
  width: min(100%, 340px);
  margin-inline: auto;
  transform: rotate(-2deg);
}

.book-wide h4 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

@media (min-width: 640px) {
  .book-list {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (min-width: 760px) {
  .book-wide {
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  }
}

/* Meet the herd: the back-cover blue with snow dots. */

.herd {
  background-color: var(--dusk);
  background-image:
    radial-gradient(circle, var(--dusk-dot) 0 2.5px, transparent 3px),
    radial-gradient(circle, var(--dusk-dot) 0 1.5px, transparent 2px);
  background-size: 58px 58px, 37px 37px;
  background-position: 0 0, 19px 23px;
  color: var(--snow);
}

.herd .section-head h2 {
  color: var(--cream);
}

.herd-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.herd-card {
  padding: 12px 12px 18px;
  border-radius: 24px;
  background: var(--cream);
  color: var(--cocoa);
  text-align: center;
  box-shadow: 0 16px 30px -20px rgb(16 28 48 / 0.7);
}

.herd-card img {
  width: 100%;
}

.herd-card h3 {
  margin: 2px 0;
  font-size: clamp(1.15rem, 3.6vw, 1.45rem);
}

.herd-kind {
  margin-bottom: 0.5em;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cranberry);
}

.herd-card p:last-child {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

@media (min-width: 760px) {
  .herd-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
  }
}

/* Peek inside: a fanned deck of pages; on phones the cards stack in a zigzag. */

.deck {
  display: grid;
  max-width: 1060px;
  margin-inline: auto;
  padding-block: 8px 16px;
}

.deck-card {
  width: 72%;
  transform: rotate(var(--r));
  transition: transform 0.25s ease;
}

.deck-card + .deck-card {
  margin-top: -22%;
}

.deck-card:nth-child(even) {
  justify-self: end;
}

.deck-card:nth-child(1) {
  --r: -5deg;
}

.deck-card:nth-child(2) {
  --r: 4deg;
}

.deck-card:nth-child(3) {
  --r: -3deg;
}

.deck-card:nth-child(4) {
  --r: 5deg;
}

.deck-card:hover {
  z-index: 5;
  transform: rotate(0deg) translateY(-10px) scale(1.03);
}

.deck-card img {
  width: 100%;
  border-radius: 10px;
  background: var(--snow);
  box-shadow: var(--shadow);
}

@media (min-width: 700px) {
  .deck {
    position: relative;
    aspect-ratio: 100 / 44;
    padding: 0;
  }

  .deck-card {
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: 33%;
  }

  .deck-card + .deck-card {
    margin-top: 0;
  }

  .deck-card:nth-child(1) {
    --x: 0%;
    --y: 9%;
    --r: -9deg;
  }

  .deck-card:nth-child(2) {
    --x: 22.3%;
    --y: 2%;
    --r: -3deg;
  }

  .deck-card:nth-child(3) {
    --x: 44.7%;
    --y: 2%;
    --r: 3deg;
  }

  .deck-card:nth-child(4) {
    --x: 67%;
    --y: 9%;
    --r: 9deg;
  }
}

/* About */

.about {
  background: var(--snow);
}

.about-inner {
  display: grid;
  gap: clamp(36px, 5vw, 64px);
  align-items: center;
}

.about-copy p {
  max-width: 34rem;
  font-size: 1.15rem;
}

.about-art {
  width: min(100%, 420px);
  margin: 0 auto;
}

.about-art img {
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: rotate(2.5deg);
}

.about-art figcaption {
  margin-top: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--muted);
}

@media (min-width: 860px) {
  .about-inner {
    grid-template-columns: 1fr 1fr;
  }
}

/* Merch teaser */

.merch-grid {
  display: grid;
  gap: 20px;
}

.merch-card {
  padding: 24px 22px 26px;
  border-radius: 24px;
  background: var(--snow);
  text-align: center;
  box-shadow: 0 16px 30px -24px rgb(43 23 14 / 0.5);
}

.merch-card h3 {
  font-size: 1.6rem;
}

.mock {
  position: relative;
  width: 220px;
  height: 200px;
  margin: 0 auto 14px;
}

.mock svg {
  position: absolute;
  inset: 0;
}

.mock img {
  position: absolute;
}

.mock-mug img {
  top: 70px;
  left: 54px;
  width: 92px;
}

.mock-tee img {
  top: 72px;
  left: 78px;
  width: 64px;
}

@media (min-width: 640px) {
  .merch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }
}

/* Contact */

.contact {
  background: var(--cranberry);
  color: var(--cream);
  text-align: center;
}

.contact h2 {
  color: var(--cream);
}

.contact p {
  max-width: 34rem;
  margin-inline: auto;
  font-size: 1.15rem;
}

.contact :focus-visible {
  outline-color: var(--cream);
}

.email {
  margin-top: 1.4em;
  margin-bottom: 0.5em;
}

.email a {
  color: var(--cream);
  font: 400 clamp(1.45rem, 5.5vw, 2.4rem)/1.2 var(--font-display);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  overflow-wrap: anywhere;
}

.email a:hover {
  color: var(--snow);
}

.instagram a {
  color: var(--cream);
  font-weight: 700;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.instagram a:hover {
  color: var(--snow);
}

/* Footer */

.site-footer {
  padding-block: 28px;
  background: var(--ink);
  color: var(--cream);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer p {
  margin: 0;
  font-size: 0.95rem;
}

.site-footer .wordmark {
  font-size: 1.4rem;
  color: var(--cream);
}

.site-footer a {
  color: var(--cream);
}

.site-footer a:hover {
  color: var(--snow);
}

.site-footer :focus-visible {
  outline-color: var(--cream);
}

/* Coming-soon page */

.soon-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.soon {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px var(--gutter) 24px;
  text-align: center;
}

.soon h1 {
  margin-bottom: 0.25em;
  font-size: clamp(3rem, 13vw, 5.5rem);
  text-shadow: 0 4px 0 rgb(43 23 14 / 0.12);
}

.soon-line {
  max-width: 22em;
  text-wrap: balance;
  margin-bottom: 0;
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  font-weight: 700;
}

.soon-cover {
  width: min(58vw, 240px);
  margin: 32px auto 36px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  transform: rotate(-3deg);
}

.soon-email {
  margin: 0;
}

.soon-email a {
  font: 400 clamp(1.25rem, 5vw, 1.6rem)/1.2 var(--font-display);
  overflow-wrap: anywhere;
}

.soon-footer {
  padding: 16px var(--gutter) 24px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.soon-footer p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .deck-card {
    transition: none;
  }
}
