/* Thornfield Environmental
   ---------------------------------------------------------------------------
   Follows the SLR Consulting reference: a deep forest green carrying most of
   the page, a mid green for the second layer, a warm off-white for the light
   sections, and one bright lime used at scale for buttons and small accents.
   Two families — a high-contrast serif for display at 115px down to 23px, and
   a humanist grotesque for absolutely everything else at 16/14.

   The lime is the whole character of the palette and it is 1.1:1 on the cream.
   Tokens are therefore declared per surface, so a light section cannot inherit
   a colour that only works on green.
   --------------------------------------------------------------------------- */

/* ---- fonts ---- */
/* Albra is a licensed display serif. Instrument Serif is the closest openly
   licensed equivalent — the same narrow, high-contrast, low-x-height didone
   feel, and it was drawn for exactly this job: very large display sizes.
   Figtree is what the reference actually uses for text and is openly
   licensed, so it is used directly. */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url('/assets/fonts/figtree.woff2') format('woff2'); }
@font-face { font-family: 'Instrument'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/instrument-serif.woff2') format('woff2'); }
@font-face { font-family: 'Figtree fallback'; src: local('Helvetica Neue'), local('Arial'); ascent-override: 96%; descent-override: 25%; line-gap-override: 0%; size-adjust: 101%; }
@font-face { font-family: 'Instrument fallback'; src: local('Times New Roman'), local('Georgia'); ascent-override: 92%; descent-override: 25%; line-gap-override: 0%; size-adjust: 89%; }

/* ---- tokens ---- */
:root {
  --forest: #263326;   /* 14.6:1 under the cream */
  --moss: #3c533c;     /* 8.7:1 under the cream */
  --cream: #f6f6f2;
  --stone: #d4d9d2;    /* muted text on green — 8.9:1 on forest */
  --slate: #51544a;    /* muted text on cream — 7.2:1 */
  --lime: #d6f591;     /* 11.8:1 on forest, 1.1:1 on cream — dark surfaces only */
  --white: #ffffff;

  --accent: var(--moss);
  --muted: var(--slate);
  --rule: #dcdcd4;

  --display: 'Instrument', 'Instrument fallback', Georgia, 'Times New Roman', serif;
  --body: 'Figtree', 'Figtree fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

  --wrap: 1360px;
  --gutter: 20px;
  --pad: clamp(56px, 5.5vw, 104px);
  --radius: 4px;
  --pill: 100px;

  /* The reference runs its display serif from 115px down to 23px and keeps the
     grotesque at 16 and 14. Two scales, deliberately not blended. */
  --t-display: clamp(3rem, 1.6rem + 6.2vw, 7.1875rem);
  --t-h1: clamp(2.4rem, 1.6rem + 3.2vw, 4rem);
  --t-h2: clamp(1.9rem, 1.5rem + 1.9vw, 2.5625rem);
  --t-h3: clamp(1.35rem, 1.2rem + 0.7vw, 1.625rem);
  --t-statement: clamp(1.4rem, 1.05rem + 1.7vw, 2.5625rem);   /* the reference's 41px standfirst */
  --t-body: 1rem;
  --t-sm: 0.875rem;
  --t-xs: 0.75rem;
}

/* Every green surface redeclares the token block. Kept separate from the
   background so a section that paints itself green cannot miss it. */
.on-forest, .on-moss, .site-header, .site-footer, .hero, .menu {
  --accent: var(--lime);
  --muted: var(--stone);
  --rule: rgba(246, 246, 242, 0.22);
}
.on-forest, .site-header, .site-footer { background: var(--forest); color: var(--cream); }
.on-moss { background: var(--moss); color: var(--cream); }
.on-cream { background: var(--cream); }

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--forest); font-family: var(--body); font-size: var(--t-body); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 1.1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--lime); color: var(--forest); padding: 12px 18px; border-radius: var(--radius); font-weight: 700; text-decoration: none; transition: top .15s ease; }
.skip:focus { top: 16px; }

/* ---- layout ---- */
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 900px) { .wrap { padding-inline: 44px; } }
.section { padding-block: var(--pad); }
.section--tight { padding-block: clamp(38px, 3.8vw, 64px); }
.measure { max-width: 62ch; }

/* ---- type ---- */
/* The serif does display work only; it never sets body copy. */
.serif { font-family: var(--display); font-weight: 400; line-height: 1.06; letter-spacing: -0.01em; }
.display { font-size: var(--t-display); }
.h1 { font-size: var(--t-h1); }
.h2 { font-size: var(--t-h2); }
.h3 { font-size: var(--t-h3); }
.statement { font-family: var(--display); font-weight: 400; font-size: var(--t-statement); line-height: 1.32; letter-spacing: -0.005em; }
.lead { font-size: 1.0625rem; line-height: 1.6; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
/* The reference's section label: 16px bold grotesque, above a serif heading. */
.label { margin: 0 0 clamp(20px, 2.4vw, 38px); font-size: var(--t-body); font-weight: 700; color: var(--accent); }
.prose a:not(.btn), .link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose a:not(.btn):hover, .link:hover { text-decoration-thickness: 2px; }
.prose h2, .prose h3 { margin-top: 1.7em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }

/* ---- buttons ---- */
/* Lime fill with forest text, 11.8:1. Lime is never used as text on cream. */
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 24px; background: var(--lime); color: var(--forest); border: 1px solid var(--lime); border-radius: var(--radius); font-size: var(--t-sm); font-weight: 700; text-decoration: none; cursor: pointer; transition: background-color .16s ease, color .16s ease; }
.btn:hover { background: var(--forest); color: var(--lime); border-color: var(--forest); }
.on-forest .btn:hover, .site-footer .btn:hover, .hero .btn:hover { background: transparent; color: var(--lime); border-color: var(--lime); }
.on-moss .btn:hover { background: var(--forest); color: var(--lime); border-color: var(--forest); }
.btn--ghost { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn--ghost:hover { background: var(--forest); color: var(--cream); }
.on-forest .btn--ghost, .on-moss .btn--ghost, .hero .btn--ghost, .site-footer .btn--ghost { color: var(--cream); border-color: rgba(246,246,242,.5); }
.on-forest .btn--ghost:hover, .on-moss .btn--ghost:hover, .hero .btn--ghost:hover, .site-footer .btn--ghost:hover { background: var(--cream); color: var(--forest); border-color: var(--cream); }
.btn--pill { border-radius: var(--pill); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn .arw { flex: 0 0 auto; }

/* ---- header ---- */
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 86px; }
.brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; font-family: var(--display); font-weight: 400; font-size: 1.5rem; letter-spacing: 0.01em; }
.brand__mark { width: 26px; height: 26px; flex: 0 0 auto; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav > a, .site-nav > button { background: none; border: 0; padding: 8px 0; font-size: var(--t-sm); text-decoration: none; cursor: pointer; border-bottom: 2px solid transparent; }
.site-nav > a:hover, .site-nav > button:hover, .site-nav > a[aria-current='page'] { border-bottom-color: var(--lime); }
.site-nav > button[aria-expanded='true'] { border-bottom-color: var(--lime); }
.nav-toggle { display: none; align-items: center; justify-content: center; width: 46px; height: 46px; background: none; border: 1px solid currentColor; border-radius: var(--radius); cursor: pointer; }
.nav-toggle > span { display: grid; gap: 4px; width: 20px; }
.nav-toggle > span > span { height: 2px; background: currentColor; }

/* Mega panel, full width under the bar, one per nav group. */
.mega { position: absolute; left: 0; right: 0; z-index: 50; background: var(--moss); color: var(--cream); border-top: 1px solid rgba(246,246,242,.18); padding-block: clamp(28px, 3vw, 46px); }
.mega[hidden] { display: none; }
.mega__cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 40px; }
.mega h2 { font-size: var(--t-sm); font-weight: 700; color: var(--lime); margin-bottom: 12px; }
.mega li { padding: 5px 0; }
.mega a { font-size: var(--t-sm); text-decoration: none; }
.mega a:hover { text-decoration: underline; text-underline-offset: 3px; }
.header-shell { position: relative; }

.menu { position: fixed; inset: 0; z-index: 60; background: var(--forest); color: var(--cream); padding: 18px var(--gutter) 48px; overflow-y: auto; overscroll-behavior: contain; }
.menu[hidden] { display: none; }
.menu__head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; margin-bottom: 26px; }
.menu__close { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; background: none; border: 1px solid currentColor; border-radius: var(--radius); cursor: pointer; }
.menu__nav a { display: block; padding: 13px 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.1rem); text-decoration: none; border-bottom: 1px solid rgba(246,246,242,.2); }
.menu__nav a:hover { color: var(--lime); }
body.menu-open { overflow: hidden; }

/* ---- hero ---- */
.hero { position: relative; display: flex; align-items: flex-end; min-height: 600px; padding-block: clamp(80px, 8vw, 132px); color: var(--cream); isolation: isolate; }
.hero--short { min-height: 380px; align-items: center; }
.hero__bg { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(80deg, rgba(24,32,24,.9) 0%, rgba(24,32,24,.72) 46%, rgba(24,32,24,.5) 100%); }
.hero .lead { max-width: 50ch; margin-top: 22px; }
.hero .btn-row { margin-top: 30px; }
/* The reference sets its mark inline in the display line. Kept as an image so
   it scales with the type rather than being a background. */
.hero__mark { display: inline-block; width: 0.62em; height: 0.62em; margin-right: 0.1em; vertical-align: baseline; }

/* ---- cards ---- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2vw, 28px); }
.cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1040px) { .cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 940px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cards, .cards--2, .cards--4 { grid-template-columns: 1fr; } }

/* Outlined card, as the reference's Advisory/Digital/Technical row. */
.tile { display: flex; flex-direction: column; gap: 12px; padding: clamp(22px, 2.2vw, 32px); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; transition: background-color .18s ease, border-color .18s ease; }
a.tile:hover { border-color: var(--accent); background: rgba(214, 245, 145, .07); }
.on-cream a.tile:hover, .section:not(.on-forest):not(.on-moss) a.tile:hover { background: rgba(38, 51, 38, .04); }
.tile p { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.tile__n { font-size: var(--t-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* Image card with a tag strip, as the Latest Thinking and Latest Projects rows. */
.card { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; text-decoration: none; transition: border-color .18s ease, transform .18s ease; }
.card:hover { border-color: var(--moss); transform: translateY(-3px); }
.card__media { position: relative; }
.card__media img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.tag { position: absolute; left: 12px; bottom: 12px; padding: 5px 11px; background: var(--cream); color: var(--forest); border-radius: var(--radius); font-size: var(--t-xs); font-weight: 700; }
.card__body { display: flex; flex-direction: column; gap: 10px; padding: 18px; flex: 1 1 auto; }
.card__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; margin: 0; font-size: var(--t-xs); color: var(--muted); }
.card h3 { font-size: var(--t-body); }
.card__by { margin: 0; font-size: var(--t-xs); color: var(--muted); }
.card__cta { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule); font-size: var(--t-sm); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
@media (prefers-reduced-motion: reduce) { .card, .card:hover, .tile { transition: none; transform: none; } }

/* ---- split ---- */
.split { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(26px, 4vw, 72px); align-items: start; }
.split--mid { align-items: center; }
.split--copy { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
@media (max-width: 880px) { .split, .split--copy { grid-template-columns: 1fr; } }
.figure img { width: 100%; border-radius: var(--radius); }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 2.4vw, 34px); }
.stats > div { padding-top: 20px; border-top: 1px solid var(--rule); }
.stats dt { font-family: var(--display); font-weight: 400; font-size: clamp(2.4rem, 1.8rem + 2.4vw, 3.4rem); line-height: 1; }
.stats dd { margin: 10px 0 0; font-size: var(--t-sm); color: var(--muted); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- lists ---- */
.rows > li { padding-block: clamp(20px, 2.2vw, 32px); border-top: 1px solid var(--rule); }
.rows > li:last-child { border-bottom: 1px solid var(--rule); }
.row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(16px, 2.5vw, 48px); align-items: start; }
@media (max-width: 760px) { .row { grid-template-columns: 1fr; } }

/* Stacked inline links need 24px of clickable space each (WCAG 2.2 2.5.8). */
.stack-links > li > a { display: inline-block; padding-block: 5px; }

.ticks { display: grid; gap: 11px; }
.ticks > li { position: relative; padding-left: 28px; font-size: var(--t-sm); }
.ticks > li::before { content: ''; position: absolute; left: 0; top: 0.5em; width: 14px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.ticks--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 40px; }
@media (max-width: 700px) { .ticks--2 { grid-template-columns: 1fr; } }

/* ---- rail ---- */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: min(430px, 84%); gap: clamp(18px, 2vw, 26px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: none; cursor: grab; }
.rail::-webkit-scrollbar { display: none; }
/* Snapping fights a pointer drag, so it stands down until the drag ends and
   then settles the rail on the nearest card. */
.rail.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.rail.is-dragging * { pointer-events: none; }
.rail > * { scroll-snap-align: start; }
.rail:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }
.rail-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: clamp(24px, 2.6vw, 40px); }
.rail-nav { display: flex; gap: 10px; }
.rail-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; background: transparent; border: 1px solid var(--rule); border-radius: var(--pill); cursor: pointer; }
.rail-btn:hover:not(:disabled) { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.rail-btn:disabled { opacity: .4; cursor: default; }

/* ---- table ---- */
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.specs { width: 100%; min-width: 480px; border-collapse: collapse; }
.specs th, .specs td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.specs th { font-weight: 700; }

/* ---- forms ---- */
.form { display: grid; gap: 18px; max-width: 600px; }
.field { display: grid; gap: 6px; }
.field label { font-size: var(--t-sm); font-weight: 700; }
.field input, .field select, .field textarea { font: inherit; color: var(--forest); width: 100%; min-height: 48px; padding: 12px 14px; background: var(--white); border: 1px solid #6d7268; border-radius: var(--radius); }
.field textarea { min-height: 150px; resize: vertical; }
.field.invalid input, .field.invalid textarea { border-color: #96150f; }
.field .error { margin: 0; font-size: var(--t-sm); color: #8a120d; }
.on-forest .field .error, .on-moss .field .error { color: #ffb9b4; }
.field:not(.invalid) .error { display: none; }
.field--hp { position: absolute; left: -9999px; }
.form-note { font-size: var(--t-sm); color: var(--muted); max-width: 56ch; }

/* ---- footer ---- */
.site-footer { padding-top: clamp(50px, 5vw, 86px); }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 34px 28px; padding-bottom: 44px; }
.footer-top h2 { font-size: var(--t-sm); color: var(--lime); margin-bottom: 14px; }
.footer-top li { padding: 4px 0; font-size: var(--t-sm); }
.footer-top a { text-decoration: none; }
.footer-top a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 26px; padding-block: 22px; border-top: 1px solid var(--rule); font-size: var(--t-xs); color: var(--muted); }
.footer-legal a { text-decoration: none; }
@media (max-width: 880px) { .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .footer-top { grid-template-columns: 1fr; } }

/* ---- reveal ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } * { scroll-behavior: auto !important; } }

@media (max-width: 1080px) {
  .site-nav { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .brand { margin-right: 0; }
  .hero { min-height: 500px; }
}
