/* ==========================================================
   Focus Consultancy — Prototype 1b "modern paper"
   Light/dark theme, warm tinted panels. Static, no build step. v1b
   ========================================================== */

:root {
  /* Light theme (default): warm paper tones, not flat white */
  --page-bg: #e3ded4;        /* warm putty behind the texture */
  --ink: #2e4045;
  --ink-dim: #5a6e74;
  --brand: #465d62;          /* Focus slate */
  --heading: #3b5157;
  --accent: #18a999;         /* teal */
  --accent-ink: #0f7c70;
  --panel: #fbf9f4;          /* warm cream, not white */
  --panel-soft: #e9f2f0;     /* soft teal tint */
  --panel-sand: #f3ecdd;     /* warm sand tint */
  --panel-blue: #e3edf7;     /* light blue tint */
  --border: #d8d2c4;
  --cta-bg: #465d62;
  --cta-ink: #ffffff;
  --cta-dim: #d5dfe1;
  --topbar-bg: rgba(247, 244, 237, .82);
  --link-on-dark: #bfe9e3;
  --paper: url('../img/crumple.gif');
  --paper-opacity: .9;
  --paper-filter: none;
  --logo-filter: none;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(46, 64, 69, .14);
  --shadow-sm: 0 3px 12px rgba(46, 64, 69, .10);
  --maxw: 1100px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --serif: Georgia, "Times New Roman", Times, serif; /* echoes the logo */
  --step-1: clamp(1.65rem, 1.6vw + 1.2rem, 2.2rem);
  --step-2: clamp(1.25rem, 0.9vw + 0.9rem, 1.6rem);
  --step-3: clamp(1.05rem, 0.6vw + 0.88rem, 1.2rem);
  --step-4: 0.97rem;
}

[data-theme="dark"] {
  /* Dark theme: same hue relationships as light —
     neutral slate base, teal / sand / blue tinted gradients */
  --page-bg: #131c1c;        /* deep slate page */
  --ink: #e4ebea;
  --ink-dim: #a5b8b5;
  --brand: #cfdedd;
  --heading: #dcebe8;
  --accent: #2cc4b3;
  --accent-ink: #5dd6c8;
  --panel: #212c2f;          /* neutral slate panel (cream's counterpart) */
  --panel-soft: #15393a;     /* teal tint — Recognition */
  --panel-sand: #36301d;     /* warm sand tint — Who we are */
  --panel-blue: #1b2c44;     /* blue tint — service cards */
  --border: #3b4e51;
  --cta-bg: #0e3a35;
  --cta-ink: #f0f6f5;
  --cta-dim: #b9cfcc;
  --topbar-bg: rgba(18, 26, 26, .85);
  --link-on-dark: #8fe0d5;
  --paper-opacity: .14;
  --paper-filter: invert(1);
  --logo-filter: brightness(.88);
  --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  --shadow-sm: 0 3px 12px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--page-bg);
}

/* Crumpled paper: tiled behind everything.
   In dark mode it is inverted and almost subliminal. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background: var(--paper) repeat;
  opacity: var(--paper-opacity);
  filter: var(--paper-filter);
  pointer-events: none;
}

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

a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* Focus visibility */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: .4rem; }

/* Skip link */
.skip-link { position: absolute; left: -9999px; top: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 9999; background: var(--cta-bg); color: #fff; padding: .5rem .75rem; border-radius: .5rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  backdrop-filter: saturate(1.2) blur(8px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; padding: .5rem 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand__logo { display: block; height: 46px; width: auto; border-radius: 6px; filter: var(--logo-filter); }
.brand a { display: inline-flex; align-items: center; }

.mainnav ul { list-style: none; display: flex; gap: .35rem; margin: 0; padding: 0; flex-wrap: wrap; }
.mainnav a {
  display: inline-block; padding: .45rem .7rem;
  text-decoration: none; color: var(--brand); font-weight: 600; font-size: .95rem;
  border-radius: .55rem; border: 1px solid transparent;
}
.mainnav a:hover { background: rgba(24, 169, 153, .14); color: var(--brand); }
.mainnav a.is-active { border-color: var(--accent); background: rgba(24, 169, 153, .16); }
.mainnav a.is-external::after { content: " \2197"; font-size: .8em; color: var(--ink-dim); }

.nav-toggle { display: none; width: 44px; height: 38px; border: 1px solid var(--border); background: var(--panel); border-radius: .5rem; cursor: pointer; }
.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after { display: block; position: relative; width: 22px; height: 2px; background: var(--brand); margin: 0 auto; }
.nav-toggle__bar::before, .nav-toggle__bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bar::before { top: -7px; } .nav-toggle__bar::after { top: 7px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink);
  padding: .35rem .6rem; border-radius: .6rem; cursor: pointer;
  box-shadow: var(--shadow-sm); font-family: var(--font); font-size: .9rem;
}
.theme-toggle .icon { font-size: 1rem; }

@media (max-width: 980px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; }
  .mainnav.open { display: block; position: absolute; top: 62px; left: 0; right: 0; background: var(--panel); border-bottom: 1px solid var(--border); z-index: 999; box-shadow: var(--shadow-sm); }
  .mainnav.open ul { flex-direction: column; gap: 0; padding: .4rem .75rem .75rem; }
  .mainnav.open a { display: block; padding: .6rem .65rem; }
  .theme-toggle .label { display: none; }
}

/* ---------- Layout ----------
   Generous spacing between opaque panels lets the paper texture
   show through as bands on every screen size. */
.wrap { max-width: var(--maxw); margin: 2.25rem auto; padding: 0 1.25rem; }

/* Hero */
.hero {
  background: linear-gradient(165deg, var(--panel) 55%, var(--panel-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
  margin-bottom: 2.25rem;
  border-top: 4px solid var(--accent);
}
.hero h1 { font-family: var(--serif); font-size: var(--step-1); margin: 0 0 .5rem; color: var(--heading); line-height: 1.25; }
.hero .lede { font-size: var(--step-3); color: var(--ink); max-width: 62ch; margin: .5rem 0 1rem; }
.hero .actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.1rem; }

.button {
  display: inline-block; padding: .6rem 1rem; border-radius: .6rem;
  background: var(--accent-ink); color: #fff; text-decoration: none;
  font-weight: 600; border: none; box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .button { background: var(--accent); color: #10221f; }
.button:hover { background: var(--accent); color: #fff; }
[data-theme="dark"] .button:hover { background: #4adfcd; color: #10221f; }
.button--ghost { background: transparent; color: var(--brand); border: 1px solid var(--border); box-shadow: none; }
.button--ghost:hover { background: var(--panel-soft); color: var(--brand); }

/* Section panels — alternating warm tints instead of flat white */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2.25rem;
}
/* Tinted panels get a soft top-to-bottom gradient in their own colour */
.panel--soft { background: linear-gradient(180deg, var(--panel-soft), var(--panel)); }
.panel--sand { background: linear-gradient(180deg, var(--panel-sand), var(--panel)); }

h2 { font-family: var(--serif); font-size: var(--step-2); color: var(--heading); margin: .25rem 0 .75rem; }
h3 { font-size: var(--step-3); color: var(--heading); margin: 1.1rem 0 .4rem; }
p, li { font-size: var(--step-4); }
ul, ol { padding-left: 1.2rem; }
li { margin: .3rem 0; }

.section-rule { border: none; border-top: 3px solid var(--accent); width: 56px; margin: 0 0 1rem; border-radius: 2px; }

/* Service pillar cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin: 1rem 0 .25rem; }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: linear-gradient(180deg, var(--panel-blue), var(--panel));
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column;
}
.card h3 { margin-top: 0; }
.card ul { margin: .4rem 0 .75rem; }
.card .more { margin-top: auto; font-weight: 600; }

/* Recognition strip */
.recognition { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
@media (max-width: 900px) { .recognition { grid-template-columns: 1fr; } }
.recognition article { border-left: 3px solid var(--accent); padding-left: .9rem; }
.recognition h3 { margin: 0 0 .25rem; font-size: 1rem; }
.recognition p { margin: 0; color: var(--ink-dim); font-size: .92rem; }

/* Contact CTA band */
.cta {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.cta h2 { color: var(--cta-ink); margin: 0 0 .25rem; }
.cta p { margin: 0; color: var(--cta-dim); }
.cta a.button { background: var(--accent); color: #0e2724; }
.cta a.button:hover { background: #4adfcd; color: #0e2724; }
.cta .contact-line a:not(.button) { color: var(--link-on-dark); }

/* ---------- Images for text relief ---------- */
.panel, .hero { display: flow-root; } /* contain floated figures */

figure.img-right {
  float: right;
  width: clamp(140px, 30%, 230px);
  margin: .25rem 0 .9rem 1.25rem;
}
figure.img-right img,
.bio img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
figcaption { color: var(--ink-dim); font-size: .82rem; margin-top: .35rem; line-height: 1.4; }
@media (max-width: 560px) {
  figure.img-right { float: none; width: min(70%, 260px); margin: 1rem auto; }
}

/* Bio rows: portrait beside text */
.bio { display: grid; grid-template-columns: 130px 1fr; gap: 1.1rem; align-items: start; margin-bottom: 1.25rem; }
.bio:last-child { margin-bottom: 0; }
.bio h3 { margin-top: 0; }
.bio p { margin: .35rem 0; }
@media (max-width: 560px) {
  .bio { grid-template-columns: 1fr; }
  .bio img { width: min(60%, 200px); }
}

/* Blockquote (testimonials) */
blockquote {
  margin: 1rem 0; padding: .75rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--panel-soft);
  border-radius: .5rem; font-style: italic;
}
blockquote .who { display: block; margin-top: .5rem; font-style: normal; font-weight: 600; color: var(--ink-dim); font-size: .9rem; }

/* APA publication lists */
.pub-list.apa { list-style: decimal; }
.pub-list.apa li { padding-left: 1.6rem; text-indent: -1.6rem; margin-bottom: .6rem; }
.refs p { padding-left: 1.6rem; text-indent: -1.6rem; margin: 0 0 .6rem; }

/* Client / organisation logo wall — white tiles work in both themes */
.logo-wall { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; margin: 1rem 0 0; padding: 0; }
.logo-wall li { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem; display: flex; align-items: center; justify-content: center; min-height: 84px; margin: 0; }
.logo-wall img { max-height: 64px; width: auto; max-width: 100%; }

/* Case-study article spacing */
.case + .case { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.25rem; }

/* Responsive video */
.video-container { position: relative; overflow: hidden; width: 100%; padding-top: 56.25%; margin: 1.5rem auto; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* Footer */
.footer {
  max-width: var(--maxw); margin: 2rem auto 2.5rem; padding: 1.25rem 1rem 0;
  border-top: 1px solid var(--border);
  color: var(--ink-dim); font-size: .9rem;
}
.footer nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; margin: 0 0 .5rem; padding: 0; }
.footer a { color: var(--ink-dim); }
.footer a:hover { color: var(--accent-ink); }

/* Print */
@media print {
  body::before { display: none; }
  .topbar, .footer nav, .cta { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .hero, .card { border: none; box-shadow: none; background: #fff; }
}
