/* ==========================================================================
   TriSun Insights - styles.css
   Design system: navy and gold from the logo, one indigo action colour,
   Source Serif 4 headings, Inter body, 8pt spacing scale.
   Contrast checked against WCAG AA (see notes beside each text colour).
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Colour */
  --bg: #FBFBFA;            /* page ground */
  --surface: #FFFFFF;       /* cards, dialog */
  --tint: #F1F0FB;          /* alternate bands, icon tiles */
  --tint-deep: #E4E1F6;
  --line: #E4E6F0;          /* hairlines, card borders */
  --navy: #14213D;          /* logo navy: headings, dark bands */
  --navy-deep: #0E1730;
  --text: #2F3A52;          /* body text: 10.98:1 on bg */
  --muted: #5B6479;         /* secondary text: 5.25:1 on tint, 5.72:1 on bg */
  --indigo: #4338CA;        /* actions, links: 7.63:1 on bg, white text on it 7.9:1 */
  --indigo-deep: #3730A3;   /* hover: white text 9.93:1 */
  --gold: #C4A66D;          /* logo gold: on dark bands only (6.86:1 on navy) */
  --gold-text: #7A5C12;     /* gold-toned text on light grounds (6.02:1 on bg) */
  --on-dark: #C9D0E2;       /* body text on navy: 10.35:1 */
  --teal: #17717A;          /* success only */
  --coral: #B8472A;         /* errors and the one highlighted chart bar */

  /* Type */
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-h1: clamp(2.125rem, 1.4rem + 3.4vw, 3.5rem);
  --fs-h2: clamp(1.75rem, 1.3rem + 1.9vw, 2.5rem);
  --fs-h3: 1.125rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-xs: 0.8125rem;

  /* Space (8pt scale) */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --section-y: clamp(4.5rem, 3rem + 6vw, 7.5rem);

  /* Shape and depth */
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1160px;
  --shadow-sm: 0 1px 2px rgba(20, 33, 61, .05);
  --shadow-md: 0 10px 28px rgba(20, 33, 61, .08), 0 2px 6px rgba(20, 33, 61, .04);
  --shadow-lg: 0 24px 56px rgba(20, 33, 61, .12), 0 4px 12px rgba(20, 33, 61, .05);
  --shadow-glow: 0 12px 28px rgba(67, 56, 202, .22);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; -webkit-text-size-adjust: 100%; }
html.modal-open { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--indigo); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
p { text-wrap: pretty; }
h1, h2, h3 { color: var(--navy); text-wrap: balance; }
h1, h2 { font-family: var(--font-head); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-family: var(--font-body); font-weight: 600; font-size: var(--fs-h3); line-height: 1.35; }

:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; border-radius: 6px; }
.band-dark :focus-visible, .site-footer :focus-visible { outline-color: var(--gold); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s4); top: -4rem; z-index: 100;
  background: var(--navy); color: #fff; padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--s3); }

/* ---------- 3. Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 3.25rem; padding: 0 1.75rem;
  border: 0; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 1rem; line-height: 1;
  text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn-sm { min-height: 2.75rem; padding: 0 1.25rem; font-size: var(--fs-small); }
.btn-text {
  padding: var(--s2) 0; border: 0; background: none;
  color: var(--indigo); font-weight: 600; font-size: var(--fs-small);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px;
  transition: text-decoration-color .2s var(--ease);
}
.btn-text:hover { text-decoration-color: currentColor; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--gold-text);
}
.eyebrow::before { content: ""; width: 1.5rem; height: 3px; border-radius: 2px; background: var(--gold); }
.band-dark .eyebrow { color: var(--gold); }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 251, 250, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); min-height: 4.75rem; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 3.25rem; width: auto; }

/* ---------- 5. Sections ---------- */
.section { padding-block: var(--section-y); }
.section-tint { background: var(--tint); }
.section-head { display: grid; gap: var(--s3); max-width: 40rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head.center { margin-inline: auto; text-align: center; justify-items: center; }
.lede { color: var(--muted); max-width: 56ch; }

.band-dark {
  color: var(--on-dark);
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.band-dark h2 { color: #fff; }

/* Scroll reveal: everything is visible by default. JS adds .reveal-pending only to blocks that start
   below the fold, so nothing in the first screen (or in a crawler's tall viewport) is ever hidden. */
.reveal-pending { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal-pending.is-visible { opacity: 1; transform: none; }

/* ---------- 6. Hero ---------- */
.hero { position: relative; overflow: clip; padding-block: clamp(3rem, 2rem + 5vw, 6.5rem); }
.hero::before {
  content: ""; position: absolute; top: -14rem; right: -10rem; width: 34rem; height: 34rem; border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 56, 202, .09) 0%, transparent 70%); pointer-events: none;
}
.hero-grid { position: relative; display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
.hero-copy { display: grid; gap: var(--s5); justify-items: start; }
.hero-copy .lede { font-size: 1.1875rem; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); margin-top: var(--s2); }
.hero-note { font-size: var(--fs-small); color: var(--muted); }
@media (min-width: 62rem) { .hero-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); } }

/* Illustrative insight card */
.insight-card {
  padding: var(--s6); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.insight-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.insight-head h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 600; letter-spacing: 0; line-height: 1.4; max-width: 24rem; }
.badge {
  flex-shrink: 0; padding: var(--s1) var(--s3); border-radius: 999px;
  background: var(--tint); color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
}
.bars { display: grid; gap: var(--s4); }
.bar { display: grid; gap: var(--s2); }
.bar-top { display: flex; justify-content: space-between; gap: var(--s4); font-size: var(--fs-small); color: var(--text); }
.bar-top strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.bar-track { height: .75rem; border-radius: 6px; background: var(--tint); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: var(--w); border-radius: 6px; background: linear-gradient(90deg, var(--indigo), #6D63F0); }
.bar-fill.is-top { background: linear-gradient(90deg, var(--coral), #D1693F); }
.bars-pending .bar-fill { width: 0; transition: width 1s var(--ease); }
.bars-pending.is-in .bar-fill { width: var(--w); }
.insight-note { margin-top: var(--s5); font-size: var(--fs-xs); color: var(--muted); }

/* ---------- 7. Proof points ---------- */
.proof { padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s5); text-align: center; }
.stat-num {
  display: block; font-family: var(--font-head); font-weight: 600; line-height: 1;
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem); color: var(--gold); font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: var(--s3); font-weight: 600; color: #fff; }
.stat-detail { display: block; margin-top: var(--s1); font-size: var(--fs-small); }
@media (min-width: 56rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- 8. Services ---------- */
.cards { display: grid; gap: var(--s5); grid-template-columns: 1fr; }
.card {
  display: grid; align-content: start; gap: var(--s3); padding: var(--s6);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--tint-deep); }
.card p { color: var(--muted); }
.icon-tile {
  display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: var(--s1);
  border-radius: 12px; color: var(--indigo);
  background: linear-gradient(145deg, var(--tint) 0%, var(--tint-deep) 100%);
}
.icon-tile svg { width: 1.5rem; height: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.chips li { padding: var(--s1) var(--s3); border-radius: 999px; background: var(--tint); color: var(--gold-text); font-size: var(--fs-xs); font-weight: 600; }
.cards-foot { margin-top: var(--s6); display: flex; justify-content: center; }
@media (min-width: 40rem) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 62rem) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- 9. How we work ---------- */
.flow { position: relative; display: grid; gap: var(--s6); counter-reset: step; grid-template-columns: 1fr; }
.flow li { position: relative; display: grid; align-content: start; gap: var(--s3); counter-increment: step; }
.flow li::before {
  content: counter(step, decimal-leading-zero);
  z-index: 1; display: grid; place-items: center; width: 4.25rem; height: 4.25rem; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--tint-deep); color: var(--indigo);
  font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; box-shadow: var(--shadow-sm);
}
.flow li:nth-child(2)::before { background: var(--tint-deep); }
.flow li:nth-child(3)::before { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.flow li:nth-child(4)::before { background: var(--navy); border-color: var(--navy); color: var(--gold); }
.flow p { color: var(--muted); }
@media (min-width: 40rem) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s5); } }
@media (min-width: 62rem) {
  .flow { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5); }
  .flow::before {
    content: ""; position: absolute; top: 2.0625rem; left: 2.125rem; width: calc(75% + 1.125rem); height: 2px;
    background: linear-gradient(90deg, var(--tint-deep), var(--indigo));
  }
}

/* ---------- 10. Closing call to action ---------- */
.closing { padding-block: clamp(5rem, 3rem + 8vw, 8.5rem); text-align: center; }
.closing-inner { display: grid; justify-items: center; gap: var(--s5); max-width: 40rem; }
.closing h2 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); }
.closing p { font-size: 1.125rem; }

/* ---------- 11. Footer ---------- */
.site-footer { padding-top: clamp(3rem, 2rem + 4vw, 5rem); padding-bottom: var(--s6); color: var(--on-dark); background: var(--navy-deep); }
.footer-grid { display: grid; gap: var(--s7) var(--s6); grid-template-columns: 1fr; }
.footer-brand { display: grid; gap: var(--s4); align-content: start; max-width: 22rem; }
.footer-brand img { height: 3.25rem; width: auto; }
.footer-brand p { font-size: var(--fs-small); }
.footer-col { display: grid; gap: var(--s1); align-content: start; }
.footer-title { margin-bottom: var(--s2); color: #fff; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.footer-col a, .footer-col button {
  justify-self: start; padding: var(--s1) 0; border: 0; background: none;
  color: var(--on-dark); font-size: var(--fs-small); text-decoration: none; text-align: left;
}
.footer-col a:hover, .footer-col button:hover { color: var(--gold); }
.footer-legal { margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid rgba(255, 255, 255, .1); font-size: var(--fs-xs); color: #AEB6CB; }
@media (min-width: 36rem) { .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-brand { grid-column: 1 / -1; } }
@media (min-width: 62rem) { .footer-grid { grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); } .footer-brand { grid-column: auto; } }

/* ---------- 12. Brief dialog and form ---------- */
.dialog {
  width: min(30rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; overflow-y: auto;
  border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(14, 23, 48, .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in .3s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.dialog-panel { position: relative; padding: var(--s6); }
.dialog-close {
  position: absolute; top: var(--s4); right: var(--s4); display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: none; color: var(--muted);
}
.dialog-close:hover { background: var(--tint); color: var(--navy); }
.dialog-close svg { width: 1.125rem; height: 1.125rem; }
.dialog h2 { font-size: 1.625rem; padding-right: 2.5rem; }
.dialog-desc { margin: var(--s2) 0 var(--s5); color: var(--muted); font-size: var(--fs-small); }

.field { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.field label { font-size: var(--fs-small); font-weight: 600; color: var(--navy); }
.field input, .field textarea, .field select {
  width: 100%; padding: .75rem .875rem; font: inherit; font-size: 1rem; color: var(--navy);
  background: var(--surface); border: 1.5px solid #B9BED0; border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field textarea { resize: vertical; min-height: 6rem; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(67, 56, 202, .18);
}
.field [aria-invalid="true"] { border-color: var(--coral); }
.field-error { color: var(--coral); font-size: var(--fs-small); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-submit { width: 100%; margin-top: var(--s2); }
.form-submit[disabled] { opacity: .7; cursor: progress; transform: none; box-shadow: none; }
.form-banner { margin-bottom: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); font-size: var(--fs-small); font-weight: 600; }
.form-banner.is-error { color: var(--coral); background: rgba(184, 71, 42, .08); border: 1px solid var(--coral); }
.form-success { display: grid; gap: var(--s3); padding: var(--s4) 0; }
.form-success p { color: var(--teal); font-weight: 600; font-size: 1.0625rem; }

/* ---------- 13. Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
