/*
 * Funding Pilot base styles and components.
 * Depends on tokens.css. Components are plain class names (no framework), grouped by section.
 */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; border-radius: 4px; }
/* Headings receive focus programmatically on step change (for screen readers); no ring needed */
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; 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(--space-4); top: -100px; z-index: 100; padding: var(--space-2) var(--space-4);
  background: var(--color-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: var(--space-4); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }
.section { padding-block: var(--section-y); }
.section--surface { background: var(--color-surface); }
.stack > * + * { margin-top: var(--space-4); }

/* ---------- Type ---------- */
.display { font-size: var(--text-3xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); font-weight: var(--weight-semibold); text-wrap: balance; }
.h2 { font-size: var(--text-2xl); line-height: 1.15; letter-spacing: var(--tracking-tight); font-weight: var(--weight-semibold); text-wrap: balance; }
.h3 { font-size: var(--text-lg); line-height: var(--leading-snug); letter-spacing: -0.01em; font-weight: var(--weight-semibold); }
.lead { font-size: var(--text-lg); line-height: 1.55; color: var(--color-text-muted); text-wrap: pretty; max-width: 36em; }
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--color-action);
}
.eyebrow::before { content: ""; width: 1.25rem; height: 2px; border-radius: 2px; background: var(--color-highlight); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 3rem; padding: 0 var(--space-5);
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font-size: var(--text-base); font-weight: var(--weight-semibold); text-decoration: none; letter-spacing: -0.005em;
  cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 1.125rem; height: 1.125rem; transition: transform var(--duration-base) var(--ease-out); }
.btn:hover svg { transform: translateX(2px); }
.btn--primary { background: var(--color-action); color: var(--color-action-text); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-action-hover); }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--color-border-strong); }
.btn--ghost:hover { background: var(--color-surface-sunken); }
.btn--lg { min-height: 3.5rem; padding: 0 var(--space-6); font-size: var(--text-lg); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Buttons on dark surfaces */
.on-dark .btn--primary { background: var(--color-dark-action); color: var(--color-dark-action-text); }
.on-dark .btn--primary:hover { background: var(--fp-jade-300); }
.on-dark .btn--ghost { color: var(--color-dark-text); border-color: var(--color-dark-border); }
.on-dark .btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }

/* ---------- Site header ---------- */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; background: rgba(11, 27, 51, 0.88);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--color-dark-border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 4.25rem; }
.site-nav { display: flex; align-items: center; gap: var(--space-5); }
.site-nav a:not(.btn) { color: var(--color-dark-text-muted); text-decoration: none; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.site-nav a:not(.btn):hover { color: var(--color-dark-text); }
.site-nav .btn { min-height: 2.5rem; padding: 0 var(--space-4); font-size: var(--text-sm); }
@media (max-width: 40rem) { .site-nav a:not(.btn) { display: none; } }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.625rem; text-decoration: none; color: var(--color-text); }
.logo__mark { width: 2.25rem; height: 2.25rem; flex: none; }
.logo__word { font-size: 1.1875rem; font-weight: var(--weight-semibold); letter-spacing: -0.03em; line-height: 1; }
.logo__word span { color: var(--color-action); }
.on-dark .logo { color: var(--color-dark-text); }
.on-dark .logo__word span { color: var(--fp-jade-300); }

/* ---------- Dark (ink) band ---------- */
.on-dark { background: var(--color-dark-bg); color: var(--color-dark-text); }
.on-dark .lead, .on-dark .muted { color: var(--color-dark-text-muted); }
.on-dark .eyebrow { color: var(--fp-jade-300); }
/* Aeronautical-chart grid texture */
.chart-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(3.5rem, 2rem + 6vw, 7rem) clamp(4rem, 2rem + 7vw, 8rem); }
.hero::after { /* fade the grid into the ink at the edges */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 70% 30%, transparent 40%, var(--color-dark-bg) 85%);
}
.hero__inner { position: relative; z-index: 1; display: grid; gap: var(--space-7); align-items: center; }
@media (min-width: 60rem) { .hero__inner { grid-template-columns: 1.05fr 1fr; } }
.hero__copy > * + * { margin-top: var(--space-5); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); padding-top: var(--space-2); }
.hero__art { width: 100%; max-width: 34rem; justify-self: center; }
/* On phones the CTA matters more than the illustration; its labels would also be too small to read */
@media (max-width: 40rem) { .hero__art { display: none; } }
.assurances { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding-top: var(--space-2); }
.assurances li { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-dark-text-muted); }
.assurances svg { width: 1.125rem; height: 1.125rem; color: var(--fp-jade-300); flex: none; }

/* ---------- Section headings ---------- */
.section-head { max-width: 40rem; margin-bottom: var(--space-7); }
.section-head > * + * { margin-top: var(--space-3); }

/* ---------- Steps ---------- */
.steps { display: grid; gap: var(--space-5); counter-reset: step; }
@media (min-width: 52rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding: var(--space-6); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.step__num { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-eyebrow); color: var(--color-text-subtle); }
.step__icon { width: 3rem; height: 3rem; margin-block: var(--space-4); color: var(--color-action); }
.step p { margin-top: var(--space-2); color: var(--color-text-muted); }

/* ---------- Product grid ---------- */
.products { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.products > li { display: flex; }
.products .product { flex: 1; }
.product { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-5); border-radius: var(--radius-md);
  background: var(--color-surface); border: 1px solid var(--color-border); transition: border-color var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out); }
.product:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
.product__icon { flex: none; width: 2.75rem; height: 2.75rem; padding: 0.625rem; border-radius: var(--radius-sm); background: var(--color-action-soft); color: var(--color-action); }
.product h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.product p { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.product--cta { text-decoration: none; color: inherit; border-style: dashed; border-color: var(--color-border-strong); background: var(--color-bg); }
.product--cta:hover { border-style: solid; border-color: var(--color-action); }
.product--cta .product__icon { background: var(--fp-beacon-100); color: var(--fp-ink-900); }
.product__more { display: inline-flex; align-items: center; gap: var(--space-1); margin-top: var(--space-2); color: var(--color-action); font-weight: var(--weight-semibold); }
.product__more svg { width: 1rem; height: 1rem; transition: transform var(--duration-base) var(--ease-out); }
.product--cta:hover .product__more svg { transform: translateX(2px); }

/* ---------- Transparency panel ---------- */
.panel { display: grid; gap: var(--space-6); padding: clamp(1.5rem, 1rem + 3vw, 3.5rem); border-radius: var(--radius-lg);
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
@media (min-width: 52rem) { .panel { grid-template-columns: 1fr 1.2fr; align-items: start; } }
.checklist { display: grid; gap: var(--space-4); }
.checklist li { display: grid; grid-template-columns: 1.5rem 1fr; gap: var(--space-3); }
.checklist svg { width: 1.5rem; height: 1.5rem; color: var(--color-action); margin-top: 0.1em; }
.checklist strong { display: block; font-weight: var(--weight-semibold); }
.checklist span { color: var(--color-text-muted); font-size: var(--text-sm); }

/* ---------- CTA band ---------- */
.cta-band { border-radius: var(--radius-lg); padding: clamp(2rem, 1rem + 4vw, 4rem); display: grid; gap: var(--space-5); align-items: center; position: relative; overflow: hidden; }
@media (min-width: 52rem) { .cta-band { grid-template-columns: 1fr auto; } }
.cta-band > * { position: relative; }

/* ---------- Footer ---------- */
.site-footer { padding-block: var(--space-8) var(--space-7); border-top: 1px solid var(--color-border); background: var(--color-surface); }
.site-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-5); align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.footer-links a { color: var(--color-text-muted); text-decoration: none; font-size: var(--text-sm); }
.footer-links a:hover { color: var(--color-text); text-decoration: underline; }
.legal { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--color-border); font-size: var(--text-xs); color: var(--color-text-subtle); line-height: 1.6; }
.legal p + p { margin-top: var(--space-2); }

/* ---------- Forms ---------- */
.form-shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-bg); }
.form-top { border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.form-top__inner { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; gap: var(--space-4); }
.progress { height: 4px; background: var(--color-surface-sunken); }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--color-action), var(--fp-jade-500)); border-radius: 0 4px 4px 0; transition: width var(--duration-base) var(--ease-out); }
.form-main { flex: 1; padding-block: clamp(2rem, 1rem + 5vw, 4.5rem); }
.form-card > * + * { margin-top: var(--space-5); }
.step-label { font-size: var(--text-sm); color: var(--color-text-subtle); font-weight: var(--weight-medium); }
.question { font-size: var(--text-2xl); line-height: 1.15; letter-spacing: var(--tracking-tight); font-weight: var(--weight-semibold); text-wrap: balance; }

.field { display: grid; gap: var(--space-2); }
.field label, .field legend { font-weight: var(--weight-medium); font-size: var(--text-sm); }
.field__hint { font-size: var(--text-sm); color: var(--color-text-subtle); }
.input {
  width: 100%; min-height: 3.25rem; padding: 0 var(--space-4); border-radius: var(--radius-md);
  background: var(--color-surface); border: 1.5px solid var(--color-border-strong); font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.input:hover { border-color: var(--fp-slate-400); }
.input:focus { outline: none; border-color: var(--color-action); box-shadow: 0 0 0 4px var(--color-action-soft); }
.input[aria-invalid="true"] { border-color: var(--color-error); box-shadow: 0 0 0 4px var(--color-error-soft); }
.field__error { font-size: var(--text-sm); color: var(--color-error); font-weight: var(--weight-medium); }

/* Large tappable option cards (radio/checkbox) */
.options { display: grid; gap: var(--space-3); border: 0; padding: 0; margin-inline: 0; margin-bottom: 0; min-width: 0; }
@media (min-width: 36rem) { .options--2col { grid-template-columns: 1fr 1fr; } }
.option { position: relative; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5);
  min-height: 4rem; border-radius: var(--radius-md); border: 1.5px solid var(--color-border-strong); background: var(--color-surface);
  cursor: pointer; font-weight: var(--weight-medium); transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.option:hover { border-color: var(--fp-slate-400); box-shadow: var(--shadow-sm); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option__icon { width: 1.75rem; height: 1.75rem; flex: none; color: var(--color-text-muted); }
.option__tick { margin-left: auto; width: 1.375rem; height: 1.375rem; flex: none; border-radius: 50%; border: 1.5px solid var(--color-border-strong);
  display: grid; place-items: center; transition: background-color var(--duration-fast), border-color var(--duration-fast); }
.option__tick svg { width: 0.875rem; height: 0.875rem; color: var(--fp-white); opacity: 0; }
.option:has(input:checked) { border-color: var(--color-action); background: color-mix(in srgb, var(--color-action-soft) 55%, var(--color-surface)); }
.option:has(input:checked) .option__icon { color: var(--color-action); }
.option:has(input:checked) .option__tick { background: var(--color-action); border-color: var(--color-action); }
.option:has(input:checked) .option__tick svg { opacity: 1; }
.option:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* Dropdown: native <select> (best on mobile) with a custom chevron */
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 3rem; font-size: var(--text-lg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5873' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; background-size: 1.25rem; }
.select:invalid, .select:has(option[value=""]:checked) { color: var(--color-text-subtle); }
.select option { color: var(--color-text); }

/* Consent checkbox */
.consent { display: grid; grid-template-columns: 1.375rem 1fr; gap: var(--space-3); align-items: start; font-weight: var(--weight-regular) !important;
  font-size: var(--text-sm); line-height: 1.5; color: var(--color-text-muted); cursor: pointer; }
.consent input { width: 1.375rem; height: 1.375rem; margin: 0.05em 0 0; accent-color: var(--color-action); cursor: pointer; }
.consent a { color: var(--color-action); }

/* Honeypot: invisible to people, tempting to bots */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); }
.secure-note { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-subtle); }
.secure-note svg { width: 1rem; height: 1rem; }

/* ---------- Prose (privacy policy etc.) ---------- */
.prose { max-width: 44rem; }
.prose h1 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); line-height: 1.15; font-weight: var(--weight-semibold); }
.prose h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin-top: var(--space-7); letter-spacing: -0.01em; }
.prose h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); margin-top: var(--space-5); }
.prose p, .prose ul, .prose table { margin-top: var(--space-3); }
.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: var(--space-1); }
.prose a { color: var(--color-action); }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.prose th, .prose td { text-align: left; vertical-align: top; padding: var(--space-3); border-bottom: 1px solid var(--color-border); }
.prose th { font-weight: var(--weight-semibold); background: var(--color-surface-sunken); }
.table-scroll { overflow-x: auto; }
.placeholder { background: var(--fp-beacon-100); border-radius: 4px; padding: 0 0.25em; font-weight: var(--weight-medium); }
.notice { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--fp-beacon-100); border: 1px solid #f1d49b; font-size: var(--text-sm); }
.notice--error { background: var(--color-error-soft); border-color: #f2c4ba; color: var(--fp-red-600); }
