/* ==========================================================================
   FlyEstimate — Design System
   Instant per-parcel property estimates for contractors (roofing, lawn,
   siding, gutters, solar, etc). Aerial-survey/data visual register:
   restrained SaaS baseline (white, near-black ink, one blue accent) evolved
   with a second "aerial scan" cyan and an energetic price-tag coral for
   CTAs/pricing, plus motion (scan-line sweep, pulse, count-up) that reads
   as measurement/telemetry rather than decoration.

   No external fonts, no external requests. System font stack only.
   ========================================================================== */

:root {
  /* ---- Core brand ---------------------------------------------------- */
  --fe-ink:            #172b4d;   /* near-black ink — body text, headings */
  --fe-ink-soft:        #42526e;  /* secondary text */
  --fe-ink-faint:        #6b7c93; /* tertiary / placeholder text */

  --fe-accent:          #0052cc;  /* primary blue — brand, links, primary actions */
  --fe-accent-dark:      #003d99; /* hover/active state for primary blue */
  --fe-accent-darker:     #002766;
  --fe-accent-light:     #4c9aff; /* lighter blue for icons on dark surfaces */
  --fe-accent-tint:      #e9f2ff; /* pale blue surface (selected rows, chips) */
  --fe-accent-tint-2:     #deebff;

  /* Aerial scan cyan — the "survey/telemetry" accent: scan-lines, measurement
     dots, in-progress states, map/imagery chrome. Distinct from the primary
     blue so the two never compete for the same job. */
  --fe-scan:            #00b8d9;
  --fe-scan-dark:        #00a3c4;
  --fe-scan-tint:        #e6fcff;

  /* Energetic price/CTA coral — used ONLY for price tags, "Buy now" style
     conversion moments, and the odd sparing highlight. Never for chrome. */
  --fe-price:           #ff5630;
  --fe-price-dark:       #de350b;
  --fe-price-tint:       #ffece6;

  --fe-success:         #00875a;
  --fe-success-tint:     #e3fcef;
  --fe-warning:         #ff991f;
  --fe-warning-tint:     #fffae6;
  --fe-danger:          #de350b;
  --fe-danger-tint:      #ffebe6;

  /* ---- Surfaces / borders --------------------------------------------- */
  --fe-bg:              #ffffff;
  --fe-bg-subtle:        #f7f8fa;
  --fe-bg-muted:         #f4f5f7;
  --fe-surface:          #ffffff;
  --fe-border:           #dfe1e6;
  --fe-border-strong:     #c1c7d0;
  --fe-border-light:      #ebecf0;

  /* Dark-friendly variants — for hero / imagery panels that go near-black
     to sell the "satellite view at night" aerial mood. Any component that
     sits on --fe-bg-dark should read these instead of the light-surface set. */
  --fe-bg-dark:          #0b1626;
  --fe-bg-dark-raised:    #132038;
  --fe-border-dark:       #24344f;
  --fe-ink-on-dark:       #f4f7ff;
  --fe-ink-on-dark-soft:   #aab8d1;
  --fe-accent-on-dark:    #4c9aff;
  --fe-scan-on-dark:      #4de3ff;
  --fe-price-on-dark:     #ff8f73;

  /* ---- Type scale ------------------------------------------------------ */
  --fe-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fe-font-mono: ui-monospace, "SFMono-Regular", "Consolas", "Liberation Mono", monospace;

  --fe-text-xs:    12px;
  --fe-text-sm:    14px;
  --fe-text-base:  16px;
  --fe-text-md:    18px;
  --fe-text-lg:    20px;
  --fe-text-xl:    24px;
  --fe-text-2xl:   32px;
  --fe-text-3xl:   40px;
  --fe-text-display: 56px;

  --fe-leading-tight: 1.2;
  --fe-leading-base:  1.5;
  --fe-leading-loose: 1.7;

  --fe-weight-regular: 400;
  --fe-weight-medium:  500;
  --fe-weight-semibold: 600;
  --fe-weight-bold:    700;
  --fe-weight-black:   800;

  /* ---- Spacing scale (4px base) ---------------------------------------- */
  --fe-space-1:  4px;
  --fe-space-2:  8px;
  --fe-space-3:  12px;
  --fe-space-4:  16px;
  --fe-space-5:  20px;
  --fe-space-6:  24px;
  --fe-space-8:  32px;
  --fe-space-10: 40px;
  --fe-space-12: 48px;
  --fe-space-16: 64px;
  --fe-space-20: 80px;
  --fe-space-24: 96px;

  /* ---- Radii ------------------------------------------------------------ */
  --fe-radius-sm:  4px;
  --fe-radius-md:  8px;
  --fe-radius-lg:  14px;
  --fe-radius-xl:  20px;
  --fe-radius-full: 999px;

  /* ---- Shadows / borders (flat, no glow — one soft elevation family) ---- */
  --fe-shadow-sm: 0 1px 2px rgba(23, 43, 77, 0.08);
  --fe-shadow-md: 0 4px 12px rgba(23, 43, 77, 0.10);
  --fe-shadow-lg: 0 12px 32px rgba(23, 43, 77, 0.14);
  --fe-shadow-focus: 0 0 0 3px var(--fe-accent-tint-2);
  --fe-shadow-focus-scan: 0 0 0 3px var(--fe-scan-tint);

  /* ---- Motion ------------------------------------------------------------ */
  --fe-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --fe-duration-fast: 150ms;
  --fe-duration-base: 250ms;
  --fe-duration-slow: 2400ms;
}

/* ==========================================================================
   Reset / base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--fe-bg);
  color: var(--fe-ink);
  font-family: var(--fe-font);
  font-size: var(--fe-text-base);
  line-height: var(--fe-leading-base);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--fe-space-3);
  font-weight: var(--fe-weight-bold);
  line-height: var(--fe-leading-tight);
  color: var(--fe-ink);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fe-text-3xl); font-weight: var(--fe-weight-black); letter-spacing: -0.02em; }
h2 { font-size: var(--fe-text-2xl); }
h3 { font-size: var(--fe-text-xl); }
h4 { font-size: var(--fe-text-lg); }
h5 { font-size: var(--fe-text-md); }
h6 { font-size: var(--fe-text-base); text-transform: uppercase; letter-spacing: 0.04em; color: var(--fe-ink-soft); }

p {
  margin: 0 0 var(--fe-space-4);
  color: var(--fe-ink-soft);
}

small, .fe-text-sm { font-size: var(--fe-text-sm); }
.fe-text-xs { font-size: var(--fe-text-xs); }
.fe-text-muted { color: var(--fe-ink-faint); }

a {
  color: var(--fe-accent);
  text-decoration: none;
}
a:hover { color: var(--fe-accent-dark); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--fe-accent); outline-offset: 2px; border-radius: var(--fe-radius-sm); }

::selection { background: var(--fe-accent-tint-2); color: var(--fe-ink); }

hr {
  border: none;
  border-top: 1px solid var(--fe-border);
  margin: var(--fe-space-6) 0;
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.fe-container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--fe-space-4);
}

@media (min-width: 768px) {
  .fe-container { padding-inline: var(--fe-space-6); }
}

.fe-section { padding-block: var(--fe-space-12); }

.fe-grid {
  display: grid;
  gap: var(--fe-space-5);
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .fe-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .fe-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fe-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.fe-stack { display: flex; flex-direction: column; }
.fe-row { display: flex; flex-wrap: wrap; align-items: center; }
.fe-gap-1 { gap: var(--fe-space-1); }
.fe-gap-2 { gap: var(--fe-space-2); }
.fe-gap-3 { gap: var(--fe-space-3); }
.fe-gap-4 { gap: var(--fe-space-4); }

.fe-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;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: var(--fe-space-2);
  gap: var(--fe-space-4);
  padding: var(--fe-space-3) var(--fe-space-4);
  background: var(--fe-bg);
  border-bottom: 1px solid var(--fe-border);
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (min-width: 768px) {
  .navbar { padding: var(--fe-space-4) var(--fe-space-6); }
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--fe-space-2);
  font-weight: var(--fe-weight-black);
  font-size: var(--fe-text-lg);
  color: var(--fe-ink);
}
.navbar-brand img, .navbar-brand svg { height: 28px; width: auto; display: block; }

.navbar-links {
  display: none;
  align-items: center;
  gap: var(--fe-space-6);
  list-style: none;
  margin: 0; padding: 0;
}
@media (min-width: 768px) {
  .navbar-links { display: flex; }
}

.navbar-link {
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-medium);
  color: var(--fe-ink-soft);
}
.navbar-link:hover { color: var(--fe-accent); text-decoration: none; }
.navbar-link.is-active { color: var(--fe-ink); }

.navbar-actions { display: flex; align-items: center; gap: var(--fe-space-3); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-fg: var(--fe-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fe-space-2);
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--fe-radius-md);
  padding: var(--fe-space-3) var(--fe-space-5);
  font-family: var(--fe-font);
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--fe-duration-fast) var(--fe-ease),
              border-color var(--fe-duration-fast) var(--fe-ease),
              color var(--fe-duration-fast) var(--fe-ease),
              transform var(--fe-duration-fast) var(--fe-ease),
              box-shadow var(--fe-duration-fast) var(--fe-ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--fe-shadow-focus); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--fe-accent);
  border-color: var(--fe-accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--fe-accent-dark); border-color: var(--fe-accent-dark); color: #fff; text-decoration: none; }

.btn-secondary {
  background: var(--fe-bg);
  border-color: var(--fe-border-strong);
  color: var(--fe-ink);
}
.btn-secondary:hover { background: var(--fe-bg-subtle); border-color: var(--fe-ink-faint); text-decoration: none; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fe-accent);
}
.btn-ghost:hover { background: var(--fe-accent-tint); text-decoration: none; }

/* Reserved for real conversion moments: buy-now / checkout — never chrome. */
.btn-buy {
  background: var(--fe-price);
  border-color: var(--fe-price);
  color: #ffffff;
}
.btn-buy:hover { background: var(--fe-price-dark); border-color: var(--fe-price-dark); color: #fff; text-decoration: none; }

.btn-sm { padding: var(--fe-space-2) var(--fe-space-3); font-size: var(--fe-text-xs); border-radius: var(--fe-radius-sm); }
.btn-lg { padding: var(--fe-space-4) var(--fe-space-6); font-size: var(--fe-text-base); }
.btn-block { display: flex; width: 100%; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: var(--fe-space-4); }

.form-label {
  display: block;
  margin-bottom: var(--fe-space-2);
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-semibold);
  color: var(--fe-ink);
}

.form-hint {
  margin-top: var(--fe-space-2);
  font-size: var(--fe-text-xs);
  color: var(--fe-ink-faint);
}

.form-error {
  margin-top: var(--fe-space-2);
  font-size: var(--fe-text-xs);
  color: var(--fe-danger);
  font-weight: var(--fe-weight-medium);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  appearance: none;
  background: var(--fe-bg);
  border: 1px solid var(--fe-border-strong);
  border-radius: var(--fe-radius-md);
  padding: var(--fe-space-3) var(--fe-space-4);
  font-family: var(--fe-font);
  font-size: var(--fe-text-base);
  color: var(--fe-ink);
  line-height: 1.4;
  transition: border-color var(--fe-duration-fast) var(--fe-ease), box-shadow var(--fe-duration-fast) var(--fe-ease);
}
.form-textarea { resize: vertical; min-height: 96px; }

.form-input::placeholder,
.form-textarea::placeholder { color: var(--fe-ink-faint); }

.form-input:hover,
.form-select:hover,
.form-textarea:hover { border-color: var(--fe-ink-faint); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--fe-accent);
  box-shadow: var(--fe-shadow-focus);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--fe-danger);
}
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px var(--fe-danger-tint); }

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--fe-bg-muted);
  color: var(--fe-ink-faint);
  cursor: not-allowed;
}

/* An address/search field gets the scan-cyan focus ring instead of accent —
   ties the "type an address" moment to the survey motif used everywhere else. */
.form-input--address:focus {
  border-color: var(--fe-scan);
  box-shadow: var(--fe-shadow-focus-scan);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: var(--fe-radius-lg);
  box-shadow: var(--fe-shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: var(--fe-space-5);
  border-bottom: 1px solid var(--fe-border);
}

.card-body { padding: var(--fe-space-5); }

.card-footer {
  padding: var(--fe-space-5);
  border-top: 1px solid var(--fe-border);
  background: var(--fe-bg-subtle);
}

.card--interactive {
  cursor: pointer;
  transition: transform var(--fe-duration-base) var(--fe-ease), box-shadow var(--fe-duration-base) var(--fe-ease), border-color var(--fe-duration-base) var(--fe-ease);
}
.card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--fe-shadow-md);
  border-color: var(--fe-border-strong);
}

/* A pricing/estimate card — accent bar on top marks it as a buyable item. */
.card--price {
  border-top: 3px solid var(--fe-accent);
}
.card--price.card--featured {
  border-top-color: var(--fe-price);
  box-shadow: var(--fe-shadow-md);
}

/* ==========================================================================
   Table
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fe-text-sm);
}

th {
  text-align: left;
  padding: var(--fe-space-3) var(--fe-space-4);
  font-weight: var(--fe-weight-semibold);
  color: var(--fe-ink-soft);
  font-size: var(--fe-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--fe-border);
  white-space: nowrap;
}

td {
  padding: var(--fe-space-3) var(--fe-space-4);
  border-bottom: 1px solid var(--fe-border-light);
  color: var(--fe-ink);
}

tbody tr:hover { background: var(--fe-bg-subtle); }
tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   Badges / pills
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--fe-space-1);
  padding: 2px var(--fe-space-2);
  border-radius: var(--fe-radius-sm);
  font-size: var(--fe-text-xs);
  font-weight: var(--fe-weight-semibold);
  line-height: 1.6;
  background: var(--fe-bg-muted);
  color: var(--fe-ink-soft);
  white-space: nowrap;
}
.badge-accent  { background: var(--fe-accent-tint); color: var(--fe-accent-dark); }
.badge-scan    { background: var(--fe-scan-tint); color: var(--fe-scan-dark); }
.badge-success { background: var(--fe-success-tint); color: var(--fe-success); }
.badge-warning { background: var(--fe-warning-tint); color: #974f00; }
.badge-danger  { background: var(--fe-danger-tint); color: var(--fe-danger); }
.badge-price   { background: var(--fe-price-tint); color: var(--fe-price-dark); }
.badge-new     { background: var(--fe-ink); color: #fff; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--fe-space-2);
  padding: var(--fe-space-1) var(--fe-space-4);
  border-radius: var(--fe-radius-full);
  border: 1px solid var(--fe-border);
  background: var(--fe-bg);
  font-size: var(--fe-text-sm);
  font-weight: var(--fe-weight-medium);
  color: var(--fe-ink-soft);
  cursor: pointer;
  transition: border-color var(--fe-duration-fast) var(--fe-ease), color var(--fe-duration-fast) var(--fe-ease), background var(--fe-duration-fast) var(--fe-ease);
}
.pill:hover { border-color: var(--fe-accent); color: var(--fe-accent); }
.pill.is-active { background: var(--fe-accent); border-color: var(--fe-accent); color: #fff; }

/* Price tag chip — the one place the coral accent shows up as text/bg */
.price-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-weight: var(--fe-weight-black);
  color: var(--fe-price-dark);
}
.price-tag small { font-size: var(--fe-text-sm); font-weight: var(--fe-weight-semibold); color: var(--fe-ink-faint); }

/* ==========================================================================
   Dark / imagery panel (hero, roof-model viewer chrome)
   ========================================================================== */

.panel-dark {
  background: var(--fe-bg-dark);
  color: var(--fe-ink-on-dark);
  border: 1px solid var(--fe-border-dark);
  border-radius: var(--fe-radius-lg);
}
.panel-dark p { color: var(--fe-ink-on-dark-soft); }
.panel-dark a { color: var(--fe-accent-on-dark); }
.panel-dark .badge { background: var(--fe-bg-dark-raised); color: var(--fe-ink-on-dark-soft); }
.panel-dark .badge-scan { background: rgba(0, 184, 217, 0.16); color: var(--fe-scan-on-dark); }

/* ==========================================================================
   Motion — reusable @keyframes for measurement/telemetry UI
   Other pages hook these up via the .fe-scan-sweep / .fe-pulse / .fe-count-up
   utility classes (or reference the keyframe names directly).
   ========================================================================== */

/* 1) Scan-line sweep — a horizontal beam that travels down an imagery panel
      (e.g. over a roof model) to read as "actively measuring". Apply to an
      absolutely-positioned ::before/child element that spans the panel. */
@keyframes fe-scan-sweep {
  0%   { transform: translateY(-10%); opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { transform: translateY(110%); opacity: 0; }
}

.fe-scan-sweep {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--fe-scan) 20%, var(--fe-scan-on-dark) 50%, var(--fe-scan) 80%, transparent);
  box-shadow: 0 0 12px 1px var(--fe-scan);
  animation: fe-scan-sweep var(--fe-duration-slow) var(--fe-ease) infinite;
  pointer-events: none;
}

/* 2) Pulse — for measurement/data-point dots overlaid on a roof or map model,
      and for small "live" status indicators. */
@keyframes fe-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 184, 217, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(0, 184, 217, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 184, 217, 0); }
}

.fe-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fe-scan);
  animation: fe-pulse 2s var(--fe-ease) infinite;
}
.fe-pulse-dot--accent { background: var(--fe-accent); animation-name: fe-pulse; }

/* 3) Count-up reveal — for price/accuracy/score numbers landing on screen.
      Pair with a JS requestAnimationFrame tween of the digits; this class
      just handles the entrance so the number doesn't just "pop". */
@keyframes fe-count-up-reveal {
  0%   { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  60%  { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0); }
}

.fe-count-up {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  animation: fe-count-up-reveal var(--fe-duration-base) var(--fe-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .fe-scan-sweep,
  .fe-pulse-dot,
  .fe-count-up {
    animation: none !important;
  }
}
