/* ABOUTME: Shared styles for every page: fonts, colour tokens, typography, header, footer, buttons and the book card grid. */
/* ABOUTME: The pastel card colours (--tint-N) and cover tilts (--tilt-N) are tokens in :root, so the scheme can be changed in one place. */

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

:root {
  --font-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;

  /* Page colours. Plum comes from the AB monogram favicon. */
  --bg: #fffaf3;
  --surface: #ffffff;
  --text: #3b2a35;
  --muted: #6b5662;
  --heading: #4a2f3d;
  --link: #8a2d63;
  --accent: #b0306a;
  --accent-hover: #8e2253;
  --accent-text: #ffffff;
  --focus: #b0306a;
  --footer-bg: #4a2f3d;
  --footer-text: #f6e9ef;
  --footer-muted: #e3c9d6;

  /* Pastel tiles behind the book covers, used in turn across each grid. */
  --tint-1: #ffd9e2; /* pink */
  --tint-2: #fff1b5; /* butter */
  --tint-3: #cfeedd; /* mint */
  --tint-4: #d6e7ff; /* sky */
  --tint-5: #e6dcff; /* lilac */
  --tint-6: #ffdcc4; /* peach */

  /* How far each cover leans, used in turn across each grid. */
  --tilt-1: -3deg;
  --tilt-2: 2deg;
  --tilt-3: -1.5deg;
  --tilt-4: 2.5deg;
  --tilt-5: -2deg;
  --tilt-6: 1.5deg;
  --tilt-7: -2.5deg;

  --gutter: clamp(16px, 4vw, 40px);
  --measure: 42rem;
  --max-width: 1180px;
  --radius-tile: 22px;
  --radius-box: 28px;
  --shadow-cover: 0 6px 16px rgb(59 42 53 / 0.18), 0 1px 3px rgb(59 42 53 / 0.2);
}

.tint-1 { --tint: var(--tint-1); }
.tint-2 { --tint: var(--tint-2); }
.tint-3 { --tint: var(--tint-3); }
.tint-4 { --tint: var(--tint-4); }
.tint-5 { --tint: var(--tint-5); }
.tint-6 { --tint: var(--tint-6); }
.tilt-1 { --tilt: var(--tilt-1); }
.tilt-2 { --tilt: var(--tilt-2); }
.tilt-3 { --tilt: var(--tilt-3); }
.tilt-4 { --tilt: var(--tilt-4); }
.tilt-5 { --tilt: var(--tilt-5); }
.tilt-6 { --tilt: var(--tilt-6); }
.tilt-7 { --tilt: var(--tilt-7); }

*,
*::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(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 0.5em;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.section-heading {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 1.5rem;
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid rgb(74 47 61 / 0.1);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 0.75rem var(--gutter);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  color: var(--heading);
  text-decoration: none;
  line-height: 1;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--heading);
  text-decoration: none;
}
.site-nav a:hover { text-decoration: underline; }

.language-switch {
  display: block;
  line-height: 0;
  border-radius: 4px;
  transition: transform 0.15s ease;
}
.language-switch:hover { transform: scale(1.08); }

.flag {
  display: block;
  height: 24px;
  width: auto;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(59 42 53 / 0.15), 0 2px 4px rgb(59 42 53 / 0.15);
}

/* Buttons */

.button {
  display: inline-block;
  padding: 0.7em 1.4em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.button:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* Book cards: a tilted cover on a pastel tile, used on the home pages and under "You might also like these". */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(145px, 42%), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.book-card__link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  color: var(--heading);
  text-decoration: none;
}

.book-card__tile {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 6;
  padding: 12%;
  border-radius: var(--radius-tile);
  background: var(--tint);
}

.book-card__cover {
  display: block;
  max-height: 100%;
  width: auto;
  border-radius: 3px;
  box-shadow: var(--shadow-cover);
  transform: rotate(var(--tilt));
  transition: transform 0.2s ease;
}

.book-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.3;
  text-align: center;
}

.book-card__link:hover .book-card__cover,
.book-card__link:focus-visible .book-card__cover { transform: rotate(0) scale(1.05); }
.book-card__link:hover .book-card__title { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .book-card__cover, .button, .language-switch { transition: none; }
}

/* Prose (book descriptions and policies) */

.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.4rem; margin-top: 1.75em; }
.prose ul { padding-left: 1.25em; }
.prose li { margin-bottom: 0.35em; }
.prose li::marker { color: var(--accent); }

/* Footer */

.site-footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  background: var(--footer-bg);
  color: var(--footer-text);
}

.site-footer__inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding: 2.5rem var(--gutter);
  display: grid;
  gap: 1rem;
}

.wordmark--footer { color: var(--footer-text); margin: 0; }

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

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__legal { font-size: 0.9rem; color: var(--footer-muted); }
.site-footer__legal p { margin: 0 0 0.4rem; }
