/* ==========================================================================
   Huai Service - advertising campaign performance services, New Zealand
   Art direction: "analyst's field notebook" - deep spruce + marigold,
   graph-paper hero, condensed DIN-style display type, sharp 3px corners.
   ========================================================================== */

:root {
  /* Colour */
  --primary: #1E4D47;
  --primary-deep: #12302C;
  --primary-mid: #4F837A;
  --primary-soft: #E3ECE9;
  --accent: #E8A93A;
  --accent-hover: #F0BA57;
  --accent-ink: #8A5A0B;
  --accent-soft: #FBEFD8;
  --bg: #F5F6F3;
  --surface: #FFFFFF;
  --n100: #ECEFEB;
  --border: #D3DAD6;
  --border-strong: #A9B6B1;
  --text-light: #55615D;
  --text-dark: #17211F;
  --on-dark: #EEF3F1;
  --on-dark-muted: #B5C6C1;
  --footer-bar: #0D2421;

  /* Translucent tokens */
  --nav-bg: rgba(245, 246, 243, 0.84);
  --line-dark: rgba(238, 243, 241, 0.16);
  --grid-line: rgba(238, 243, 241, 0.06);
  --bar-dark: rgba(238, 243, 241, 0.58);
  --panel-dark: rgba(13, 36, 33, 0.55);
  --accent-line: rgba(232, 169, 58, 0.45);
  --glow: rgba(232, 169, 58, 0.20);
  --glow-cool: rgba(79, 131, 122, 0.45);

  /* Type */
  --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Bahnschrift, "DIN Alternate", "DIN Condensed", "Franklin Gothic Medium", "Arial Narrow", -apple-system, "Segoe UI", sans-serif;
  --fs-hero: clamp(2.25rem, 5vw, 4rem);
  --fs-page: clamp(2rem, 4vw, 3rem);
  --fs-h2: clamp(1.6rem, 3vw, 2.4rem);
  --fs-h3: 1.22rem;
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.05rem, 1.6vw, 1.25rem);
  --fs-small: 0.875rem;
  --fs-eyebrow: 0.78rem;
  --measure: 66ch;

  /* Spacing */
  --s1: 0.5rem;
  --s2: 0.75rem;
  --s3: 1rem;
  --s4: 1.5rem;
  --s5: 2.5rem;
  --s6: 4rem;
  --s7: 6rem;

  /* Layout, shape, depth, motion */
  --container: 1140px;
  --gutter: 1.25rem;
  --nav-height: 4.25rem;
  --grid-size: 3rem;
  --radius: 3px;
  --hairline: 1px;
  --bar: 2px;
  --shadow-sm: 0 1px 2px rgba(23, 33, 31, 0.05);
  --shadow: 0 1px 2px rgba(23, 33, 31, 0.04), 0 8px 24px rgba(23, 33, 31, 0.07);
  --shadow-deep: 0 2px 4px rgba(6, 20, 18, 0.20), 0 24px 48px rgba(6, 20, 18, 0.35);
  --shadow-glow: 0 6px 20px rgba(232, 169, 58, 0.30);
  --ease: 180ms ease;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text-dark);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s3);
  color: inherit;
}
h3 { font-size: var(--fs-h3); line-height: 1.2; }
p { margin: 0 0 var(--s3); max-width: var(--measure); }
a { color: var(--primary); text-underline-offset: 0.2em; transition: color var(--ease); }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
strong { font-weight: 700; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s3); top: calc(var(--s6) * -1);
  z-index: 100; padding: var(--s1) var(--s3);
  background: var(--accent); color: var(--text-dark);
  font-weight: 700; border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: var(--s3); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Section scaffolding ---------- */
.section { padding: var(--s7) 0; }
.section-alt { background: var(--surface); border-top: var(--hairline) solid var(--border); border-bottom: var(--hairline) solid var(--border); }
.section-head { max-width: 46rem; margin-bottom: var(--s5); }
.section-head h2 { font-size: var(--fs-h2); }
.section-foot { margin-top: var(--s5); }
.eyebrow {
  display: inline-block;
  margin-bottom: var(--s2);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.lead { font-size: var(--fs-lead); color: var(--text-light); }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: var(--hairline) solid var(--border);
}
.nav-inner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: var(--nav-height); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); color: var(--text-dark); text-decoration: none; }
.brand:hover { color: var(--text-dark); }
.brand-mark {
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem;
  background: var(--primary); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
  border-radius: var(--radius);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.nav-menu { display: flex; align-items: center; gap: var(--s5); }
.nav-links { display: flex; gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.nav-links a {
  position: relative; display: inline-block; padding: var(--s1) 0;
  color: var(--text-dark); font-size: 0.95rem; font-weight: 500; text-decoration: none;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--bar); background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform var(--ease);
}
.nav-links a:hover { color: var(--primary); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--primary); font-weight: 700; }
.nav-cta { white-space: nowrap; }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  padding: 0.8rem 1.6rem;
  font: inherit; font-size: 0.98rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; border-radius: var(--radius);
  transition: transform var(--ease), box-shadow var(--ease), background-color var(--ease), color var(--ease), border-color var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: var(--surface); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-deep); color: var(--surface); box-shadow: var(--shadow); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); color: var(--primary-deep); }
.btn-accent { background: var(--accent); color: var(--text-dark); }
.btn-accent:hover { background: var(--accent-hover); color: var(--text-dark); box-shadow: var(--shadow-glow); }
.btn-ghost-light { background: transparent; color: var(--on-dark); border-color: var(--on-dark-muted); }
.btn-ghost-light:hover { background: var(--line-dark); color: var(--on-dark); border-color: var(--on-dark); }
.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.9rem; }

/* ---------- Hero (graph-paper ground) ---------- */
.hero, .page-hero, .band-dark {
  color: var(--on-dark);
  background:
    radial-gradient(ellipse 55% 70% at 88% 28%, var(--glow), transparent 70%),
    radial-gradient(ellipse 50% 60% at 0% 100%, var(--glow-cool), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / var(--grid-size) var(--grid-size),
    linear-gradient(160deg, var(--primary) 0%, var(--primary-deep) 72%);
}
.hero {
  position: relative;
  display: flex; align-items: center;
  min-height: 60vh;
  padding: var(--s6) 0 calc(var(--s7) + var(--s5));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--s6)), 0 100%);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--s6); align-items: center; }
.hero-copy { min-width: 0; }
.hero h1 { font-size: var(--fs-hero); line-height: 1.04; margin-bottom: var(--s4); max-width: 17ch; }
.hero .eyebrow, .page-hero .eyebrow, .band-dark .eyebrow { color: var(--accent); }
.hero-lead { max-width: 48ch; margin-bottom: var(--s5); font-size: var(--fs-lead); color: var(--on-dark-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.hero-visual { position: relative; min-width: 0; }
.hero-visual::before {
  content: ""; position: absolute;
  top: var(--s4); right: calc(var(--s4) * -1); bottom: calc(var(--s4) * -1); left: var(--s4);
  border: var(--hairline) solid var(--accent-line); border-radius: var(--radius);
}
.panel {
  position: relative;
  margin: 0;
  padding: var(--s4);
  background: var(--panel-dark);
  border: var(--hairline) solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-deep);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.panel-note { margin: var(--s2) 0 0; font-size: var(--fs-small); color: var(--on-dark-muted); }
.hero-chart { display: block; width: 100%; height: auto; }

/* SVG chart parts (dark ground) */
.viz-caption { fill: var(--on-dark-muted); font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.viz-label { fill: var(--on-dark); font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.viz-rule { stroke: var(--line-dark); stroke-width: 1; }
.viz-track { fill: var(--line-dark); }
.viz-bar { fill: var(--bar-dark); }
.viz-bar-accent { fill: var(--accent); }
.viz-edge { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 4; }

/* SVG chart parts (light ground) */
.chart { display: block; width: 100%; height: auto; }
.chart-caption { fill: var(--text-light); font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.chart-label { fill: var(--text-dark); font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.chart-rule { stroke: var(--border); stroke-width: 1; }
.seg-a { fill: var(--primary); }
.seg-b { fill: var(--primary-mid); }
.seg-c { fill: var(--accent); }
.seg-d { fill: var(--border-strong); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: var(--s6) 0 calc(var(--s6) + var(--s4));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--s5)), 0 100%);
}
.page-hero h1 { font-size: var(--fs-page); max-width: 22ch; margin-bottom: var(--s3); }
.page-hero-lead { max-width: 56ch; margin: 0; font-size: var(--fs-lead); color: var(--on-dark-muted); }

/* ---------- Value props (ruled columns, not cards) ---------- */
.props-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); }
.prop { padding-top: var(--s4); border-top: var(--bar) solid var(--primary); }
.prop h3 { margin-bottom: var(--s2); }
.prop p { margin: 0; color: var(--text-light); }

/* ---------- Services ---------- */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: var(--s4); }
.service-card {
  display: flex; flex-direction: column;
  padding: var(--s5) var(--s4) var(--s4);
  background: var(--surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--ease);
}
.service-card:hover { border-color: var(--primary-mid); }
.service-card h3 { margin-top: var(--s4); margin-bottom: var(--s2); }
.service-card p { color: var(--text-light); }
.service-card p:last-child { margin-bottom: 0; }
.icon-tile {
  display: grid; place-items: center;
  width: 3rem; height: 3rem;
  background: var(--primary-soft); color: var(--primary);
  border-radius: var(--radius);
}
.icon-tile svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.check-list { margin: var(--s2) 0 0; padding: var(--s3) 0 0; list-style: none; border-top: var(--hairline) solid var(--n100); }
.check-list li { position: relative; padding-left: var(--s4); margin-bottom: var(--s1); font-size: 0.95rem; color: var(--text-dark); }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: var(--s1); height: var(--s1); background: var(--accent);
}
.split-visual > .check-list { margin: 0; padding-top: 0; border-top: 0; }
.split-copy .check-list { margin-top: var(--s4); }

/* ---------- Two-column split ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s6); align-items: center; }
.split > * { min-width: 0; }
.split-reverse .split-copy { order: 2; }
.split-reverse .split-visual { order: 1; }
.split-copy h2 { font-size: var(--fs-h2); }
.split-copy p { color: var(--text-light); }
.split-visual {
  padding: var(--s4);
  background: var(--surface);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Dark band: process ---------- */
.band-dark { padding: var(--s7) 0; }
.band-dark h2 { font-size: var(--fs-h2); }
.band-dark .lead { color: var(--on-dark-muted); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.step { padding: var(--s4) 0 0; border-top: var(--hairline) solid var(--line-dark); }
.step-num { display: block; margin-bottom: var(--s2); font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1; color: var(--accent); }
.step h3 { color: var(--on-dark); margin-bottom: var(--s2); }
.step p { margin: 0; font-size: 0.97rem; color: var(--on-dark-muted); }

/* ---------- Credentials strip ---------- */
.credentials { padding: var(--s5) 0; background: var(--surface); border-bottom: var(--hairline) solid var(--border); }
.cred-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin: 0; }
.cred-item { padding-left: var(--s3); border-left: var(--bar) solid var(--accent); min-width: 0; }
.cred-item dt { font-size: var(--fs-small); color: var(--text-light); margin-bottom: var(--s1); }
.cred-item dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- CTA band ---------- */
.cta-band { padding: var(--s6) 0; background: var(--accent-soft); border-top: var(--hairline) solid var(--border); }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; }
.cta-inner h2 { font-size: var(--fs-h2); margin-bottom: var(--s1); }
.cta-inner p { margin: 0; color: var(--text-light); }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--s6); align-items: start; }
.contact-grid > * { min-width: 0; }
.contact-card {
  padding: var(--s5);
  background: var(--surface);
  border: var(--hairline) solid var(--border);
  border-top: var(--bar) solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.contact-card h2 { font-size: var(--fs-h2); }
.contact-email { display: inline-block; margin: var(--s2) 0 var(--s4); font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; overflow-wrap: anywhere; }
.detail-list { margin: 0; padding: 0; list-style: none; }
.detail-list li { padding: var(--s3) 0; border-bottom: var(--hairline) solid var(--border); }
.detail-list li:first-child { padding-top: 0; }
.detail-list strong { display: block; font-family: var(--font-display); font-size: var(--fs-h3); margin-bottom: var(--s1); }
.detail-list span { color: var(--text-light); }

/* ---------- Legal pages ---------- */
.legal-layout { display: grid; grid-template-columns: 15rem 1fr; gap: var(--s6); align-items: start; }
.legal-layout > * { min-width: 0; }
.toc { position: sticky; top: calc(var(--nav-height) + var(--s4)); padding-left: var(--s3); border-left: var(--hairline) solid var(--border); }
.toc p { margin-bottom: var(--s2); font-size: var(--fs-small); font-weight: 700; color: var(--text-light); }
.toc ol { margin: 0; padding-left: var(--s3); font-size: var(--fs-small); }
.toc li { margin-bottom: var(--s1); }
.toc a { color: var(--text-dark); text-decoration: none; }
.toc a:hover { color: var(--accent-ink); text-decoration: underline; }
.legal-body h2 { font-size: 1.4rem; margin-top: var(--s5); padding-top: var(--s2); scroll-margin-top: calc(var(--nav-height) + var(--s4)); }
.legal-body h2:first-of-type { margin-top: 0; }
.legal-body ul { max-width: var(--measure); padding-left: var(--s4); margin: 0 0 var(--s3); }
.legal-body li { margin-bottom: var(--s1); }
.legal-meta { font-size: var(--fs-small); color: var(--text-light); margin-bottom: var(--s5); }

/* ---------- Footer ---------- */
.footer { background: var(--primary-deep); color: var(--on-dark-muted); border-top: var(--hairline) solid var(--line-dark); font-size: 0.95rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.3fr; gap: var(--s5); padding-top: var(--s6); padding-bottom: var(--s6); }
.footer-grid > * { min-width: 0; }
.footer .brand { color: var(--on-dark); margin-bottom: var(--s3); }
.footer .brand:hover { color: var(--on-dark); }
.footer-blurb { max-width: 36ch; }
.footer-legal { margin: 0; font-size: var(--fs-small); overflow-wrap: anywhere; }
.footer-legal strong { display: block; color: var(--on-dark); font-weight: 600; }
.footer-heading { margin-bottom: var(--s3); font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--on-dark); }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links li { margin-bottom: var(--s1); overflow-wrap: anywhere; }
.footer a { color: var(--on-dark); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-bar { background: var(--footer-bar); border-top: var(--hairline) solid var(--line-dark); }
.footer-bar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s3); padding-bottom: var(--s3); font-size: var(--fs-small); }
.footer-bar-inner p { margin: 0; }
.footer-bar-links { display: flex; gap: var(--s4); margin: 0; padding: 0; list-style: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .nav-menu { gap: var(--s4); }
  .nav-links { gap: var(--s3); }
  .steps { grid-template-columns: repeat(2, 1fr); gap: var(--s5) var(--s4); }
  .cred-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .legal-layout { grid-template-columns: 12rem 1fr; gap: var(--s5); }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .section, .band-dark { padding: var(--s6) 0; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 0.3rem;
    width: 2.75rem; height: 2.75rem; padding: 0 var(--s2);
    background: transparent; border: var(--hairline) solid var(--border); border-radius: var(--radius);
    cursor: pointer;
  }
  .nav-toggle-bar { display: block; height: var(--bar); background: var(--text-dark); transition: transform var(--ease), opacity var(--ease); }
  .nav-inner.open .nav-toggle-bar:nth-child(1) { transform: translateY(calc(0.3rem + var(--bar))) rotate(45deg); }
  .nav-inner.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav-inner.open .nav-toggle-bar:nth-child(3) { transform: translateY(calc(-0.3rem - var(--bar))) rotate(-45deg); }
  .nav-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: var(--s3);
    padding: var(--s3) var(--gutter) var(--s4);
    background: var(--surface);
    border-bottom: var(--hairline) solid var(--border);
    box-shadow: var(--shadow);
  }
  .nav-inner.open .nav-menu { display: flex; }
  .nav-links { flex-direction: column; gap: 0; }
  .nav-links a { display: block; padding: var(--s2) 0 var(--s2) var(--s3); border-bottom: var(--hairline) solid var(--n100); }
  .nav-links a::after { top: 0; bottom: 0; right: auto; width: var(--bar); height: auto; transform: scaleY(0); transform-origin: top; }
  .nav-links a:hover::after, .nav-links a.active::after { transform: scaleY(1); }

  .hero {
    min-height: auto;
    padding: var(--s5) 0 var(--s6);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--s4)), 0 100%);
  }
  .hero-grid, .split, .contact-grid, .legal-layout { grid-template-columns: 1fr; gap: var(--s5); }
  .hero-visual { display: none; }
  .split-reverse .split-copy, .split-reverse .split-visual { order: 0; }
  .page-hero { padding: var(--s5) 0 var(--s6); clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--s4)), 0 100%); }
  .props-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .toc { position: static; }
  .contact-card { padding: var(--s4); }
  .cta-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .steps, .cred-list, .footer-grid { grid-template-columns: 1fr; }
  .hero-actions .btn, .cta-actions .btn { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .btn:hover { transform: none; }
}
