/* ==========================================================================
   Kaikoura Pharmacy
   Style: Accessible & Ethical — high contrast, generous targets, no motion tricks.
   Palette recovered from the 2022 Wayback capture (#8c3e04 / #c15c0f) and
   rebuilt into a scale where every pairing clears WCAG AA. See REBUILD-BRIEF.md §3.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&display=swap');

/* --- Tokens --------------------------------------------------------------- */

:root {
  /* Brand */
  --brand-900: #6b2f03;
  --brand-800: #8c3e04;   /* primary — 7.5:1 on white, white on it 7.5:1 */
  --brand-600: #c15c0f;   /* accent — large text & decoration only (4.4:1) */
  --brand-100: #f6e3d3;
  --brand-50:  #fdf6f0;

  /* Ink */
  --ink:        #1f1a17;  /* 15.8:1 on white */
  --ink-muted:  #5c534d;  /*  7.5:1 on white */
  --ink-invert: #fffaf6;

  /* Surfaces */
  --surface:     #ffffff;
  --surface-alt: #fbf7f4;
  --border:      #e2d8d0;
  --border-firm: #c9bbb0;

  /* Semantic */
  --emergency:   #8c1f1f;  /* 8.9:1 on white */
  --emergency-bg:#fdf2f2;
  --success:     #1f6b3a;

  /* Type */
  --font-head: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Spacing — 4px base */
  --s1: .25rem;  --s2: .5rem;   --s3: .75rem;  --s4: 1rem;
  --s5: 1.5rem;  --s6: 2rem;    --s7: 3rem;    --s8: 4rem;   --s9: 6rem;

  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 1px 2px rgba(31, 26, 23, .06), 0 4px 16px rgba(31, 26, 23, .06);
  --shadow-lg: 0 2px 4px rgba(31, 26, 23, .06), 0 12px 32px rgba(31, 26, 23, .10);

  --container: 1140px;
  --measure:   68ch;

  /* z-scale */
  --z-nav: 30;
  --z-skip: 50;
}

/* --- Reset ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;          /* 17px — never below 16 */
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
  margin: 0 0 var(--s4);
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.5vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 1.08rem + .5vw, 1.4rem); }
h4 { font-size: 1.0625rem; font-weight: 600; }

p, ul, ol { margin: 0 0 var(--s4); }
p { max-width: var(--measure); }

a { color: var(--brand-800); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--brand-900); }

/* One focus treatment, everywhere. */
:focus-visible {
  outline: 3px solid var(--brand-800);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- Utilities ------------------------------------------------------------ */

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--s5); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: var(--s2); left: var(--s2);
  z-index: var(--z-skip);
  transform: translateY(-200%);
  background: var(--brand-800); color: var(--ink-invert);
  padding: var(--s3) var(--s5);
  border-radius: var(--radius);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { transform: translateY(0); color: var(--ink-invert); }

.section { padding-block: clamp(var(--s7), 6vw, var(--s9)); }
.section--tint { background: var(--brand-50); }
.section--alt  { background: var(--surface-alt); }

.section-head { max-width: var(--measure); margin-bottom: var(--s6); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center p { margin-inline: auto; }

.eyebrow {
  font-family: var(--font-head);
  font-size: .8125rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--brand-800);
  margin: 0 0 var(--s2);
}

.lede { font-size: 1.1875rem; color: var(--ink-muted); }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2);
  min-height: 48px;                 /* > 44px target */
  padding: var(--s3) var(--s5);
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn svg { flex: none; width: 20px; height: 20px; }

.btn--primary { background: var(--brand-800); color: var(--ink-invert); }
.btn--primary:hover { background: var(--brand-900); color: var(--ink-invert); }

.btn--secondary {
  background: var(--surface); color: var(--brand-800);
  border-color: var(--border-firm);
}
.btn--secondary:hover { background: var(--brand-50); border-color: var(--brand-800); color: var(--brand-900); }

.btn--ghost-invert {
  background: transparent; color: var(--ink-invert);
  border-color: rgba(255, 250, 246, .6);
}
.btn--ghost-invert:hover { background: rgba(255, 250, 246, .14); color: var(--ink-invert); border-color: var(--ink-invert); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* --- Header / nav --------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  min-height: 76px;
}

.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; }
.brand:hover { color: inherit; }
.brand__mark { flex: none; width: 40px; height: 40px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name {
  font-family: var(--font-head); font-weight: 700;
  font-size: 1.1875rem; color: var(--brand-800);
  letter-spacing: -.01em;
}
.brand__since { font-size: .75rem; color: var(--ink-muted); letter-spacing: .06em; text-transform: uppercase; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--surface); border: 1px solid var(--border-firm);
  border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.nav-toggle:hover { background: var(--brand-50); border-color: var(--brand-800); }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open  { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

.nav__list { display: flex; align-items: center; gap: var(--s1); list-style: none; margin: 0; padding: 0; }

.nav__link {
  display: flex; align-items: center;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  font-family: var(--font-head); font-weight: 500; font-size: .9875rem;
  color: var(--ink); text-decoration: none;
  border-radius: var(--radius);
  border-bottom: 3px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.nav__link:hover { background: var(--brand-50); color: var(--brand-900); }
.nav__link[aria-current="page"] { color: var(--brand-800); font-weight: 700; border-bottom-color: var(--brand-800); border-radius: var(--radius) var(--radius) 0 0; }

.nav__cta { margin-left: var(--s3); }

@media (max-width: 900px) {
  .nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    padding: var(--s3) var(--s5) var(--s5);
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__link {
    min-height: 52px;
    padding-inline: var(--s3);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .nav__link[aria-current="page"] {
    border-bottom-color: var(--border);
    border-left: 4px solid var(--brand-800);
    padding-left: calc(var(--s3) - 4px + var(--s2));
  }
  .nav__cta { margin: var(--s4) 0 0; }
  .nav__cta .btn { width: 100%; }
}
@media (min-width: 901px) {
  .nav-toggle { display: none; }
  .nav { display: block !important; }
}

/* --- Hero ----------------------------------------------------------------- */

.hero {
  position: relative;
  /* TODO: once assets/img/hero.jpg is recovered from the archive, add it here as a
     background-image layered under this gradient. See REBUILD-BRIEF.md §6.4 */
  background:
    radial-gradient(1200px 600px at 15% -10%, #a34b07 0%, transparent 60%),
    linear-gradient(140deg, var(--brand-900) 0%, var(--brand-800) 55%, #a04a06 100%);
  color: var(--ink-invert);
  padding-block: clamp(var(--s7), 8vw, var(--s9));
}
.hero h1 { color: var(--ink-invert); max-width: 16ch; }
.hero p { color: rgba(255, 250, 246, .93); }
.hero .lede { color: rgba(255, 250, 246, .93); font-size: 1.25rem; max-width: 46ch; }
.hero__inner { display: grid; gap: var(--s7); align-items: center; }
@media (min-width: 900px) { .hero__inner { grid-template-columns: 1.15fr .85fr; } }

.hero__status {
  display: inline-flex; align-items: center; gap: var(--s2);
  background: rgba(255, 250, 246, .14);
  border: 1px solid rgba(255, 250, 246, .3);
  border-radius: 999px;
  padding: var(--s2) var(--s4);
  font-size: .9375rem; font-weight: 600;
  margin-bottom: var(--s5);
}
.hero__status .dot { width: 9px; height: 9px; border-radius: 50%; background: #7ee2a8; flex: none; }
.hero .btn-row { margin-top: var(--s6); }

.hero-card {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: var(--s6);
  box-shadow: var(--shadow-lg);
}
.hero-card h2 { font-size: 1.25rem; margin-bottom: var(--s4); }

/* --- Pillars (recovered from the original three tiles) -------------------- */

.pillars { display: grid; gap: var(--s5); }
@media (min-width: 760px) { .pillars { grid-template-columns: repeat(3, 1fr); } }

.pillar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-800);
  border-radius: var(--radius);
  padding: var(--s6);
}
.pillar__icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--brand-50);
  border-radius: var(--radius);
  color: var(--brand-800);
  margin-bottom: var(--s4);
}
.pillar__icon svg { width: 24px; height: 24px; }
.pillar h3 { margin-bottom: var(--s2); }
.pillar p { color: var(--ink-muted); margin: 0; }

/* --- Generic cards / lists ------------------------------------------------ */

.grid { display: grid; gap: var(--s5); }
@media (min-width: 760px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s6);
}
.card--flush { padding: var(--s5); }
.card h3 { display: flex; align-items: center; gap: var(--s3); }
.card h3 svg { width: 24px; height: 24px; color: var(--brand-800); flex: none; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  position: relative;
  padding: var(--s2) 0 var(--s2) var(--s6);
  border-bottom: 1px solid var(--border);
}
.check-list li:last-child { border-bottom: 0; }
.check-list li::before {
  content: "";
  position: absolute; left: 0; top: 1.05em;
  width: 18px; height: 10px;
  border-left: 2.5px solid var(--brand-800);
  border-bottom: 2.5px solid var(--brand-800);
  transform: rotate(-45deg);
}

.prose { max-width: var(--measure); }
.prose > :last-child { margin-bottom: 0; }

/* --- Contact / hours details --------------------------------------------- */

.detail-list { list-style: none; margin: 0; padding: 0; }
.detail-list li { display: flex; gap: var(--s4); padding-block: var(--s3); border-bottom: 1px solid var(--border); }
.detail-list li:last-child { border-bottom: 0; }
.detail-list svg { width: 22px; height: 22px; color: var(--brand-800); flex: none; margin-top: 4px; }
.detail-list dt, .detail-list .label {
  font-size: .8125rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-muted);
  margin-bottom: 2px;
}
.detail-list a { font-weight: 600; }

.hours { width: 100%; border-collapse: collapse; }
.hours caption { text-align: left; font-weight: 600; margin-bottom: var(--s3); font-family: var(--font-head); }
.hours th, .hours td { padding: var(--s3) 0; border-bottom: 1px solid var(--border); text-align: left; }
.hours th { font-weight: 500; }
.hours td { text-align: right; font-variant-numeric: tabular-nums; }
.hours tr:last-child th, .hours tr:last-child td { border-bottom: 0; }
.hours .is-closed { color: var(--ink-muted); }

/* Remove this note once David confirms the hours — REBUILD-BRIEF.md §6.1 */
.hours-caveat {
  margin: var(--s3) 0 0;
  font-size: .875rem;
  color: var(--ink-muted);
  border-left: 3px solid var(--brand-600);
  padding-left: var(--s3);
}

.callout {
  border-radius: var(--radius);
  padding: var(--s5);
  border: 1px solid var(--border);
  background: var(--surface-alt);
}
.callout > :last-child { margin-bottom: 0; }
.callout h3 { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); font-size: 1.125rem; }
.callout svg { width: 22px; height: 22px; flex: none; }

.callout--emergency { background: var(--emergency-bg); border-color: #e9c9c9; }
.callout--emergency h3 { color: var(--emergency); }
.callout--emergency svg { color: var(--emergency); }
.callout--emergency a { color: var(--emergency); font-weight: 700; }

.callout--privacy { background: var(--brand-50); border-color: var(--brand-100); }
.callout--privacy h3 svg { color: var(--brand-800); }

/* --- CTA band ------------------------------------------------------------- */

.cta-band {
  background: var(--brand-800);
  color: var(--ink-invert);
  padding-block: clamp(var(--s7), 6vw, var(--s8));
}
.cta-band h2 { color: var(--ink-invert); }
.cta-band p { color: rgba(255, 250, 246, .93); }
.cta-band__inner { display: grid; gap: var(--s5); align-items: center; }
@media (min-width: 860px) { .cta-band__inner { grid-template-columns: 1fr auto; } }

/* --- Multilingual strip (kept from the original home page) ---------------- */

.langs {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--s2) var(--s5);
  list-style: none; margin: 0 0 var(--s5); padding: 0;
  color: var(--ink-muted);
  font-size: 1.0625rem;
}
.langs li { white-space: nowrap; }

/* --- Forms ---------------------------------------------------------------- */

.form { max-width: 44rem; }
.form__grid { display: grid; gap: var(--s5); }
@media (min-width: 700px) { .form__grid--2 { grid-template-columns: repeat(2, 1fr); } }

.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-weight: 600; font-family: var(--font-head); }
.field .hint { font-size: .875rem; color: var(--ink-muted); }
.req { color: var(--emergency); font-weight: 700; }

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 1rem;
  min-height: 48px;
  padding: var(--s3) var(--s4);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border-firm);
  border-radius: var(--radius);
  transition: border-color .2s ease, box-shadow .2s ease;
  width: 100%;
}
.field textarea { min-height: 8rem; resize: vertical; line-height: 1.6; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-muted); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-800);
  box-shadow: 0 0 0 3px var(--brand-100);
  outline: 3px solid transparent;   /* focus ring drawn by box-shadow + border */
}

/* Error state uses a border, an icon-marked message AND text — not colour alone */
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--emergency); border-width: 2px; }

.field__error {
  display: none;
  align-items: flex-start; gap: var(--s2);
  color: var(--emergency);
  font-size: .9375rem; font-weight: 600;
}
.field.has-error .field__error { display: flex; }
.field__error svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); margin: 0; }
legend { font-family: var(--font-head); font-weight: 600; padding-inline: var(--s2); }

.radio-row { display: flex; flex-wrap: wrap; gap: var(--s5); }
.radio {
  display: flex; align-items: center; gap: var(--s2);
  min-height: 44px; cursor: pointer; font-weight: 500;
}
.radio input { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand-800); cursor: pointer; }

.form__status {
  display: none;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-radius: var(--radius);
  margin-bottom: var(--s5);
  font-weight: 500;
}
.form__status.is-visible { display: flex; }
.form__status svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.form__status--error   { background: var(--emergency-bg); border: 1px solid #e9c9c9; color: var(--emergency); }
.form__status--success { background: #f0f8f2; border: 1px solid #c6e2d0; color: var(--success); }

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

.site-footer {
  background: #2a211b;
  color: #ece3dc;
  padding-block: var(--s8) var(--s6);
  margin-top: var(--s8);
}
.site-footer a { color: #ffd9bd; }
.site-footer a:hover { color: #fff; }
.site-footer h2 { color: #fff; font-size: 1.0625rem; margin-bottom: var(--s4); }

.site-footer__grid { display: grid; gap: var(--s6); }
@media (min-width: 760px)  { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }

.footer-brand__name { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; color: #fff; }
.footer-brand p { color: #c8bbb1; font-size: .9375rem; }

.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: var(--s2); }
.footer-list a { display: inline-flex; align-items: center; min-height: 32px; }

.site-footer__base {
  margin-top: var(--s7); padding-top: var(--s5);
  border-top: 1px solid rgba(255, 255, 255, .14);
  display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between;
  font-size: .875rem; color: #b7a99e;
}
.site-footer__base p { margin: 0; max-width: none; }

/* --- Breadcrumb ----------------------------------------------------------- */

.breadcrumb { padding-block: var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: var(--s2); list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.breadcrumb li + li::before { content: "/"; margin-right: var(--s2); color: var(--ink-muted); }
.breadcrumb [aria-current="page"] { color: var(--ink-muted); }

/* --- Page header (interior pages) ---------------------------------------- */

.page-head { background: var(--brand-50); padding-block: clamp(var(--s6), 5vw, var(--s8)); border-bottom: 1px solid var(--brand-100); }
.page-head h1 { margin-bottom: var(--s3); }
.page-head p { margin-bottom: 0; }

/* --- Preferences ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .skip-link { transition: none; }
}

@media (prefers-contrast: more) {
  :root {
    --border: #8a7d73;
    --border-firm: #574d45;
    --ink-muted: #443c36;
    --brand-50: #ffffff;
    --surface-alt: #ffffff;
  }
  .btn { border-color: currentColor; }
  .pillar, .card { border-width: 2px; }
}

@media print {
  .site-header, .nav, .cta-band, .btn, .skip-link, .breadcrumb { display: none !important; }
  body { color: #000; font-size: 12pt; }
  .hero { background: none !important; color: #000; }
  .hero h1, .hero p, .hero .lede { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  .site-footer { background: none; color: #000; margin-top: var(--s5); }
}
