/* Josefin Sans, self-hosted (SIL Open Font License, see assets/fonts/OFL.txt) */
@font-face {
  font-family: 'Josefin Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('../assets/fonts/josefin-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Josefin Sans';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url('../assets/fonts/josefin-sans-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Colors come from the Big Bare Island cover: a teal night sky on one side,
   a coral sunset on the other, and a sandy beach underneath. */
:root {
  --night: #0f2328;
  --dusk: #17343a;
  --twilight: #33404f;
  --coral: #ec8466;
  --peach: #f7b994;
  --sun: #ffd9a8;
  --sea: #2c6f75;
  --sea-deep: #1f5a61;
  --sand: #fbf2e6;
  --sand-deep: #f1e0c9;
  --ink: #1c3035;
  --ink-soft: #55676a;
  --rust: #a94c35;

  --display: 'Josefin Sans', 'Avenir Next', Futura, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --content: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--night);
}

body {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--sand);
}

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

a {
  color: inherit;
}

.wrap {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */
.button {
  display: inline-block;
  padding: 0.8rem 1.4rem 0.7rem;
  border-radius: 999px;
  background-color: var(--coral);
  color: var(--night);
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(236, 132, 102, 0.35);
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover,
.button:focus-visible {
  background-color: var(--peach);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(236, 132, 102, 0.45);
}

.button:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

/* Top bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(15, 35, 40, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #FFFFFF;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  padding-top: 0.2em; /* Josefin sits high in its line box */
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
}

.nav-links a {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding-top: 0.2em;
}

.nav-links a:not(.nav-follow) {
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:not(.nav-follow):hover,
.nav-links a:not(.nav-follow):focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--peach);
  border-bottom-color: var(--coral);
}

.nav-links .nav-follow {
  padding: 0.5rem 1rem 0.4rem;
  border: 2px solid var(--coral);
  border-radius: 999px;
  color: var(--peach);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-links .nav-follow:hover,
.nav-links .nav-follow:focus-visible {
  background-color: var(--coral);
  color: var(--night);
}

/* Dusk sky: the dark top of every page, with a scattering of stars */
.dusk {
  position: relative;
  color: #FFFFFF;
  background-color: var(--dusk);
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 19% 30%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 31% 8%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 44% 22%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 63% 6%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 72% 26%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 86% 14%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 93% 34%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 4% 44%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 97% 52%, rgba(255, 255, 255, 0.4), transparent),
    linear-gradient(180deg, var(--night) 0%, var(--dusk) 40%, var(--twilight) 100%);
}

.eyebrow {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--peach);
}

/* The sun going down behind the sea, then the beach */
.horizon {
  position: relative;
  height: clamp(150px, 20vw, 240px);
  overflow: hidden;
  background: linear-gradient(180deg, var(--twilight) 0%, #7a5562 32%, #d27f6a 52%, #f6b487 62%);
}

.sun {
  position: absolute;
  left: 50%;
  top: 62%;
  width: clamp(130px, 16vw, 210px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF4E0 0%, var(--sun) 50%, #f6a874 100%);
  box-shadow: 0 0 80px 30px rgba(255, 190, 130, 0.45);
  transform: translate(-50%, -38%);
  animation: sunset 3.5s cubic-bezier(0.25, 0.6, 0.3, 1) both;
}

@keyframes sunset {
  from { transform: translate(-50%, -75%); }
}

/* The sea, with the sun's reflection glinting on it */
.horizon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 62%;
  bottom: 0;
  z-index: 1;
  --glint: rgba(255, 222, 184, 0.8);
  background:
    linear-gradient(var(--glint), var(--glint)) 50% 10% / clamp(70px, 9vw, 120px) 2px no-repeat,
    linear-gradient(var(--glint), var(--glint)) 50% 26% / clamp(50px, 6.5vw, 86px) 2px no-repeat,
    linear-gradient(var(--glint), var(--glint)) 50% 42% / clamp(34px, 4.5vw, 58px) 2px no-repeat,
    linear-gradient(var(--glint), var(--glint)) 50% 58% / clamp(20px, 2.6vw, 34px) 2px no-repeat,
    radial-gradient(ellipse clamp(60px, 8vw, 110px) 70% at 50% 0, rgba(255, 200, 150, 0.4), transparent),
    linear-gradient(180deg, var(--sea) 0%, var(--sea-deep) 100%);
}

/* The beach, curving gently up into the frame */
.horizon::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -40px;
  height: 75px;
  z-index: 2;
  border-radius: 50% 50% 0 0;
  background-color: var(--sand);
}

/* Home: books under the evening sky */
.books-hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.books-hero h1 {
  margin-top: 0.75rem;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coming-next {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--peach);
}

.coming-next b {
  color: #FFFFFF;
  font-weight: 700;
}

/* A shelf of 3D books */
.shelf {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 4vw, 3rem);
  margin-top: clamp(2.5rem, 6vw, 4rem);
}

.book {
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.book:nth-child(2) { animation-delay: 0.1s; }
.book:nth-child(3) { animation-delay: 0.2s; }
.book:nth-child(4) { animation-delay: 0.3s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
}

.book-link {
  display: block;
  text-align: center;
  text-decoration: none;
  perspective: 1100px;
  -webkit-tap-highlight-color: transparent;
}

.book-link:focus-visible {
  outline: none;
}

.book-3d {
  --thickness: 18px;
  position: relative;
  display: block;
  width: 82%;
  margin: 0 auto;
  aspect-ratio: 400 / 640;
  transform-style: preserve-3d;
  transform: rotateY(-24deg);
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Front cover, with a crease where it bends at the spine */
.cover {
  position: absolute;
  inset: 0;
  border-radius: 2px 4px 4px 2px;
  overflow: hidden;
  transform: translateZ(calc(var(--thickness) / 2));
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, 0.28) 0%,
    rgba(255, 255, 255, 0.22) 1.6%,
    rgba(0, 0, 0, 0.14) 3.4%,
    rgba(0, 0, 0, 0) 7%,
    rgba(0, 0, 0, 0) 80%,
    rgba(255, 255, 255, 0.08) 100%);
  pointer-events: none;
}

/* Page edges */
.book-3d::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: calc(100% - var(--thickness) / 2 - 3px);
  width: var(--thickness);
  background: repeating-linear-gradient(90deg, #fbf6ec 0 2px, #ddd2bf 2px 3px);
  transform: rotateY(90deg);
}

/* Back cover, which also throws the shadow */
.book-3d::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px 4px 4px 2px;
  background-color: #1b1b1b;
  box-shadow: 18px 22px 34px rgba(0, 0, 0, 0.5);
  transform: translateZ(calc(var(--thickness) / -2));
}

.book-link:hover .book-3d,
.book-link:focus-visible .book-3d {
  transform: rotateY(-6deg) translateY(-12px);
}

.book-title {
  display: block;
  margin-top: 1.5rem;
  font-family: var(--display);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.book-series {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--peach);
}

.book-link:hover .book-title,
.book-link:focus-visible .book-title {
  color: var(--peach);
}

.book-link:focus-visible .book-title {
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-underline-offset: 4px;
}

/* The same shelf on the sand */
.shelf-light .book-title {
  color: var(--ink);
}

.shelf-light .book-series {
  color: var(--rust);
}

.shelf-light .book-link:hover .book-title,
.shelf-light .book-link:focus-visible .book-title {
  color: var(--rust);
}

.shelf-light .book-3d::after {
  box-shadow: 16px 20px 30px rgba(60, 40, 20, 0.35);
}

/* Sections on the sand */
.section {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.section-heading {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

/* About */
.about-inner {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  max-width: 900px;
}

.author-photo {
  flex: 0 0 auto;
  width: clamp(150px, 22vw, 220px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 6px var(--sand), 0 0 0 9px var(--coral), 0 14px 30px rgba(60, 40, 20, 0.25);
}

.about-text .section-heading {
  margin-bottom: 0.75rem;
}

.about-text p + p {
  margin-top: 0.85rem;
}

/* Footer: night falls, the moon comes up */
.site-footer {
  position: relative;
  overflow: hidden;
  padding: clamp(6.5rem, 11vw, 8.5rem) 0 1.5rem;
  border-radius: 50% 50% 0 0 / 48px 48px 0 0;
  background: linear-gradient(180deg, var(--dusk) 0%, var(--night) 70%);
  color: #FFFFFF;
}

.moon {
  position: absolute;
  top: clamp(1.75rem, 3.5vw, 2.5rem);
  right: 14%;
  width: clamp(48px, 6vw, 72px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: url("../assets/images/moon.webp") center / cover no-repeat;
  box-shadow:
    0 0 36px 8px rgba(247, 185, 148, 0.22),
    0 0 110px 30px rgba(247, 185, 148, 0.08);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 2.5rem clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.footer-heading {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.follow p {
  margin: 0.6rem 0 1.4rem;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.82);
}

.social {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-top: 1.5rem;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  transition: color 0.2s ease;
}

.social a:hover,
.social a:focus-visible {
  color: var(--peach);
}

.social-icon {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
}

.social-x {
  padding: 8px;
  background: #000;
  color: #fff;
}

.friends .eyebrow {
  margin-bottom: 0.75rem;
}

.friends ul {
  list-style: none;
}

.friends li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.friends a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  text-decoration: none;
}

.friends a:hover .friend-name,
.friends a:focus-visible .friend-name {
  color: var(--peach);
}

.friend-name {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  padding-top: 0.15em;
  transition: color 0.2s ease;
}

.friend-url {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer-base {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.footer-base .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer-base a:hover,
.footer-base a:focus-visible {
  color: var(--peach);
}

/* Book pages */
.book-hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(1rem, 3vw, 2rem);
}

.book-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.book-hero .book-3d {
  --thickness: 26px;
  width: min(100%, 340px);
}

.book-hero .book-3d:hover {
  transform: rotateY(-6deg) translateY(-8px);
}

.book-hero-cover {
  perspective: 1200px;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.book-hero h1 {
  margin-top: 0.6rem;
  font-family: var(--display);
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.book-subtitle {
  margin-top: 0.5rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 300;
  color: var(--peach);
}

.hook {
  margin: 1.5rem 0 2rem;
  max-width: 32rem;
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 600;
  line-height: 1.35;
}

.blurb {
  max-width: 42rem;
  margin: 0 auto;
  font-size: 1.125rem;
  line-height: 1.75;
}

.blurb p + p {
  margin-top: 1.1rem;
}

.blurb .closing {
  font-weight: 600;
}

.pull-quote {
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--coral);
  border-radius: 0 12px 12px 0;
  background-color: var(--sand-deep);
  font-style: italic;
}

.pull-quote figcaption {
  margin-top: 0.5rem;
  font-style: normal;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.paperback {
  margin-top: 2.5rem;
}

.paperback img {
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 14px 34px rgba(60, 40, 20, 0.3);
}

.paperback figcaption {
  margin-top: 0.75rem;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.85rem;
  text-align: center;
  color: var(--ink-soft);
}

.blurb .button {
  margin-top: 2.25rem;
}

.more-books {
  border-top: 1px solid var(--sand-deep);
}

.more-books .section-heading {
  text-align: center;
}

.more-books .shelf {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* Plain text pages (privacy notice) */
.text-page {
  max-width: 46rem;
}

.text-page h1 {
  margin-bottom: 0.25rem;
}

.text-page h2 {
  margin: 2rem 0 0.5rem;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.text-page p {
  margin-bottom: 0.85rem;
}

.text-page a {
  color: var(--rust);
}

.updated {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* Tablets */
@media (max-width: 860px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* Phones */
@media (max-width: 640px) {
  .brand {
    font-size: 1rem;
    letter-spacing: 0.12em;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links .nav-follow {
    display: none;
  }

  .shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-3d {
    --thickness: 12px;
  }

  .more-books .shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .book-hero .book-3d {
    width: min(62%, 260px);
  }

  .hook {
    margin-left: auto;
    margin-right: auto;
  }

  .book-series {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
  }

  .about-inner {
    flex-direction: column;
  }

  .about-text .section-heading {
    text-align: center;
  }

  .moon {
    right: 1.25rem;
  }
}

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

  .book,
  .book-hero-cover,
  .sun {
    animation: none;
  }

  .book-3d {
    transition: none;
  }
}
