/* ============================================================
   Foundayo Tablet UK — design system
   Clean clinical editorial. Deep teal on warm paper.
   Fonts: "Source Serif 4" (headlines) + "Inter" (body).
   ============================================================ */

/* ---------- 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 {
  --paper: #faf9f6;          /* warm paper background */
  --paper-raised: #ffffff;   /* cards, callouts */
  --paper-sunken: #f1efe9;   /* subtle wells, code, footer */
  --ink: #1a1c1b;            /* primary text */
  --ink-soft: #4a4f4d;       /* secondary text */
  --ink-faint: #7c827f;      /* meta, captions */
  --teal: #0f766e;           /* single accent */
  --teal-deep: #0b5952;      /* hover / active */
  --teal-wash: #e7f2f0;      /* tinted backgrounds */
  --line: #e4e1d8;           /* hairline borders */
  --line-strong: #cfcabc;
  --amber-wash: #fdf3e3;     /* cautions only */
  --amber-edge: #d9a441;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --measure: 720px;          /* article measure */
  --wide: 1080px;            /* topbar / footer measure */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-soft: 0 1px 2px rgba(26, 28, 27, 0.05), 0 4px 16px rgba(26, 28, 27, 0.05);
}

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

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

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

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

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 246, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  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(--teal); }

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav a {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav a:hover { color: var(--teal-deep); background: var(--teal-wash); }
.nav a[aria-current="page"] { color: var(--teal-deep); background: var(--teal-wash); }

.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);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
}
.nav-toggle:hover { color: var(--teal-deep); border-color: var(--line-strong); }

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

main { display: block; }

/* ---------- 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(--serif);
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}
.article-body h2,
.article h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.9rem;
}
.article-body h3,
.article h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  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 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.2rem;
  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(--teal);
  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(--paper-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(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  background: var(--paper-sunken);
}
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }

/* ---------- Callouts ---------- */
.callout {
  background: var(--teal-wash);
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-left: 4px solid var(--teal);
  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(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--teal-deep);
  margin-bottom: 0.4rem;
}
.callout.warning {
  background: var(--amber-wash);
  border-color: rgba(217, 164, 65, 0.45);
  border-left-color: var(--amber-edge);
}
.callout.warning .callout-title { color: #8a5a12; }

/* ---------- FAQ accordion (details/summary) ---------- */
.faq { margin: 1.75rem 0; }
.faq-item {
  background: var(--paper-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(--serif);
  font-size: 1.05rem;
  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(--sans);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--teal);
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item summary:hover { color: var(--teal-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(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  margin: 0 0 0.8rem;
}
.refs ol {
  margin: 0 0 0 1.3rem;
  counter-reset: none;
}
.refs li { margin-bottom: 0.5rem; line-height: 1.55; }
.refs li::marker { color: var(--teal); font-weight: 600; }
.refs a { word-break: break-word; color: var(--teal); }

/* ---------- Blog listing cards ---------- */
.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(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 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(--teal);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}
.guide-card .guide-card-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.guide-card h2, .guide-card h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.guide-card:hover h2, .guide-card:hover h3 { color: var(--teal-deep); }
.guide-card p { font-size: 0.94rem; color: var(--ink-soft); margin: 0; }

/* ---------- 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(--teal-deep); text-decoration: underline; }

/* ---------- Footer ---------- */
.footer {
  background: var(--paper-sunken);
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.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: var(--ink); }
.footer a { color: var(--teal-deep); }
.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 var(--line);
}
.footer-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.footer-nav a:hover { color: var(--teal-deep); text-decoration: underline; }
.footer-meta { font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- 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: 860px) {
  .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(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(26, 28, 27, 0.08);
    padding: 0.75rem 1.25rem 1rem;
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.7rem 0.75rem; font-size: 1rem; }
}

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

/* ---------- Print ---------- */
@media print {
  .topbar, .nav-toggle, .skip-link, .footer-nav { 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; }
  .faq-item details, .faq-item[open] { display: block; }
  .footer { background: #fff; border-top: 1px solid #999; }
}
