/* No Piggie Press — site styles
   Colors come from the No Piggie Press banner and watercolor artwork. */

:root {
  --blue: #2b5d7a;        /* deep banner blue */
  --blue-mid: #467387;    /* light banner blue */
  --blue-ink: #1d3a4c;    /* text on white */
  --page: #ffffff;
  --soft: #eef3f6;        /* pale blue panels */
  --line: #d9e3ea;
  --muted: #557080;
  --hardcover: #2b5d7a;   /* switch + buttons when Hardcover is picked */
  --paperback: #7b5aa6;   /* switch + buttons when Paperback is picked (lavender from the banner) */
  --radius: 16px;
  --display: "Fredoka", "Trebuchet MS", sans-serif;
  --body: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--blue-ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--blue); }
a:hover { color: var(--blue-ink); }
img { max-width: 100%; display: block; }

.wrap {
  width: min(1120px, 100% - 40px);
  margin-inline: auto;
}

/* ---------- Header (watercolor bar with white logo) ---------- */
.site-header {
  background: var(--blue) url("../images/watercolor.webp") center / cover;
  color: #fff;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}
.brand { display: block; line-height: 0; }
.brand img { width: 140px; height: auto; }
.site-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 999px;
}
.site-nav a:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.site-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.22); }

/* ---------- Home banner (rounded, same width as the book cards) ---------- */
.banner {
  background: #2b5d7a url("../images/banner.webp") right center / cover no-repeat;
  aspect-ratio: 2048 / 600;
  min-height: 160px;
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 64px;
}

/* ---------- Books ---------- */
.section-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  line-height: 1.1;
  color: var(--blue);
  text-align: center;
  margin: 56px 0 32px;
}

.books {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  padding-bottom: 64px;   /* same as the gap below the banner */
}
.book {
  background: var(--soft);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}
/* Covers have different shapes; this frame keeps titles lined up. */
.cover-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  margin-bottom: 22px;
}
.book-cover {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 12px 26px rgba(29, 58, 76, 0.25);
}
.book h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--blue-ink);
  margin: 0 0 6px;
}
.book .author {
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 0.95rem;
}
.book .blurb { margin: 0 0 22px; flex: 1; }

/* Format switch: Hardcover | Paperback (works without JavaScript) */
.formats { border: 0; margin: 0; padding: 0; min-width: 0; }
.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;
}
.fmt { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}
.switch label {
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1rem;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.switch label:hover { color: var(--blue); }
.switch, .switch label, .buy .btn { transition: background-color .2s, color .2s, border-color .2s; }
.fmt-hc:checked ~ .switch { border-color: var(--hardcover); }
.fmt-pb:checked ~ .switch { border-color: var(--paperback); }
.fmt-hc:checked ~ .switch .lbl-hc { background: var(--hardcover); color: #fff; }
.fmt-pb:checked ~ .switch .lbl-pb { background: var(--paperback); color: #fff; }
.fmt-hc:focus-visible ~ .switch .lbl-hc,
.fmt-pb:focus-visible ~ .switch .lbl-pb { outline: 3px solid var(--blue-mid); outline-offset: 2px; }
.fmt-hc:checked ~ .buy-pb,
.fmt-pb:checked ~ .buy-hc { display: none; }

.buy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.buy .btn { flex: 1 1 auto; justify-content: center; }
.buy-hc .btn { --fmt: var(--hardcover); }
.buy-pb .btn { --fmt: var(--paperback); }
.buy .btn { border-color: var(--fmt); color: var(--fmt); }
.buy .btn:hover { background: var(--fmt); color: #fff; }
.ico { width: 15px; height: 15px; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--blue);
  background: #fff;
  color: var(--blue);
  text-decoration: none;
  font-family: var(--body);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.btn:hover { background: var(--blue); color: #fff; }
.btn:focus-visible { outline: 3px solid var(--blue-mid); outline-offset: 2px; }
.btn-primary { background: var(--blue); color: #fff; font-size: 1rem; padding: 12px 24px; }
.btn-primary:hover { background: var(--blue-ink); border-color: var(--blue-ink); }

/* ---------- Contact ---------- */
.contact {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 0 90px;
}
.contact h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.1;
  color: var(--blue);
  margin: 0 0 10px;
}
.contact > p { color: var(--muted); margin: 0 0 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--blue-ink);
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--blue-mid); }
.field textarea { min-height: 170px; resize: vertical; }

/* Honeypot: hidden from people, visible to bots */
.hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.notice { padding: 14px 16px; border-radius: 12px; margin-bottom: 22px; }
.notice-ok { background: #e3f4ee; border: 1px solid #9fd8c4; }
.notice-error { background: #fdecef; border: 1px solid #f2bcc7; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--blue) url("../images/watercolor.webp") center / cover;
  color: #fff;
  padding: 28px 0;
  font-size: 0.95rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer a { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 600px) {
  .brand img { width: 104px; }
  .site-nav a { padding: 6px 12px; font-size: 1rem; }
  .section-title { margin: 40px 0 24px; }
  .book { padding: 20px; }
}

/* Character counter under the message box */
.count { text-align: right; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.count-full { color: #b3261e; font-weight: 700; }
