/* ============================================================
   PharmaNotes Web — Shared Design System
   Loaded by every page. Module-specific styles stay local.
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300..700&display=swap');

/* ── Colour & spacing tokens — Light ──────────────────────── */
:root, [data-theme="light"] {
  --color-bg:                #f4f6f4;
  --color-surface:           #f8faf8;
  --color-surface-2:         #ffffff;
  --color-surface-offset:    #edf0ed;
  --color-divider:           #d8ddd8;
  --color-border:            #cdd3cd;
  --color-text:              #1e2a1e;
  --color-text-muted:        #5a6b5a;
  --color-text-faint:        #96a896;
  --color-text-inverse:      #f8faf8;
  --color-primary:           #1a6b3c;
  --color-primary-hover:     #145230;
  --color-primary-highlight: #d0e8d8;
  --shadow-sm:  0 1px 3px  oklch(0.2 0.04 150 / 0.07);
  --shadow-md:  0 4px 14px oklch(0.2 0.04 150 / 0.09);
}

/* ── Colour tokens — Dark ──────────────────────────────────── */
[data-theme="dark"] {
  --color-bg:                #161d16;
  --color-surface:           #1c241c;
  --color-surface-2:         #212921;
  --color-surface-offset:    #1a221a;
  --color-divider:           #252d25;
  --color-border:            #303a30;
  --color-text:              #c8d4c8;
  --color-text-muted:        #7a8e7a;
  --color-text-faint:        #4d5f4d;
  --color-text-inverse:      #1c241c;
  --color-primary:           #4da870;
  --color-primary-hover:     #3d9060;
  --color-primary-highlight: #1e3028;
  --shadow-sm:  0 1px 3px  oklch(0 0 0 / 0.20);
  --shadow-md:  0 4px 14px oklch(0 0 0 / 0.30);
}

/* ── Honour system preference when no data-theme is set ────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:                #161d16;
    --color-surface:           #1c241c;
    --color-surface-2:         #212921;
    --color-surface-offset:    #1a221a;
    --color-divider:           #252d25;
    --color-border:            #303a30;
    --color-text:              #c8d4c8;
    --color-text-muted:        #7a8e7a;
    --color-text-faint:        #4d5f4d;
    --color-text-inverse:      #1c241c;
    --color-primary:           #4da870;
    --color-primary-hover:     #3d9060;
    --color-primary-highlight: #1e3028;
    --shadow-sm:  0 1px 3px  oklch(0 0 0 / 0.20);
    --shadow-md:  0 4px 14px oklch(0 0 0 / 0.30);
  }
}

/* ── Scale & spacing tokens ────────────────────────────────── */
:root {
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-full: 9999px;

  --space-2:  .5rem;
  --space-3:  .75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --text-xs:   clamp(0.75rem,  .70rem + .25vw, .875rem);
  --text-sm:   clamp(0.875rem, .80rem + .35vw, 1rem);
  --text-base: clamp(1rem,     .95rem + .25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem   + .75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem + 2.5vw,  3.5rem);

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', 'Helvetica Neue', sans-serif;

  --t: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ── Base ──────────────────────────────────────────────────── */
html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}
img, svg { display: block; max-width: 100%; }
button  { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
a       { color: inherit; text-decoration: none; }
a, button { transition: color var(--t), background var(--t), box-shadow var(--t), border-color var(--t); }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; font-family: var(--font-display); }
p { text-wrap: pretty; }

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

/* ── Badges (used on module cards and module pages) ─────────── */
.badge {
  display: inline-block;
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .15em var(--space-2); border-radius: var(--radius-full);
}
.badge-ready {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}
.badge-soon {
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-8);
  margin-top: var(--space-12);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer-inner p {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}
@media (max-width: 600px) {
  .footer-inner { flex-direction: column; text-align: center; }
}