/* ==========================================================================
   Roof IQ — Design Tokens
   ========================================================================== */

:root {
  /* Dark navy palette */
  --navy-950: #05070f;
  --navy-900: #080c1f;
  --navy-850: #0a0f2a;
  --navy-800: #0d1436;
  --navy-700: #131b4a;
  --navy-600: #1b2560;

  /* Electric blue accents */
  --blue-400: #6fe3ff;
  --blue-500: #2fd0ff;
  --blue-600: #00b4ff;
  --blue-700: #2f6bff;

  /* Text */
  --text-primary: #f4f7ff;
  --text-secondary: #aab4d6;
  --text-muted: #6b76a3;

  /* Effects */
  --glow: 0 0 24px rgba(47, 208, 255, 0.35);
  --border-soft: rgba(111, 227, 255, 0.14);

  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--navy-950);
  color: var(--text-primary);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Password Gate
   ========================================================================== */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-950);
  padding: 24px;
  overflow: hidden;
}

.auth-gate-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.auth-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 30% 20%, rgba(47, 107, 255, 0.3), transparent 45%),
    radial-gradient(circle at 75% 80%, rgba(47, 208, 255, 0.22), transparent 50%),
    rgba(5, 7, 15, 0.6);
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(10, 15, 42, 0.55), rgba(13, 20, 54, 0.55));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.auth-logo span {
  color: var(--blue-500);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#customer-auth-form,
#forgot-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#username-input,
#password-input,
#customer-username-input,
#customer-password-input,
#forgot-email-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#username-input:focus,
#password-input:focus,
#customer-username-input:focus,
#customer-password-input:focus,
#forgot-email-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47, 208, 255, 0.15);
}

.auth-error {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #ff6b7a;
}

.auth-success {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--blue-400);
}

.auth-help {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-link-btn {
  display: block;
  margin: 12px auto 0;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--blue-400);
  cursor: pointer;
}

.auth-link-btn:hover {
  color: var(--blue-500);
  text-decoration: underline;
}

/* Tabs: which login form is showing — customer is the default so a
   visitor to the shared domain lands on their sign-in, not staff's. */
.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

/* An explicit `display` above would otherwise beat the browser's default
   `[hidden] { display: none }` — same origin/specificity, author rule
   wins the tie — so `.auth-tabs.hidden = true` would render anyway. */
.auth-tabs[hidden] {
  display: none;
}

.auth-tab {
  flex: 1;
  padding: 9px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab.is-active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #04101f;
  box-shadow: var(--glow);
}

.auth-panel h1.auth-title {
  margin-top: 0;
}

/* Both companies' contact info, shown under either login panel so a
   visitor from either brand recognizes the page as theirs. */
.auth-companies {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-company {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  text-decoration: none;
  padding: 4px 0;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.auth-company:hover {
  background: rgba(255, 255, 255, 0.03);
}

.auth-company:hover strong {
  color: var(--blue-400);
}

.auth-company img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-company strong {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-primary);
  transition: color 0.15s ease;
}

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

.btn-primary,
.btn-secondary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 10px;
  padding: 13px 26px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: var(--navy-950);
  color: #04101f;
  box-shadow: var(--glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(47, 208, 255, 0.5);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.btn-secondary:hover {
  border-color: var(--blue-500);
  color: var(--blue-400);
}

/* ==========================================================================
   App shell / animated background
   ========================================================================== */

.app {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--navy-950);
  overflow: hidden;
}

.gradient-bg::before,
.gradient-bg::after {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}

.gradient-bg::before {
  background: radial-gradient(circle, var(--blue-700), transparent 70%);
  top: -20%;
  left: -10%;
  animation: drift-a 22s ease-in-out infinite alternate;
}

.gradient-bg::after {
  background: radial-gradient(circle, var(--blue-500), transparent 70%);
  bottom: -25%;
  right: -10%;
  animation: drift-b 26s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(8%, 6%) scale(1.15); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6%, -8%) scale(1.1); }
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Two-tier grid — a finer mesh plus a bolder major line every 4 cells —
     for a blueprint/graph-paper feel rather than a flat, even mesh. */
  background-image:
    linear-gradient(rgba(111, 227, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 227, 255, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(111, 227, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 227, 255, 0.04) 1px, transparent 1px);
  background-size: 192px 192px, 192px 192px, 48px 48px, 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 80%);
}

/* ---- Roof blueprint --------------------------------------------------- */
/* A top-down schematic of a rooftop (outline, parapet, HVAC units, drains,
   an access hatch, membrane seams) — thin glowing line-art, not a photo,
   so it reads as "a moving blueprint" rather than a picture competing
   with the UI. Sits behind the particle network and grid. */

.roof-blueprint {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  transition: opacity 0.4s ease;
}

.roof-line {
  fill: none;
  stroke: rgba(111, 227, 255, 0.3);
  stroke-width: 2;
}

.roof-line--inner {
  stroke: rgba(111, 227, 255, 0.14);
  stroke-width: 1;
}

.roof-equip rect,
.roof-equip circle {
  fill: rgba(111, 227, 255, 0.03);
  stroke: rgba(111, 227, 255, 0.22);
  stroke-width: 1.25;
}

.roof-equip line {
  stroke: rgba(111, 227, 255, 0.18);
  stroke-width: 1;
}

.roof-seam {
  stroke: rgba(111, 227, 255, 0.12);
  stroke-width: 1;
  stroke-dasharray: 6 6;
}

/* "Found something" — a soft bloom that briefly lights up a point on the
   roof (an HVAC unit, a drain…), one at a time, then fades. Purely
   decorative, not tied to a project's real findings. */
.roof-ping {
  fill: var(--blue-500);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: roof-ping-anim 12s ease-out infinite;
  will-change: opacity, transform;
}

@keyframes roof-ping-anim {
  0% { opacity: 0; transform: scale(1); }
  2% { opacity: 0.9; transform: scale(1); }
  8% { opacity: 0.45; transform: scale(3.5); }
  16% { opacity: 0; transform: scale(5); }
  100% { opacity: 0; transform: scale(5); }
}

/* Toned down while actively building a report — present as texture, not
   competing for attention. The pings themselves are paused outright:
   typing responsiveness matters more here than the effect, and a paused
   animation costs nothing on the main thread. */
body.is-app-view .roof-blueprint {
  opacity: 0.4;
}

body.is-app-view .roof-ping {
  animation-play-state: paused;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .roof-ping {
    animation: none;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 24px 80px;
}

.hero-inner {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-400);
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(47, 208, 255, 0.25);
}

.hero-title .accent {
  color: var(--blue-500);
  background: linear-gradient(135deg, var(--blue-400), var(--blue-700));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--text-primary);
  margin-top: 18px;
}

.hero-tagline {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 18px auto 0;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 36px;
}

/* Steps */

.hero-steps {
  list-style: none;
  margin-top: 88px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  text-align: left;
}

.step {
  background: rgba(19, 27, 74, 0.35);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 22px 20px;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.step:hover {
  border-color: var(--blue-500);
  transform: translateY(-3px);
}

.step-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--blue-500);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.step-copy h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.step-copy p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .hero-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 100px 18px 60px;
  }

  .hero-steps {
    grid-template-columns: 1fr;
    margin-top: 56px;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}
