/* ============================================
   Pettigrew Publishing — site styles
   Colours, fonts and spacing carried over from the original site.
   ============================================ */

/* === COLOURS, FONTS, SPACING ===
   Change a value here and it changes everywhere. */
:root {
  --bg: #f7f6f2;           /* page background (warm cream) */
  --bg-main: #f6f4ee;      /* header and footer */
  --bg-alt: #efece3;       /* featured-book band */
  --ink: #2b2b2b;          /* main text and headings */
  --ink-muted: #6b6b6b;    /* menu, footer, secondary text */
  --ink-accent: #6f7d6a;   /* sage green links */
  --ink-rule: #d8d6cf;     /* thin divider lines */

  --font-heading: "Times New Roman", Times, serif;
  --font-body: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --fs-sm: clamp(0.83rem, 0.14vi + 0.81rem, 0.92rem);
  --fs-body: clamp(1rem, 0.19vi + 0.96rem, 1.13rem);
  --fs-h3: clamp(1.73rem, 0.48vi + 1.63rem, 2.04rem);
  --fs-h2: clamp(2.07rem, 0.64vi + 1.95rem, 2.49rem);
  --fs-h1: clamp(2.49rem, 0.84vi + 2.32rem, 3.04rem);
  --fs-display: clamp(2.99rem, 1.11vi + 2.76rem, 3.71rem);

  --space-xs: clamp(0.5rem, 2vw, 1rem);
  --space-s: clamp(1rem, 3vw, 2rem);
  --space-m: clamp(2rem, 4vw, 3rem);
  --space-xl: clamp(4rem, 6vw, 6rem);
  --space-paragraph: clamp(1rem, 0.8rem + 0.4vi, 1.4rem);
  --space-content: calc(var(--space-paragraph) * 1.4);

  --container: clamp(1100px, 90vw, 1200px);
  --gutter: clamp(1.25rem, calc(1.25rem + ((1vw - 0.4rem) * 1.7857)), 1.875rem);
}

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

html {
  background: var(--bg);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

a {
  color: var(--ink-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.1;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
}

p {
  max-width: 65ch;
}

/* A centred column, the same width as the original site */
.container {
  width: min(100%, var(--container));
  margin-inline: auto;
  display: flex;
  flex-direction: column;
}

.section {
  padding: var(--space-xl) var(--gutter);
}

.section--alt {
  background: var(--bg-alt);
}

/* Stack of items with even spacing between them */
.stack {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-content);
}

.stack-tight {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-paragraph);
}

/* Hidden link for keyboard users to jump past the menu */
.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 0;
  top: 0;
  background: #000;
  color: #fff;
  padding: 5px 10px;
  z-index: 10;
}

/* === HEADER === */
.site-header {
  background: var(--bg-bg);
  border-bottom: 1px solid var(--ink-rule);
  padding: var(--space-xs) var(--gutter);
}

.site-header .container {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.logo img {
  width: 115px;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.site-nav a {
  color: var(--ink-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* === HOME: INTRO === */
.hero h1 {
  font-size: var(--fs-display);
  max-width: 21ch;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.button {
  display: inline-block;
  padding: 0.4em 1em;
  font-size: 0.9em;
  letter-spacing: 0.5px;
  background: transparent;
  border: 1px solid var(--ink-accent);
  border-radius: 100px;
  color: var(--ink-accent);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}

.button:hover,
.button:focus-visible {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

/* === BOOK LISTING === */
.book-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.book-cover {
  flex: 0 0 auto;
  width: 180px;
  box-shadow: 0 0 9px -2px #616161;
  transition: transform 0.3s;
}

.book-cover:hover {
  transform: scale(1.03);
}

.book-text {
  display: flex;
  flex-direction: column;
  row-gap: var(--space-paragraph);
  justify-content: center;
}

.book-text p {
  max-width: 48ch;
}

.book-title {
  font-weight: 600;
}

/* "Visit the book site" and "Learn more" links: no underline */
.quiet-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quiet-link:hover {
  text-decoration: underline;
}

.muted-link {
  color: var(--ink-muted);
  text-decoration: none;
}

.muted-link:hover {
  color: var(--ink);
}

/* === CONTACT === */
.contact-email {
  font-size: 1.15em;
}

/* === FOOTER === */
.site-footer {
  background: var(--bg-main);
  border-top: 1px solid var(--ink-rule);
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  padding: var(--space-xs) var(--gutter);
}

.site-footer .container {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-footer ul {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.site-footer a {
  color: var(--ink-muted);
  text-decoration: none;
}

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

/* === SMALLER SCREENS === */
@media (max-width: 767px) {
  .logo img {
    width: 100px;
  }
}

@media (max-width: 478px) {
  .logo img {
    width: 80px;
  }

  .site-header .container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .book-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-group {
    row-gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-cover,
  .button {
    transition: none;
  }
}
