/* weirdauthor.com — one stylesheet for every page. */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Familjen Grotesk";
  src: url("../fonts/familjen-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --green: #2e4a44;
  --green-ink: #f3efe6;
  --green-soft: #d5dcd6;
  --ground: #fbfaf8;
  --ink: #1d2321;
  --ink-soft: #3c4643;

  /* Page colours. Book pages override these with their cover's colours. */
  --wall: var(--ground);
  --wall-ink: var(--ink);
  --wall-soft: var(--ink-soft);
  --accent: var(--green);
  --accent-ink: var(--green-ink);

  --sans: "Familjen Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, serif;

  --gutter: clamp(20px, 5.6vw, 72px);
  --max: 1280px;
  --cover-shadow: 0 18px 28px -12px rgb(0 0 0 / 0.55), 0 2px 4px rgb(0 0 0 / 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--green) var(--ground);
}

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

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

::selection { background: var(--green); color: var(--green-ink); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.28em;
  transition: text-decoration-thickness 0.15s ease;
}
a:hover { text-decoration-thickness: 3px; }

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  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 {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--green-ink);
  color: var(--green);
  font-weight: 700;
}
.skip:focus { top: 12px; }

/* ---------- Site header ---------- */
.site-header {
  background: var(--green);
  color: var(--green-ink);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 32px;
  padding-block: clamp(24px, 3.2vw, 40px) clamp(24px, 2.8vw, 36px);
}
.site-name {
  display: inline-block;
  font-weight: 700;
  font-size: clamp(1.5rem, 1.2rem + 0.9vw, 1.875rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-decoration: none;
}
.site-name:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.alias {
  margin: 6px 0 0;
  max-width: 34em;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1875rem);
  line-height: 1.5;
  color: var(--green-soft);
}
.site-nav ul {
  display: flex;
  gap: 32px;
  margin: 0;
  padding: 4px 0 0;
  list-style: none;
}
.site-nav a { font-size: 1.125rem; }
.site-nav a[aria-current="page"] { text-decoration-thickness: 3px; }

/* ---------- Home ---------- */
.home-wall {
  display: flow-root;
  background: var(--green);
  color: var(--green-ink);
  padding-bottom: clamp(56px, 7vw, 88px);
}
.premise {
  margin: clamp(48px, 7.5vw, 96px) 0 0;
  max-width: 19em;
  font-weight: 500;
  font-size: clamp(2.125rem, 1.4rem + 2.6vw, 3.375rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.shelf {
  display: flex;
  align-items: flex-end;
  gap: clamp(14px, 2.3vw, 30px);
  margin: clamp(44px, 5.6vw, 72px) 0 0;
  padding: 0;
  list-style: none;
}
.shelf li:first-child { margin-right: clamp(0px, 1.6vw, 20px); }
.shelf a {
  display: block;
  border-radius: 1px;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.shelf img {
  width: clamp(64px, 9.2vw, 118px);
  box-shadow: var(--cover-shadow);
}
.shelf li:first-child img { width: clamp(120px, 14.8vw, 190px); }
.shelf a:hover,
.shelf a:focus-visible { transform: translateY(-6px); }
.shelf a:focus-visible { outline-color: var(--green-ink); outline-offset: 6px; }

.home-strip .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px 40px;
  padding-block: 40px 48px;
}
.genre {
  margin: 0;
  max-width: 34em;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- Book and About pages ---------- */
/* The last coloured band stretches so short pages never leave a gap above the footer. */
main { flex: 1; display: flex; flex-direction: column; }
main > :last-child { flex: 1; }

.feature {
  background: var(--wall);
  color: var(--wall-ink);
}
.feature .wrap {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: clamp(40px, 6.2vw, 80px);
  align-items: start;
  padding-block: clamp(56px, 7.5vw, 96px) clamp(88px, 11.7vw, 150px);
}
.feature .not-found { grid-template-columns: 1fr; }
.feature-image img {
  width: 100%;
  box-shadow: 0 26px 40px -18px rgb(0 0 0 / 0.5), 0 3px 6px rgb(0 0 0 / 0.18);
}
.feature-text { max-width: 38rem; }
.back { margin: 0; font-size: 1.0625rem; }
.back a { color: var(--accent); }
.feature h1 {
  margin: 22px 0 0;
  font-weight: 500;
  font-size: clamp(2.5rem, 1.6rem + 3.2vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-wrap: balance;
}
.about-page .feature h1 { margin-top: 10px; }
.series {
  margin: 14px 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--wall-soft);
}
.hook {
  margin: 16px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  line-height: 1.5;
  color: var(--wall-soft);
}
.prose {
  margin-top: 30px;
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.65;
}
.prose p { margin: 0 0 1em; }
.hook, .prose p, .next-up { text-wrap: pretty; }
.genre { text-wrap: balance; }
.about-page .prose { font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.375rem); }
.punchline { font-style: italic; }

.buy {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
}
.buy a {
  display: inline-flex;
  flex-direction: column;
  min-width: 9.5rem;
  padding: 13px 22px 14px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.buy a span {
  margin-top: 3px;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--wall-soft);
}
.buy .primary a { background: var(--accent); color: var(--accent-ink); }
.buy .primary a span { color: var(--accent-ink); }
.buy a:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.buy a:hover span { color: var(--accent-ink); }
.buy .primary a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.next-up {
  margin: 30px 0 0;
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--wall-soft);
}
.more { margin: 34px 0 0; font-size: 1.1875rem; }
.more a { color: var(--accent); font-weight: 700; text-decoration-thickness: 2px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ground);
  color: var(--ink-soft);
  font-size: 1rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-block: 30px 44px;
}
.site-footer p { margin: 0; }

/* ---------- Inner-page colours ----------
   Every page except the home page (books, About, 404) shares the About page's
   pale green design. Change it here and every inner page follows. */
.feature {
  --wall: #e4efec;
  --wall-ink: #1f2a27;
  --wall-soft: #33443f;
  --accent: #1f4a42;
  --accent-ink: #ffffff;
}

.feature ::selection { background: var(--accent); color: var(--accent-ink); }
.feature :focus-visible { outline-color: var(--accent); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .shelf li {
    animation: settle 0.9s var(--ease-out) both;
  }
  .shelf li:nth-child(2) { animation-delay: 60ms; }
  .shelf li:nth-child(3) { animation-delay: 120ms; }
  .shelf li:nth-child(4) { animation-delay: 180ms; }
  .shelf li:nth-child(5) { animation-delay: 240ms; }
}
@keyframes settle {
  from { transform: translateY(18px); }
  to { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .feature .wrap { grid-template-columns: 1fr; }
  .feature-image { max-width: 260px; }
  .about-page .feature-image { max-width: 300px; }
}
@media (max-width: 600px) {
  .shelf { flex-wrap: wrap; }
  .shelf li:first-child { flex-basis: 100%; margin: 0 0 6px; }
  .shelf li:first-child img { width: 46vw; }
  .shelf li:not(:first-child) { flex: 1 1 0; }
  .shelf li:not(:first-child) img { width: 100%; }
}
