/* =========================================================
   Thomas Davies Charity — Llanybydder
   Registered Charity No. 215597
   Static stylesheet — no frameworks
   ========================================================= */

:root {
  --ink: #141815;
  --forest: #1f3a2e;
  --forest-700: #17291f;
  --moss: #2e513f;
  --cream: #f7f1e6;
  --cream-2: #efe6d2;
  --gold: #b68a3e;
  --gold-hover: #9b7330;
  --line: #d9cdb5;
  --muted: #5a5850;
  --white: #ffffff;
  --radius: 2px;
  --max: 1180px;
  --shadow: 0 18px 40px -24px rgba(20, 24, 21, 0.35);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
  background-image: var(--grain);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--forest);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 500; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.4rem; font-weight: 600; }
h4 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.14em; font-family: 'Work Sans', sans-serif; color: var(--gold); font-weight: 600; }

p { margin: 0 0 1.1em; color: #2a2d29; }
a { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .2s ease; }
a:hover { color: var(--gold); }

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

/* ---------- Layout ---------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5rem 0; }
.section--tight { padding: 3rem 0; }
.section--dark { background: var(--forest); color: var(--cream); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--cream); }
.section--dark p { color: #dcd4bf; }
.section--cream { background: var(--cream-2); }

.grid-2 { display: grid; gap: 3rem; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1.1fr 1fr; align-items: start; } }

.grid-3 { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Nav ---------- */
.skiplink { position: absolute; left: -9999px; top: 0; background: var(--forest); color: var(--cream); padding: 0.75rem 1rem; z-index: 1000; }
.skiplink:focus { left: 1rem; top: 1rem; }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 241, 230, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
}
.nav__brand {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none; color: var(--forest);
}
.nav__mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--forest); color: var(--gold);
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; font-weight: 600;
  border: 1px solid var(--gold);
}
.nav__name { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; font-weight: 600; line-height: 1; }
.nav__sub { display: block; font-family: 'Work Sans', sans-serif; font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.nav__links { display: none; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.nav__links a { text-decoration: none; color: var(--ink); font-size: 0.92rem; position: relative; padding: 4px 0; }
.nav__links a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--gold); transition: right .3s ease; }
.nav__links a:hover::after, .nav__links a[aria-current="page"]::after { right: 0; }
.nav__links a[aria-current="page"] { color: var(--forest); font-weight: 600; }

.nav__toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  cursor: pointer;
}
.nav__toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); position: relative; }
.nav__toggle span::before, .nav__toggle span::after { content: ''; position: absolute; left: 0; width: 18px; height: 1.5px; background: var(--ink); transition: transform .2s ease; }
.nav__toggle span::before { top: -6px; }
.nav__toggle span::after { top: 6px; }

@media (min-width: 900px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }
}

.nav__mobile {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.nav__mobile.open { display: block; }
.nav__mobile ul { list-style: none; margin: 0; padding: 0.5rem 1.5rem 1rem; }
.nav__mobile a { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 0.95rem; }
.nav__mobile a:last-child { border-bottom: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 7rem 0 6rem;
  overflow: hidden;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero__eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--gold); display: inline-block; }
.hero h1 { max-width: 18ch; margin-bottom: 1.25rem; }
.hero p.lede { max-width: 58ch; font-size: 1.15rem; color: #38403a; }
.hero__meta {
  margin-top: 3rem;
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  padding-top: 2rem; border-top: 1px solid var(--line);
}
.hero__stat strong { display: block; font-family: 'Cormorant Garamond', serif; font-size: 2.2rem; color: var(--forest); line-height: 1; }
.hero__stat span { font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

.hero__actions { margin-top: 2.5rem; display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.65rem;
  padding: 0.95rem 1.75rem;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.9rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  transition: all .2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--primary { background: var(--forest); color: var(--cream); }
.btn--primary:hover { background: var(--forest-700); color: var(--gold); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn--ghost:hover { background: var(--forest); color: var(--cream); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-hover); color: var(--cream); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Cards / Features ---------- */
.card {
  background: var(--cream);
  border: 1px solid var(--line);
  padding: 2rem;
  border-radius: var(--radius);
  transition: transform .3s ease, box-shadow .3s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card__num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem; color: var(--gold); line-height: 1;
  display: block; margin-bottom: 0.75rem;
}
.card h3 { margin-top: 0; }
.card p { margin-bottom: 0; font-size: 0.95rem; color: #2a2d29; }

/* ---------- Feature list ---------- */
.feature {
  padding: 2.25rem 0;
  border-top: 1px solid var(--line);
  display: grid; gap: 1rem;
  grid-template-columns: auto 1fr;
  align-items: start;
}
.feature__label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; color: var(--gold);
  min-width: 3.5rem;
}
.feature h3 { margin: 0 0 0.35rem; }
.feature p { margin: 0; color: #38403a; }

/* ---------- Quote ---------- */
.quote {
  border-left: 3px solid var(--gold);
  padding: 1rem 0 1rem 2rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; line-height: 1.45;
  color: var(--forest);
  font-style: italic;
  max-width: 62ch;
}
.quote__cite { display: block; margin-top: 1rem; font-family: 'Work Sans', sans-serif; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-style: normal; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 1.5rem 0 1.5rem 2rem; border-left: 1px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 1.9rem; width: 9px; height: 9px; background: var(--gold); border-radius: 50%; }
.timeline strong { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; color: var(--forest); display: block; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1.25rem; max-width: 520px; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select {
  font-family: inherit; font-size: 1rem;
  padding: 0.85rem 1rem;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color .2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(31, 58, 46, 0.12);
}
.field textarea { min-height: 140px; resize: vertical; }
.form__note { font-size: 0.85rem; color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  background: var(--forest);
  color: #d8d0b9;
  padding: 4rem 0 2rem;
}
.footer a { color: var(--cream); }
.footer a:hover { color: var(--gold); }
.footer__grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer h4 { color: var(--gold); margin-bottom: 1rem; font-size: 0.78rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { padding: 4px 0; font-size: 0.92rem; }
.footer__brand { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: var(--cream); margin: 0 0 0.5rem; }
.footer__desc { font-size: 0.92rem; max-width: 42ch; }
.footer__bottom {
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-size: 0.82rem; color: #a99f86;
}

/* ---------- Utilities ---------- */
.tag { display: inline-block; padding: 0.3rem 0.75rem; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; background: var(--cream-2); color: var(--forest); border: 1px solid var(--line); border-radius: 999px; font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 3rem 0; border: none; }
.prose { max-width: 68ch; }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin-bottom: 1.2em; }
.prose li { margin-bottom: 0.6em; }
.lead { font-size: 1.2rem; color: #2a2d29; line-height: 1.65; max-width: 58ch; }

.page-header {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}
.page-header .crumbs {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1rem;
}
.page-header .crumbs a { color: var(--muted); text-decoration: none; }
.page-header .crumbs a:hover { color: var(--forest); }
.page-header h1 { margin-bottom: 0.75rem; }
.page-header p { max-width: 62ch; color: #38403a; font-size: 1.1rem; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Accessibility focus */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
