/*
 * Life's Next Chapter - the client-facing brand of the LifeFile platform
 * lifefile.theahg.co.za
 * Copyright (C) 2026 Dr Johan Pieterse / Plain Sailing Information Systems
 * All rights reserved. Proprietary and confidential.
 */

:root {
  --ahg-green: #052540;   /* navy, sampled from the wordmark */
  --ahg-green-light: #0a3c62;
  --teal: #b68625;        /* gold, sampled from the wordmark */
  --teal-deep: #8f6a1c;
  --ink: #1a1d1e;
  --ink-soft: #4a5356;
  --ink-faint: #6b7679;
  --paper: #ffffff;
  --ground: #f6f7f6;
  --rule: #dfe3e2;
  --accent: #a86a2c;
  --warn-bg: #fdf6ec;
  --warn-rule: #e3b778;
  --measure: 68ch;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ahg-green: #9dc2e0;
    --ahg-green-light: #c2d9ee;
    --teal: #d8b45e;
    --teal-deep: #b68625;
    --ink: #e8ecec;
    --ink-soft: #b3bcbe;
    --ink-faint: #8b9698;
    --paper: #14181a;
    --ground: #0d1113;
    --rule: #2a3134;
    --accent: #e0a06a;
    --warn-bg: #221c14;
    --warn-rule: #6b5226;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ahg-green); text-underline-offset: 2px; }
a:hover { color: var(--ahg-green-light); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ahg-green); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: 0; }

/* Masthead */
.masthead {
  background: var(--ahg-green);
  color: #fff;
  padding: 0;
}
@media (prefers-color-scheme: dark) {
  .masthead { background: #041b2f; }
}
.masthead-inner {
  max-width: 1120px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
}
.masthead a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 600; font-size: 1.15rem; letter-spacing: .01em; }
.brand img { width: 40px; height: 40px; display: block; background: #fff; border-radius: 8px; padding: 3px; }
.brand span { display: block; font-weight: 400; font-size: .78rem; opacity: .78; letter-spacing: .02em; }
.brand b { font-weight: 600; display: block; line-height: 1.15; }
.brand-text { display: block; }
.masthead nav { margin-left: auto; display: flex; gap: 1.4rem; font-size: .92rem; }
.masthead nav a { opacity: .88; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }

/* Hero */
.hero { background: var(--paper); border-bottom: 1px solid var(--rule); }
.hero-inner { max-width: 1120px; margin: 0 auto; padding: 3.5rem 1.5rem 3rem; }
.hero h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.2; margin: 0 0 1rem; max-width: 20ch; color: var(--ink);
  letter-spacing: -0.01em;
}
.hero p.lead { font-size: 1.16rem; max-width: var(--measure); margin: 0 0 1.6rem; color: var(--ink-soft); }
.hero-logo { width: 190px; height: auto; display: block; margin: 0 0 1.6rem; }
.tagline { font-size: .95rem; letter-spacing: .09em; text-transform: uppercase; color: var(--teal); margin: 0 0 .9rem; }
@media (prefers-color-scheme: dark) { .tagline { color: var(--teal-deep); } }
.hero .status {
  display: inline-block; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 100px;
  padding: .2rem .7rem; margin-bottom: 1.4rem;
}

.btn {
  display: inline-block; background: var(--ahg-green); color: #fff !important;
  padding: .7rem 1.4rem; border-radius: var(--radius); text-decoration: none; font-weight: 500;
}
.btn:hover { background: var(--ahg-green-light); }
.btn.ghost { background: transparent; color: var(--ahg-green) !important; border: 1px solid var(--rule); }
.btn.ghost:hover { border-color: var(--ahg-green); }

/* Generic layout */
main { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.band { background: var(--paper); border-bottom: 1px solid var(--rule); }
.band-inner { max-width: 1120px; margin: 0 auto; padding: 3rem 1.5rem; }

h2 { font-size: 1.5rem; line-height: 1.3; margin: 2.6rem 0 .8rem; color: var(--ink); letter-spacing: -0.005em; }
h3 { font-size: 1.13rem; margin: 2rem 0 .5rem; color: var(--ink); }
h4 { font-size: 1rem; margin: 1.4rem 0 .4rem; color: var(--ink-soft); }
p, li { max-width: var(--measure); }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .45rem; }

.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 1.5rem 0; }
.card {
  background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}
.card h3 { margin-top: 0; font-size: 1.02rem; }
.card p { font-size: .94rem; color: var(--ink-soft); margin-bottom: 0; }

.note {
  background: var(--warn-bg); border-left: 3px solid var(--warn-rule);
  padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.4rem 0;
}
.note p { margin-bottom: 0; }
.note p + p { margin-top: .7rem; }
.note strong { color: var(--ink); }

.callout {
  border: 1px solid var(--rule); border-left: 3px solid var(--ahg-green);
  background: var(--paper); padding: 1rem 1.2rem; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.4rem 0;
}
.callout p { margin-bottom: 0; }

table { border-collapse: collapse; width: 100%; margin: 1.4rem 0; font-size: .94rem; }
.table-scroll { overflow-x: auto; }
th, td { border: 1px solid var(--rule); padding: .55rem .7rem; text-align: left; vertical-align: top; }
th { background: var(--ahg-green); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { th { background: #041b2f; color: #e8ecec; } }

/* Help layout */
.help-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; align-items: start; padding: 2.5rem 0 4rem; }
@media (max-width: 860px) { .help-wrap { grid-template-columns: 1fr; gap: 1.5rem; } }

.toc {
  position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto;
  font-size: .9rem; border-right: 1px solid var(--rule); padding-right: 1rem;
}
@media (max-width: 860px) {
  .toc { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule); padding: 0 0 1rem; }
}
.toc h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin: 1.4rem 0 .45rem; }
.toc h2:first-child { margin-top: 0; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: .22rem 0; color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--ahg-green); }

.help-body { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 2rem 2.2rem 3rem; }
@media (max-width: 600px) { .help-body { padding: 1.4rem 1.2rem 2rem; } }
.help-body > h2:first-of-type { margin-top: 0; }
.help-body section { scroll-margin-top: 1.5rem; padding-top: .5rem; }
.help-body section + section { border-top: 1px solid var(--rule); margin-top: 2.6rem; }

.kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin: 0 0 .3rem; }

dl.q dt { font-weight: 600; margin-top: 1.2rem; }
dl.q dd { margin: .3rem 0 0; color: var(--ink-soft); max-width: var(--measure); }

footer {
  background: var(--paper); border-top: 1px solid var(--rule); margin-top: 0;
  font-size: .88rem; color: var(--ink-faint);
}
footer .band-inner { padding: 2rem 1.5rem; }
footer p { max-width: var(--measure); }

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .masthead, .toc, .skip, .btn, footer nav { display: none !important; }
  .help-body { border: 0; padding: 0; }
  .help-body section { break-inside: auto; }
  h2 { break-after: avoid; }
  a { color: #000; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
}

/* If an image fails to load its alt text must still read, so a missing brand
   asset is obvious instead of an invisible gap. */
.brand img, .hero-logo { color: var(--ink); font-size: .85rem; }
@media (max-width: 520px) {
  .masthead-inner { gap: .6rem 1rem; }
  .brand { font-size: 1rem; }
  .brand span { font-size: .72rem; }
  .masthead nav { gap: 1rem; font-size: .86rem; width: 100%; }
  .hero-logo { width: 150px; }
}

/* Policy pages: one column, same body treatment as the help centre. */
.doc-wrap { max-width: 860px; margin: 0 auto; padding: 2.5rem 0 4rem; }
.doc-meta { color: var(--ink-faint); font-size: .9rem; margin: -.4rem 0 1.6rem; }
.doc-wrap .help-body h3 { border-top: 1px solid var(--rule); padding-top: 1.4rem; }
.doc-wrap .help-body h3:first-of-type { border-top: 0; padding-top: 0; }
.doc-wrap .help-body h4 { color: var(--ink); font-weight: 600; }
.doc-wrap code { background: var(--ground); padding: .1rem .3rem; border-radius: 3px; font-size: .92em; }
.doc-wrap th { white-space: nowrap; }
