/* ============================================================
   Weight Loss Pens UK — design system
   Practical field-guide feel. Forest & olive green on stone.
   Fonts: "Space Grotesk" (display) + "IBM Plex Sans" (body).
   Light mode only.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; }

/* ---------- Tokens ---------- */
:root {
  --stone: #f5f4ee;            /* page background — warm stone */
  --stone-raised: #fefdf9;     /* cards, callouts, table bodies */
  --stone-sunken: #eae8db;     /* wells, table heads, subtle bands */
  --ink: #22271f;              /* primary text */
  --ink-soft: #4c5244;         /* secondary text */
  --ink-faint: #7d8272;        /* meta, captions */
  --forest: #38672f;           /* primary accent — forest green */
  --forest-deep: #29501f;      /* hover / active */
  --forest-wash: #e7eedd;      /* tinted backgrounds */
  --forest-night: #1f3319;     /* footer ground */
  --olive: #6f7d3f;            /* secondary accent — kickers, details */
  --line: #ddd9c8;             /* hairline borders */
  --line-strong: #c3bda4;
  --clay-wash: #f7ecdc;        /* warnings only */
  --clay-edge: #b96a2c;
  --clay-ink: #8a4a15;
  --display: "Space Grotesk", "Archivo", -apple-system, Helvetica, Arial, sans-serif;
  --body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --measure: 720px;            /* article measure */
  --wide: 1100px;              /* topbar / footer measure */
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-soft: 0 1px 2px rgba(34, 39, 31, 0.05), 0 5px 18px rgba(34, 39, 31, 0.06);
}

/* ---------- Base ---------- */
body {
  font-family: var(--body);
  font-size: 1.0625rem;              /* 17px */
  line-height: 1.7;
  color: var(--ink);
  background: var(--stone);
}

::selection { background: var(--forest-wash); color: var(--forest-deep); }

a { color: var(--forest); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--forest-deep); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--forest-deep);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Topbar ----------
   Flavour: solid stone bar with a forest "spine" along the top edge,
   uppercase tab-style nav with underline indicators (no pills). */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 244, 238, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 4px solid var(--forest);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand .brand-mark { flex: 0 0 auto; }
.brand em { font-style: normal; color: var(--forest); }

.nav { display: flex; align-items: center; gap: 0.35rem; }
.nav a {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.45rem 0.55rem 0.35rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--forest-deep); border-bottom-color: var(--line-strong); }
.nav a[aria-current="page"] { color: var(--forest-deep); border-bottom-color: var(--forest); }

.nav-toggle {
  display: none;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-soft);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--stone-raised);
}
.nav-toggle:hover { color: var(--forest-deep); border-color: var(--forest); }

/* ---------- Page scaffold ---------- */
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.wrap.narrow { max-width: var(--measure); }

main { display: block; }

/* ---------- Hero (home page) ---------- */
.hero {
  background: linear-gradient(180deg, var(--forest-wash) 0%, var(--stone) 100%);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 3rem;
}
.hero .kicker { margin-bottom: 0.9rem; }
.hero-title {
  font-family: var(--display);
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: 21ch;
  text-wrap: balance;
  margin-bottom: 1rem;
}
.hero-sub {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 58ch;
  margin-bottom: 1.6rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.kicker {
  display: inline-block;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--olive);
}

/* Buttons (navigation only — never commerce) */
.btn {
  display: inline-block;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  padding: 0.62rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--forest);
  color: #fff;
  border: 1px solid var(--forest);
}
.btn:hover { background: var(--forest-deep); border-color: var(--forest-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--forest-deep); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--forest); background: var(--forest-wash); }

/* ---------- Article typography ---------- */
.article,
.article-body {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.article { padding-top: 3rem; padding-bottom: 4rem; }

.article h1,
.page-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}
.article-body h2,
.article h2 {
  font-family: var(--display);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.6rem 0 0.9rem;
}
/* practical-guide rhythm: a short olive rule above each section */
.article-body h2::before,
.article h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--olive);
  margin-bottom: 0.65rem;
}
.article-body h3,
.article h3 {
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.7rem;
}
.article-body p, .article p { margin-bottom: 1.15rem; }
.article-body ul, .article-body ol,
.article ul, .article ol { margin: 0 0 1.15rem 1.4rem; }
.article-body li, .article li { margin-bottom: 0.45rem; }
.article-body li::marker, .article li::marker { color: var(--olive); }
.article-body strong, .article strong { font-weight: 600; }

.article-meta,
.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.lede {
  font-size: 1.18rem;
  line-height: 1.65;
  color: var(--ink-soft);
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--olive);
  color: var(--ink-soft);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

figure { margin: 1.75rem 0; }
figcaption { font-size: 0.85rem; color: var(--ink-faint); margin-top: 0.5rem; }

/* ---------- Data tables (informational only — never pricing) ---------- */
.table-scroll { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.925rem; background: var(--stone-raised); }
caption { text-align: left; font-size: 0.85rem; color: var(--ink-faint); padding: 0.6rem 0.9rem; caption-side: bottom; }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  font-family: var(--display);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--forest-deep);
  background: var(--forest-wash);
  border-bottom: 1px solid var(--line-strong);
}
tbody th[scope="row"] { font-weight: 600; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }

/* ---------- Callouts ---------- */
.callout {
  background: var(--forest-wash);
  border: 1px solid rgba(56, 103, 47, 0.28);
  border-left: 4px solid var(--forest);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  margin: 1.75rem 0;
  font-size: 0.975rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout-title {
  display: block;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--forest-deep);
  margin-bottom: 0.4rem;
}
.callout.warning {
  background: var(--clay-wash);
  border-color: rgba(185, 106, 44, 0.4);
  border-left-color: var(--clay-edge);
}
.callout.warning .callout-title { color: var(--clay-ink); }

/* ---------- FAQ accordion (details/summary) ---------- */
.faq { margin: 1.75rem 0; }
.faq-item {
  background: var(--stone-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 0.7rem;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--olive);
  transition: transform 0.16s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--forest-deep); }
.faq-item summary:hover { color: var(--forest-deep); }
.faq-item .faq-answer { padding: 0 1.15rem 1.05rem; color: var(--ink-soft); font-size: 0.975rem; }
.faq-item .faq-answer > :last-child { margin-bottom: 0; }

/* ---------- References ---------- */
.refs {
  margin: 2.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.refs h2, .refs h3 {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 0 0 0.8rem;
}
.refs h2::before, .refs h3::before { display: none; }
.refs ol { margin: 0 0 0 1.3rem; }
.refs li { margin-bottom: 0.5rem; line-height: 1.55; }
.refs li::marker { color: var(--olive); font-weight: 600; }
.refs a { word-break: break-word; color: var(--forest); }

/* ---------- Cards (blog listing + topic links) ---------- */
.listing-head { padding: 3rem 0 0.5rem; }
.listing-head .page-title { margin-bottom: 0.6rem; }
.listing-head .listing-intro { color: var(--ink-soft); max-width: 60ch; }

.guide-cards {
  display: grid;
  gap: 1.1rem;
  padding: 1.75rem 0 3.5rem;
}
.guide-card {
  display: block;
  background: var(--stone-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.guide-card:hover {
  color: var(--ink);
  border-color: var(--forest);
  border-left-color: var(--forest);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}
.guide-card .guide-card-meta {
  display: block;
  font-family: var(--display);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 0.45rem;
}
.guide-card h2, .guide-card h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.guide-card h2::before, .guide-card h3::before { display: none; }
.guide-card:hover h2, .guide-card:hover h3 { color: var(--forest-deep); }
.guide-card p { font-size: 0.94rem; color: var(--ink-soft); margin: 0; }

/* Topic cards (home page grid of section links) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
  margin: 1.75rem 0;
}
.card-grid .guide-card { border-left-width: 1px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 1.5rem;
}
.breadcrumbs a { color: var(--ink-faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--forest-deep); text-decoration: underline; }

/* ---------- Footer ----------
   Flavour: deep forest ground — the opposite pole of the light topbar. */
.footer {
  background: var(--forest-night);
  color: #cdd6c1;
  margin-top: 3rem;
  font-size: 0.875rem;
}
.footer-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 2rem;
}
.footer-disclaimer {
  max-width: 78ch;
  margin-bottom: 1rem;
  line-height: 1.65;
}
.footer-disclaimer strong { color: #f0f3e9; font-weight: 600; }
.footer a { color: #b5cc93; }
.footer a:hover { color: #d5e5bb; }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin: 1.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(240, 243, 233, 0.16);
}
.footer-nav a {
  font-family: var(--display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #cdd6c1;
  text-decoration: none;
  font-weight: 500;
}
.footer-nav a:hover { color: #f0f3e9; text-decoration: underline; }
.footer-meta { font-size: 0.8rem; color: #93a483; }

/* ---------- 404 page ---------- */
.error-page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem 1.25rem 6rem;
  text-align: left;
}
.error-code {
  font-family: var(--display);
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--forest);
  margin-bottom: 0.75rem;
}
.error-page h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.9rem;
}
.error-page p { color: var(--ink-soft); max-width: 55ch; margin-bottom: 1.5rem; }
.error-links { display: flex; flex-wrap: wrap; gap: 0.7rem; }

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--stone);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(34, 39, 31, 0.1);
    padding: 0.75rem 1.25rem 1rem;
  }
  .nav.open { display: flex; }
  .nav a {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--line);
  }
  .nav a:last-child { border-bottom-color: transparent; }
  .nav a[aria-current="page"] { border-bottom-color: var(--forest); }
}

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .article { padding-top: 2rem; padding-bottom: 3rem; }
  .hero-inner { padding: 2.5rem 1.25rem 2.25rem; }
  .guide-card { padding: 1.15rem 1.2rem; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .nav-toggle, .skip-link, .footer-nav, .hero-actions { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .article, .article-body { max-width: 100%; padding: 0; }
  a { color: #000; text-decoration: none; }
  .article-body a[href^="http"]::after,
  .article a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #444; }
  .callout, .faq-item, .guide-card { border: 1px solid #999; background: #fff; box-shadow: none; }
  .footer { background: #fff; color: #000; border-top: 1px solid #999; }
  .footer a, .footer-disclaimer strong { color: #000; }
}
