/* Brothers Family Books — shared stylesheet
   Design tokens are PROPOSED (Phase 1 design review), not yet locked. */

:root {
  /* Colour */
  --color-bg: #f6f1e8;
  --color-surface: #fffdf9;
  --color-band: #ece4d6;
  --color-ink: #1f1b16;
  --color-muted: #5a5146;
  --color-rule: #d5cab8;
  --color-accent: #7a3b1e;
  --color-on-ink: #fffdf9;

  /* Type — system stacks only; no web-font downloads */
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  /* Layout */
  --container: 76rem;
  --gutter: 1rem;
  --tap: 2.75rem; /* 44px minimum tap target */
  --radius: 4px;

  /* Cover proportion — LOCKED: 8.5" x 8.5" trim, square front cover */
  --cover-ratio: 1 / 1;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Keeps the footer at the bottom of the window on short pages */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

main {
  flex: 1 0 auto;
}

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

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 6vw + 0.5rem, 3.5rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.5rem, 3vw + 0.75rem, 2.25rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 var(--space-2);
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--color-ink);
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--container);
  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: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--color-ink);
  color: var(--color-on-ink);
}

.skip-link:focus {
  top: var(--space-1);
  color: var(--color-on-ink);
}

.eyebrow {
  margin: 0 0 var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- Header and navigation ---------- */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-rule);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-3);
  padding-block: var(--space-1);
}

/* Two-line wordmark: BROTHERS above FAMILY BOOKS, left-aligned, with both
   lines in identical type so neither is emphasised over the other. */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: var(--tap);
  padding-block: 0.5rem;
  color: var(--color-ink);
  font-family: var(--font-serif);
  line-height: 1.15;
  text-decoration: none;
}

.wordmark__initials,
.wordmark__name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.375rem;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-inline: 0.375rem;
  color: var(--color-ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--space-4);
}

.section--band {
  background: var(--color-band);
}

.section__header {
  max-width: 40rem;
  margin: 0 auto var(--space-3);
  text-align: center;
}

.section__footer {
  margin-top: var(--space-4);
  text-align: center;
}

.intro {
  padding-block: var(--space-4) var(--space-3);
  text-align: center;
}

.intro__inner {
  max-width: 44rem;
}

.intro__lead {
  font-size: 1.125rem;
  color: var(--color-muted);
}

.mission__inner {
  max-width: 42rem;
  text-align: center;
}

.mission__text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.5;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.625rem 1.5rem;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius);
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

a.btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-ink);
}

.btn--secondary {
  background: transparent;
  color: var(--color-ink);
}

a.btn--secondary:hover {
  background: var(--color-ink);
  border-color: var(--color-ink);
}

/* Unpublished books: the Amazon button stays visible but cannot be used */
.btn:disabled {
  background: #d8cfbf;
  border-color: #d8cfbf;
  color: #4d453b;
  cursor: not-allowed;
}

.btn--secondary:disabled {
  background: transparent;
  border-color: #b3a792;
  border-style: dashed;
}

/* Preview Inside: third action, opens the in-page gallery */
.btn--preview {
  display: flex;
  width: 100%;
  justify-content: space-between;
  background: var(--color-surface);
  border-color: var(--color-accent);
  color: var(--color-accent);
  cursor: pointer;
  list-style: none;
}

.btn--preview::-webkit-details-marker {
  display: none;
}

.btn--preview::before {
  content: "";
  width: 1em;
}

.btn--preview::after {
  content: "+";
  width: 1em;
  font-size: 1.25rem;
  line-height: 1;
  text-align: right;
}

.preview[open] > .btn--preview::after {
  content: "\2212";
}

.btn--preview:not(:disabled):hover {
  background: var(--color-accent);
  color: var(--color-on-ink);
}

/* No approved previews yet: visible, but there is no gallery to open */
.btn--preview:disabled {
  background: transparent;
  border-color: #b3a792;
  border-style: dotted;
}

.btn--preview:disabled::after,
.btn--preview-link::after {
  content: "";
}

/* ---------- Book grid and cards ----------
   Catalog grid: 1 column on phones, 2 on tablets, 3 on desktop, 4 on wide
   screens. Adding a book means adding one more .book-card to the list. */

.book-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4) var(--space-3);
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 26rem;
  margin-inline: auto;
  scroll-margin-top: var(--space-2);
}

.book-card__title {
  margin-bottom: 0.75rem;
  font-size: 1.125rem;
  text-align: center;
}

.book-card__cover {
  aspect-ratio: var(--cover-ratio);
  width: 100%;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgb(31 27 22 / 0.08), 0 8px 24px rgb(31 27 22 / 0.1);
}

.book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* never crop or stretch a cover */
}

/* Honest stand-in until approved cover art is supplied */
.book-card__cover--placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: var(--space-2);
  border: 2px dashed var(--color-rule);
  box-shadow: none;
  color: var(--color-muted);
  text-align: center;
}

.book-card__placeholder-label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.book-card__placeholder-note {
  font-size: 0.875rem;
}

/* Published books: Buy or Review on Amazon, then Preview Inside — in that order,
   directly under the cover with nothing in between. */
.book-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: var(--space-2);
}

/* Small status shown with the title, above the cover */
.book-card__flag {
  margin: -0.25rem 0 0.75rem;
  color: var(--color-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.book-card:has(.book-card__flag) .book-card__title {
  margin-bottom: 0.5rem;
}

/* Preview gallery: up to three interior images, shown below all three actions */
.preview__list {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.preview__list img {
  width: 100%;
  height: auto; /* keep each interior image's own proportions */
}

/* Homepage feature status label, deliberately not styled as a button */
.book-card__status {
  margin: var(--space-2) 0 0;
  padding: 0.75rem 1rem;
  border-block: 1px solid var(--color-rule);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-style: italic;
  text-align: center;
}

.book-card__description {
  margin: var(--space-2) 0 0;
  color: var(--color-muted);
  font-size: 0.9375rem;
  text-align: center;
}

/* ---------- Text pages (About Us, Contact, 404) ---------- */

.prose {
  max-width: 42rem;
}

.prose h2 {
  margin-top: var(--space-4);
}

.prose h2:first-child {
  margin-top: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: var(--space-3) 0 0;
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: var(--space-4) var(--space-3);
  background: var(--color-ink);
  color: var(--color-on-ink);
}

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

.site-footer :focus-visible {
  outline-color: var(--color-on-ink);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-3);
}

.site-footer .wordmark {
  color: var(--color-on-ink);
}

.site-footer__heading {
  margin: 0 0 var(--space-1);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-footer__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.site-footer p {
  font-size: 0.9375rem;
}

/* Email links: never push the page wider than a phone screen */
a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

.site-footer a[href^="mailto:"] {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.site-footer__legal {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid rgb(255 253 249 / 0.25);
}

/* Small Privacy link at the end of the copyright line */
.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1rem;
}

.site-footer__privacy {
  padding-block: 0.625rem;
}

/* ---------- Breakpoints ---------- */

/* Tablet: two books per row */
@media (min-width: 40rem) {
  :root {
    --gutter: 1.5rem;
  }

  .site-nav ul {
    column-gap: var(--space-1);
    margin-inline: -0.5rem;
  }

  .site-nav a {
    padding-inline: 0.5rem;
    font-size: 0.9375rem;
  }

  .section {
    padding-block: var(--space-5);
  }

  .intro {
    padding-block: var(--space-5) var(--space-4);
  }

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

  /* Homepage feature: stays a centred pair at every larger width */
  .book-grid--featured {
    max-width: 48rem;
    margin-inline: auto;
  }

  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

/* Desktop: three books per row */
@media (min-width: 64rem) {
  :root {
    --gutter: 2rem;
  }

  .book-grid:not(.book-grid--featured) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Wide desktop: four books per row */
@media (min-width: 90rem) {
  .book-grid:not(.book-grid--featured) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
