/* ============================================================
   base.css — Town Weekly Ads: design system foundation
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  /* Backgrounds — warm parchment palette */
  --color-bg:         #F8F4EF;   /* page background, warm off-white */
  --color-bg-subtle:  #F0EBE2;   /* inset sections, table zebra */
  --color-surface:    #FFFFFF;   /* cards, modals */

  /* Ink — deep warm tones */
  --color-ink:        #1C1410;   /* primary text */
  --color-ink-muted:  #6B5E54;   /* secondary text, labels */
  --color-ink-faint:  #A89890;   /* placeholder, disabled text */

  /* Accent */
  --color-accent:       #4A6741;
  --color-accent-hover: #3A5232;

  /* Borders */
  --color-border:       #E2D9D0;
  --color-border-strong: #BFB3A8;

  /* Semantic */
  --color-success:  #2A7A4B;
  --color-error:    #C42D2D;
  --color-warning:  #B45309;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Font sizes */
  --font-size-xs:   0.75rem;    /* 12px */
  --font-size-sm:   0.875rem;   /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-md:   1.125rem;   /* 18px */
  --font-size-lg:   1.25rem;    /* 20px */
  --font-size-xl:   1.5rem;     /* 24px */
  --font-size-2xl:  2rem;       /* 32px */

  /* Spacing — 4px base scale */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;

  /* Border radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;

  /* Shadows — gentle lift only */
  --shadow-sm: 0 1px 3px rgba(28, 20, 16, 0.06);
  --shadow-md: 0 4px 12px rgba(28, 20, 16, 0.10);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-ink);
  background-color: var(--color-bg);
  /* Warm paper quality via subtle tonal shift */
  background-image:
    radial-gradient(ellipse at 15% 40%, rgba(196, 98, 45, 0.025) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(196, 98, 45, 0.02) 0%, transparent 50%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font: inherit;
}

ul, ol {
  list-style: none;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--color-ink);
  font-weight: 700;
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl);  }
h3 { font-size: var(--font-size-lg);  }
h4 { font-size: var(--font-size-md);  }
h5 { font-size: var(--font-size-base); font-weight: 600; }
h6 { font-size: var(--font-size-sm);  font-weight: 600; }

p {
  max-width: 68ch;
}

strong { font-weight: 600; }
em { font-style: italic; }

small {
  font-size: var(--font-size-sm);
  color: var(--color-ink-muted);
}

/* ── Layout utilities ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 960px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: 560px;
}

/* ── Text utilities ────────────────────────────────────────── */
.text-muted   { color: var(--color-ink-muted) !important; }
.text-faint   { color: var(--color-ink-faint) !important; }
.text-accent  { color: var(--color-accent)    !important; }
.text-error   { color: var(--color-error)     !important; }
.text-success { color: var(--color-success)   !important; }
.text-warning { color: var(--color-warning)   !important; }
.text-sm      { font-size: var(--font-size-sm); }
.text-xs      { font-size: var(--font-size-xs); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }

/* ── Spacing utilities ─────────────────────────────────────── */
.mt-1  { margin-top: var(--space-1); }
.mt-2  { margin-top: var(--space-2); }
.mt-3  { margin-top: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }

.mb-1  { margin-bottom: var(--space-1); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-3  { margin-bottom: var(--space-3); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }

.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* ── Flex helpers ──────────────────────────────────────────── */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-6);
}

/* ── Screenreader only ─────────────────────────────────────── */
.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;
}
