/* ===================================================================
   Caseworker marketing site
   Design tokens mirror the application's own system (resources/css/app.css
   in the casefile repo) so the two read as the same product.
   =================================================================== */

:root {
  --primary-50:  #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;

  --neutral-50:  #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-500: #6b7280;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #dc2626;

  /* Semantic surface tokens — remapped wholesale in dark mode. */
  --bg:          #ffffff;
  --bg-alt:      var(--neutral-50);
  --bg-raised:   #ffffff;
  --text:        var(--neutral-900);
  --text-muted:  var(--neutral-500);
  --text-subtle: var(--neutral-600);
  --border:      var(--neutral-200);
  --border-soft: var(--neutral-100);
  --accent:      var(--primary-600);
  --accent-hover:var(--primary-700);
  --accent-soft: var(--primary-50);
  --shadow-sm:   0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-md:   0 4px 12px rgb(16 24 40 / 8%);
  --shadow-lg:   0 18px 40px rgb(16 24 40 / 10%);

  --wrap: 1120px;
  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0f1117;
    --bg-alt:      #151823;
    --bg-raised:   #1a1e2b;
    --text:        #f3f4f6;
    --text-muted:  #9ca3af;
    --text-subtle: #c3c8d2;
    --border:      #2a3040;
    --border-soft: #222736;
    --accent:      #818cf8;
    --accent-hover:#a5b4fc;
    --accent-soft: #1e2338;
    --success:     #34d399;
    --danger:      #f87171;
    --shadow-sm:   0 1px 2px rgb(0 0 0 / 40%);
    --shadow-md:   0 4px 12px rgb(0 0 0 / 45%);
    --shadow-lg:   0 18px 40px rgb(0 0 0 / 55%);
  }
}

/* ── Base ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

/* config.js toggles the `hidden` attribute to reshape the page when the
   hosted app is offline. Components with an explicit `display` (.btn is
   inline-flex) would otherwise ignore it. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); }
h3 { font-size: 1.06rem; font-weight: 600; }
p  { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem; border-radius: 0 0 var(--radius-sm) 0; z-index: 100;
}
.skip-link:focus { left: 0; top: 0; color: #fff; }

.eyebrow {
  font-size: .78rem; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .75rem;
}

.muted { color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.4rem;
  font-size: .95rem; font-weight: 500; font-family: inherit;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; box-shadow: var(--shadow-md); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); border-color: var(--neutral-400); color: var(--text); }

.btn-sm { padding: .5rem 1rem; font-size: .88rem; }
.btn-lg { padding: .9rem 1.9rem; font-size: 1.02rem; }

.icon-inline { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* ── Header ───────────────────────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding: .9rem 0; }
.brand { flex: none; }
.brand img { width: 168px; }
@media (prefers-color-scheme: dark) {
  /* Logo artwork is dark ink on transparent — invert it for dark surfaces. */
  .brand img, .footer-logo { filter: invert(1) brightness(1.9); }
}

.nav { display: flex; gap: 1.75rem; margin-left: auto; }
.nav a {
  color: var(--text-subtle); text-decoration: none;
  font-size: .93rem; font-weight: 500;
}
.nav a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .nav { display: none; }
  .header-inner > .btn { margin-left: auto; }
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.hero {
  padding: clamp(3rem, 1.5rem + 6vw, 6rem) 0 clamp(3rem, 2rem + 4vw, 5rem);
  background:
    radial-gradient(900px 420px at 15% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.hero-grid {
  display: grid; gap: clamp(2.5rem, 1rem + 5vw, 4.5rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.05fr 1fr; }
}

.hero-copy h1 { margin-bottom: 1rem; text-wrap: balance; }
.lede { font-size: 1.12rem; color: var(--text-subtle); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.9rem; }
.hero-note { margin-top: 1.2rem; font-size: .87rem; color: var(--text-muted); }

.hero-visual { filter: drop-shadow(var(--shadow-lg)); }
.app-shell { width: 100%; }
.sh-bg        { fill: var(--bg-raised); }
.sh-topbar    { fill: var(--bg-alt); }
.sh-sidebar   { fill: var(--bg-alt); }
.sh-frame     { fill: none; stroke: var(--border); stroke-width: 1; }
.sh-dot       { fill: var(--neutral-300); }
.sh-card      { fill: var(--bg-raised); stroke: var(--border); stroke-width: 1; }
.sh-line-soft { fill: var(--border); }
.sh-line-strong { fill: var(--neutral-400); }
.sh-nav-active{ fill: var(--accent); opacity: .85; }
.sh-pill-open { fill: var(--primary-200); }
.sh-pill-wait { fill: var(--warning); opacity: .55; }
.sh-pill-done { fill: var(--success); opacity: .5; }

@media (prefers-color-scheme: dark) {
  .sh-dot { fill: var(--border); }
  .sh-line-strong { fill: var(--text-muted); }
  .sh-pill-open { fill: var(--accent); opacity: .5; }
}

/* ── Sections ─────────────────────────────────────────────────────── */

.section { padding: clamp(3.5rem, 2rem + 5vw, 6rem) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border-soft); }

.section-head { max-width: 62ch; margin-bottom: clamp(2rem, 1rem + 2vw, 3rem); }
.section-head h2 { text-wrap: balance; }
.section-lede { color: var(--text-subtle); }

/* ── Feature grid ─────────────────────────────────────────────────── */

.feature-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(276px, 1fr));
}
.feature {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.feature:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.feature h3 { margin-bottom: .4rem; }
.feature p { margin: 0; font-size: .94rem; color: var(--text-subtle); }

.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-bottom: 1.05rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature-icon svg {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Steps ────────────────────────────────────────────────────────── */

.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  counter-reset: step;
}
/* Keep all five steps on a single row once there's room, rather than
   letting auto-fit drop the last one onto a line of its own. */
@media (min-width: 1040px) {
  .steps { grid-template-columns: repeat(5, 1fr); }
}
.step {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.35rem;
}
.step h3 { margin: 0 0 .35rem; font-size: 1rem; }
.step p { margin: 0; font-size: .9rem; color: var(--text-subtle); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-bottom: .9rem;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .84rem; font-weight: 600;
}

/* ── Integrations panel ───────────────────────────────────────────── */

.integration-panel {
  list-style: none; margin: 0; padding: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.integration {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem 1.15rem;
  align-items: start;
  padding: 1.4rem 1.5rem;
  border-top: 1px solid var(--border-soft);
}
.integration:first-child { border-top: 0; }

.integration-icon {
  grid-row: span 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.integration-icon svg {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.integration-body h3 { margin: 0 0 .3rem; }
.integration-body p {
  margin: 0; font-size: .93rem; color: var(--text-subtle);
  max-width: 60ch;
}

.integration-tag {
  grid-column: 2;
  margin-top: .6rem;
  justify-self: start;
  font-size: .76rem; font-weight: 500; letter-spacing: .03em;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .7rem;
  white-space: nowrap;
}

/* On wider screens the tag sits out to the right of the description. */
@media (min-width: 820px) {
  .integration {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.15rem;
  }
  .integration-icon { grid-row: auto; }
  .integration-tag { grid-column: auto; margin-top: 0; justify-self: end; }
}

/* ── CTA ──────────────────────────────────────────────────────────── */

.cta {
  padding: clamp(3rem, 2rem + 4vw, 5rem) 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border-soft);
}
.cta-inner { text-align: center; max-width: 56ch; margin-inline: auto; }
.cta-inner p { color: var(--text-subtle); margin-bottom: 1.8rem; }
.cta-lede { max-width: 48ch; margin-inline: auto; }

/* ── Enquiry form ─────────────────────────────────────────────────── */

.enquiry-form {
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.4rem, 1rem + 1.5vw, 2rem);
}

.field-row { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

.field { margin: 0 0 1.1rem; }
.field label {
  display: block;
  margin-bottom: .4rem;
  font-size: .87rem; font-weight: 500;
  color: var(--text);
}
.field-optional {
  font-weight: 400; color: var(--text-muted);
  font-size: .8rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: .65rem .85rem;
  font: inherit; font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 7rem; }

.field input:hover,
.field textarea:hover { border-color: var(--neutral-400); }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Only flag invalid fields the visitor has actually engaged with. */
.field input:user-invalid,
.field textarea:user-invalid {
  border-color: var(--danger, #ef4444);
}

.enquiry-form button[type="submit"] { width: 100%; margin-top: .3rem; }
.enquiry-form button[disabled] { opacity: .6; cursor: progress; }

/* Honeypot — off-screen rather than display:none, which some bots skip. */
.hp {
  position: absolute !important;
  left: -9999px;
  width: 1px; height: 1px;
  opacity: 0;
}

.form-status {
  margin: 1rem 0 0;
  font-size: .9rem;
  text-align: center;
  min-height: 1.2em;
}
.form-status:empty { margin-top: 0; }
.form-status.is-success { color: var(--success); }
.form-status.is-error { color: var(--danger, #ef4444); }

.form-footnote {
  margin: 1.1rem 0 0;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ── Footer ───────────────────────────────────────────────────────── */

.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 1rem 2rem;
}
.footer-logo { width: 140px; opacity: .75; }
.footer-nav { display: flex; gap: 1.5rem; }
.footer-nav a { color: var(--text-subtle); text-decoration: none; font-size: .92rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-note { margin: 0 0 0 auto; font-size: .87rem; color: var(--text-muted); }
@media (max-width: 640px) {
  .footer-note { margin-left: 0; }
}
