/* ==========================================================================
   Neribo Books
   Palette:  bottle green #0F3D33, night green #0A1F1A, sage paper #EBF0EA,
             white, harmattan amber #E8A93B
   Type:     Literata (headings, book title), Karla (body, buttons)
   ========================================================================== */

:root {
  --green: #0f3d33;
  --green-mid: #16584a;
  --night: #0a1f1a;
  --sage: #ebf0ea;
  --paper: #ffffff;
  --amber: #e8a93b;
  --amber-light: #f2bd5c;
  --text: #1b2b26;
  --muted: #4a5c55;
  --link: #0f5a47;
  --line: #d3ddd5;

  --font-head: "Literata", Georgia, "Times New Roman", serif;
  --font-body: "Karla", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --radius: 5px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
p { margin: 0 0 1rem; max-width: 62ch; }
h1, h2, h3, h4 { margin: 0; overflow-wrap: anywhere; }
ul, ol, dl, dd { margin: 0; padding: 0; }
figure { margin: 0; }
blockquote { margin: 0; }

a { color: var(--link); text-underline-offset: 0.2em; }
a:hover { color: var(--green); }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 2px;
}
.on-dark :focus-visible { outline-color: var(--amber-light); }

.wrap {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 50;
  background: var(--amber);
  color: var(--green);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.4rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-amber { background: var(--amber); color: var(--green); }
.btn-amber:hover { background: var(--amber-light); color: var(--green); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--night); color: #fff; }
.btn-outline { border-color: var(--green); color: var(--green); }
.btn-outline:hover { background: var(--green); color: #fff; }
.btn-outline-light { border-color: rgba(255, 255, 255, 0.8); color: #fff; }
.btn-outline-light:hover { background: #fff; color: var(--green); border-color: #fff; }
.btn-lg { min-height: 3.3rem; padding-inline: 1.7rem; font-size: 1.1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--green);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: #fff; }
.brand-mark {
  flex: none;
  width: auto;
  height: 2.75rem;
  padding: 0.3rem 0.4rem;
  background: #fff;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}
.site-nav a {
  font-weight: 500;
  font-size: 1.02rem;
  color: #fff;
  text-decoration: none;
  padding-block: 0.4rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--amber); color: #fff; }

.bar-cta { min-height: 2.75rem; padding-inline: 1.15rem; white-space: nowrap; }

.menu-toggle {
  display: none;
  width: 2.75rem; height: 2.75rem;
  padding: 0;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 1.15rem; height: 2px;
  background: #fff;
  content: "";
  position: relative;
}
.menu-icon::before { position: absolute; top: -6px; }
.menu-icon::after { position: absolute; top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-icon { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-icon::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-icon::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 34rem) {
  .bar { gap: 0.5rem; }
  .brand { font-size: 1.05rem; gap: 0.45rem; }
  .brand-mark { height: 2.4rem; padding: 0.25rem 0.35rem; }
  .bar-cta { padding-inline: 0.8rem; font-size: 0.95rem; min-height: 2.6rem; }
  .menu-toggle { width: 2.6rem; height: 2.6rem; }
}
@media (max-width: 24rem) {
  .brand { font-size: 0.95rem; gap: 0.35rem; }
  .brand span { white-space: normal; line-height: 1.1; max-width: 3.6rem; }
  .brand-mark { height: 2.2rem; }
  .bar-cta { padding-inline: 0.6rem; font-size: 0.9rem; }
  .menu-toggle { width: 2.4rem; height: 2.4rem; }
}

@media (max-width: 56rem) {
  .bar-cta { margin-left: auto; }
  .site-nav { margin-left: 0; }

  .js .menu-toggle { display: inline-flex; }
  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--green);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    padding: 0.5rem 1.25rem 1rem;
  }
  .js .site-nav.is-open { display: flex; }
  .js .site-nav a {
    padding: 0.9rem 0;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }
  .js .site-nav a:hover { border-bottom-color: rgba(255, 255, 255, 0.16); }

  /* Without JavaScript the links simply wrap under the logo */
  html:not(.js) .bar { flex-wrap: wrap; padding-block: 0.5rem; }
  html:not(.js) .site-nav { order: 3; width: 100%; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background-color: var(--green);
  color: #fff;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(100deg, rgba(15, 61, 51, 0.95) 0%, rgba(15, 61, 51, 0.8) 40%, rgba(15, 61, 51, 0.3) 100%);
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.hero-copy { min-width: 0; }

.hero-kicker {
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--amber-light);
  margin-bottom: 0.4rem;
}
.hero h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2.6rem, 1.5rem + 4.6vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  max-width: 9em;
  text-wrap: balance;
}
.hook {
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.4;
  color: #eef4ef;
  margin-bottom: 2rem;
  max-width: 28rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-note { margin: 1.25rem 0 0; font-size: 1rem; color: #cfe0d6; }

@media (min-width: 56rem) {
  .hero-inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 3rem; }
}

/* ---------- 3D book ---------- */
.book-stage {
  --w: clamp(11rem, 54vw, 17rem);
  --h: calc(var(--w) * 1.5);
  --d: calc(var(--w) * 0.17);
  position: relative;
  width: var(--w);
  height: var(--h);
  margin: 1.5rem auto 2.5rem;
  perspective: 1400px;
  touch-action: pan-y;
}
@media (min-width: 56rem) {
  .book-stage { --w: clamp(15rem, 24vw, 19rem); margin: 0 auto; }
}

.book-sway {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: sway 9s ease-in-out infinite alternate;
}
@keyframes sway {
  from { transform: rotateY(-6deg); }
  to { transform: rotateY(6deg); }
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 4deg)) rotateY(var(--ry, 32deg));
  transition: transform 0.25s ease-out;
}
.face { position: absolute; }

.front {
  inset: 0;
  transform: translateZ(calc(var(--d) / 2));
  background: var(--green);
  border-radius: 2px 6px 6px 2px;
  overflow: hidden;
  backface-visibility: hidden;
}
.front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0, rgba(255, 255, 255, 0.16) 2.5%, rgba(0, 0, 0, 0.12) 5%, transparent 9%);
  pointer-events: none;
}
.cover-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-text {
  position: absolute;
  left: 0; right: 0; top: 0;
  padding: calc(var(--w) * 0.12) calc(var(--w) * 0.1) 0 calc(var(--w) * 0.13);
}
.cover-title {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: calc(var(--w) * 0.13);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: #fff;
}
.cover-sub {
  display: block;
  margin-top: 0.7em;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: calc(var(--w) * 0.058);
  color: #f6d88f;
}
.cover-imprint {
  position: absolute;
  left: calc(var(--w) * 0.13);
  bottom: calc(var(--w) * 0.07);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: calc(var(--w) * 0.05);
  color: #fff;
}

.spine {
  width: var(--d);
  height: 100%;
  left: calc((var(--w) - var(--d)) / 2);
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #0a2a23, #145244 50%, #0a2a23);
}
.spine span {
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: calc(var(--d) * 0.42);
  color: #f6d88f;
}
.back {
  inset: 0;
  transform: translateZ(calc(var(--d) / -2)) rotateY(180deg);
  background: #0a2a23;
}
.pages {
  width: var(--d);
  height: calc(100% - 6px);
  top: 3px;
  left: calc((var(--w) - var(--d)) / 2);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 3px));
  background: repeating-linear-gradient(90deg, #f2efe6 0 2px, #ddd8c9 2px 3px);
}
.top,
.bottom {
  width: calc(100% - 6px);
  height: var(--d);
  left: 3px;
  top: calc((var(--h) - var(--d)) / 2);
  background: repeating-linear-gradient(0deg, #f2efe6 0 2px, #ddd8c9 2px 3px);
}
.top { transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 3px)); }
.bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2 - 3px)); }

.book-shadow {
  position: absolute;
  left: 4%;
  right: -10%;
  bottom: -1.6rem;
  height: 1.8rem;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent);
  filter: blur(5px);
}

/* ---------- Shared section styles ---------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-sage { background: var(--sage); }
.section-green { background: var(--green); color: #fff; }

.h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--green);
  margin-bottom: 1rem;
  text-wrap: balance;
}
.section-green .h2 { color: #fff; }
.section-head { margin-bottom: 2.25rem; max-width: 40rem; }

/* ---------- About the book ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }

.details { margin-top: 1.5rem; max-width: 22rem; }
.details div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.details div:last-child { border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 1rem; }
.details dd { font-weight: 700; color: var(--green); text-align: right; }

.blurb p { font-size: 1.15rem; max-width: 40rem; }
.blurb-lead {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem) !important;
  line-height: 1.5;
  color: var(--text);
}
.blurb-lead::first-letter {
  float: left;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 4.4em;
  line-height: 0.78;
  padding: 0.06em 0.1em 0 0;
  color: var(--green);
}
.blurb-close {
  margin-top: 1.5rem;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem !important;
  color: var(--green);
  padding-top: 1rem;
  border-top: 3px solid var(--amber);
  max-width: 24rem !important;
}
@media (min-width: 58rem) {
  .about { grid-template-columns: 4fr 8fr; gap: 4.5rem; }
}

/* ---------- Author ---------- */
.author { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-items: center; }
.author-photo { max-width: 26rem; }
.photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: linear-gradient(160deg, #1d5c4c, #0f3d33);
  border-radius: var(--radius);
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.role {
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--green-mid);
  margin-bottom: 1.25rem;
}
.author-copy p { font-size: 1.15rem; max-width: 38rem; }
@media (min-width: 58rem) {
  .author { grid-template-columns: 5fr 6fr; gap: 5rem; }
}

/* ---------- Reader reactions ---------- */
.quotes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
.quote { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.quote blockquote p {
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.9rem;
}
.quote figcaption { font-weight: 700; font-size: 1.02rem; color: var(--green-mid); }

.quote-lead { border-top: 5px solid var(--green); padding-top: 1.5rem; }
.quote-lead blockquote p {
  font-size: clamp(1.55rem, 1.1rem + 1.7vw, 2.4rem);
  line-height: 1.28;
  color: var(--green);
  max-width: 30rem;
}
.quote-lead blockquote p::before {
  content: "\201C";
  display: block;
  font-style: normal;
  font-weight: 700;
  font-size: 3.4em;
  line-height: 0.6;
  color: var(--amber);
  margin-bottom: 0.15em;
}
@media (min-width: 58rem) {
  .quotes { grid-template-columns: 7fr 5fr; gap: 2.5rem 4rem; }
  .quote-lead { grid-row: span 2; }
}

/* ---------- Stay updated and Get the book ---------- */
.join { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.join-form p { color: #dcebe2; font-size: 1.15rem; max-width: 34rem; }

.signup { margin-top: 1.5rem; max-width: 34rem; }
.signup label { display: block; font-weight: 700; margin-bottom: 0.5rem; }
.signup-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.signup input {
  flex: 1 1 15rem;
  min-width: 0;
  min-height: 3.2rem;
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--text);
  background: #fff;
  border: 2px solid #fff;
  border-radius: var(--radius);
}
.signup input:focus-visible { outline: 3px solid var(--amber-light); outline-offset: 2px; }
.signup .btn { min-height: 3.2rem; }
.signup-status { margin: 0.9rem 0 0 !important; min-height: 1.5rem; font-size: 1rem !important; color: #ffe3a3 !important; }

.join-buy {
  background: var(--sage);
  color: var(--text);
  padding: 2rem 1.75rem 2.25rem;
  border-radius: var(--radius);
  border-top: 6px solid var(--amber);
}
.h3 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.15;
  color: var(--green);
  margin-bottom: 0.75rem;
}
.join-buy p { font-size: 1.1rem; }
.buy-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

@media (min-width: 58rem) {
  .join { grid-template-columns: 6fr 5fr; gap: 5rem; }
  .join-buy { padding: 2.5rem 2.25rem 2.75rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--night);
  color: #cfe0d6;
  border-top: 4px solid var(--amber);
  padding-top: 3rem;
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--amber-light); }

.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.footer-brand p { margin-top: 1rem; max-width: 26rem; }
.site-footer h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--amber-light);
  margin-bottom: 0.75rem;
}
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 0.4rem; }

.footer-base {
  margin-top: 2.5rem;
  padding-block: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
}
.footer-base p { margin: 0 0 0.35rem; max-width: none; }

@media (min-width: 52rem) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; gap: 3rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .book-sway { animation: none; }
  .book { transition: none; }
  .btn { transition: none; }
}
