/* ─────────────────────────────────────────────────────────────────────
   LIFX VISUALIZER — Components
   Tokens, fonts, and type recipes live in colors_and_type.css.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Short aliases used throughout component styles. */
  --font-ui: var(--font-body);
  --polychrome: var(--polychrome-spectrum);
}

/* ──── BASE ──── */

* { box-sizing: border-box; }

html, body {
  background: var(--surface-night);
  color: var(--ink-100);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "calt";
}

body { min-height: 100dvh; position: relative; margin: 0; padding: 0; }

a { color: inherit; text-decoration: none; }

::selection {
  background: var(--voltage);
  color: var(--surface-night);
}

.hidden { display: none !important; }

/* ──── SPEC RULE — Polychrome brand line ──── */

.spec-rule {
  position: relative;
  height: 2px;
  width: 100%;
  background: var(--polychrome);
  z-index: 5;
}
.spec-rule::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  height: 32px;
  background: var(--polychrome);
  filter: blur(14px);
  opacity: 0.30;
  pointer-events: none;
}

/* ──── TYPOGRAPHY ──── */

.font-display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.96;
}
.font-display-italic {
  /* Syne has no italic — kept as alias on highlight-toned period/accent */
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--voltage);
}
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--highlight);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.stepper-step          { color: var(--ink-30); }
.stepper-step.is-done  { color: var(--ink-70); }
.stepper-step.is-current {
  color: var(--voltage);
}
.stepper-sep {
  color: var(--ink-30);
  font-size: 10px;
  line-height: 1;
}

.tag {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-50);
  font-feature-settings: "tnum", "kern";
}

/* ──── PAGE CHROME ──── */

.page-chrome {
  background: rgba(9, 9, 6, 0.70);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
  position: relative;
  z-index: 4;
}
.page-content { position: relative; z-index: 2; }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  color: var(--ink-100);
}

/* ──── BUTTONS ──── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-100);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  transition: background-color var(--dur-fast) var(--ease-lifx),
              border-color var(--dur-fast) var(--ease-lifx),
              color var(--dur-fast) var(--ease-lifx),
              transform var(--dur-fast) var(--ease-lifx),
              box-shadow var(--dur-fast) var(--ease-lifx);
}

.btn-primary {
  background: var(--voltage);
  color: var(--surface-night);
}
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    background: var(--voltage-hover);
    transform: translateY(-1px);
    box-shadow: 0 0 32px rgba(226, 252, 82, 0.45);
  }
}
.btn-primary:active:not(:disabled) {
  background: var(--voltage-active);
  transform: scale(0.97);
  box-shadow: 0 0 16px rgba(226, 252, 82, 0.30);
}
/* Suppress sticky focus styling after tap/click on mobile. Only show outline for keyboard
   navigation on hover-capable devices (where keyboard nav is realistic). */
.btn:focus { outline: none; }
@media (hover: hover) {
  .btn:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: 2px;
  }
}
.btn-primary:disabled,
.btn-primary[disabled] {
  background: var(--surface-shelf);
  color: var(--ink-30);
  border-color: var(--hairline);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  border-color: var(--ink-30);
  color: var(--ink-100);
}
@media (hover: hover) {
  .btn-ghost:hover:not(:disabled) {
    border-color: var(--highlight);
    color: var(--highlight);
    background: rgba(226, 255, 144, 0.06);
  }
}
.btn-ghost:active:not(:disabled),
.btn-ghost.is-pressed {
  transform: scale(0.97);
  border-color: var(--highlight);
  color: var(--highlight);
  background: rgba(226, 255, 144, 0.06);
}

.btn-link {
  padding: 4px 0;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-70);
  background: none;
  border: none;
  position: relative;
}
.btn-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--highlight);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--ease-lifx);
}
@media (hover: hover) {
  .btn-link:hover { color: var(--highlight); }
  .btn-link:hover::after { transform: scaleX(1); }
}

.btn-arrow { transition: transform var(--dur-fast) var(--ease-lifx); }
@media (hover: hover) {
  .btn:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }
}

.btn-sm { padding: 10px 18px; font-size: 11px; letter-spacing: 0.12em; }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: rgba(9,9,6,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  color: var(--ink-100);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--dur-fast) var(--ease-lifx), color var(--dur-fast) var(--ease-lifx);
}
.icon-btn:hover { border-color: var(--highlight); color: var(--highlight); }

/* ──── FORM ELEMENTS ──── */

.input {
  width: 100%;
  background: var(--surface-shelf);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  padding: 14px 22px;
  color: var(--ink-100);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--dur-fast) var(--ease-lifx),
              box-shadow var(--dur-fast) var(--ease-lifx);
}
.input::placeholder { color: var(--ink-30); }
.input:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(226, 255, 144, 0.20);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-shelf);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  padding: 11px 38px 11px 18px;
  color: var(--ink-100);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23FBFEF3' stroke-opacity='0.7' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-lifx),
              box-shadow var(--dur-fast) var(--ease-lifx);
}
.select:hover { border-color: var(--hairline-bright); }
.select:focus {
  outline: none;
  border-color: var(--highlight);
  box-shadow: 0 0 0 3px rgba(226, 255, 144, 0.20);
}

.error {
  font-size: 13px;
  color: var(--terracotta);
  text-align: left;
}

/* ──── AUTH SHELL (verify pages) ──── */

.auth-shell {
  max-width: 480px;
  margin: 64px auto;
  padding: 0 24px;
}
.auth-shell form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}
.auth-shell label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-50);
}
.auth-shell a {
  color: var(--highlight);
  text-decoration: none;
}
.auth-shell a:hover { text-decoration: underline; }

/* ──── CARD ──── */

.card {
  background: var(--surface-shelf);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-2xl);
  padding: 28px;
  position: relative;
  transition: border-color var(--dur-fast) var(--ease-lifx);
}
.card:hover { border-color: var(--hairline-strong); }

/* ──── STATUS STRIP / BADGE ──── */

.strip {
  background: var(--surface-shelf);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--highlight);
  box-shadow: 0 0 12px rgba(226, 255, 144, 0.7);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

/* ──── LOADING OVERLAY ──── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 6, 0.88);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: var(--ink-100);
}
.loading-overlay.hidden { display: none; }

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.loading-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 0.96;
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  color: var(--ink-100);
  margin: 0 0 12px;
}

.spinner {
  width: 240px;
  height: 1px;
  position: relative;
  overflow: hidden;
  background: var(--hairline-strong);
}
.spinner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--polychrome);
  animation: scan 1.6s var(--ease-lifx) infinite;
  filter: blur(0.5px);
}
@keyframes scan {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ──── ENTRANCE ──── */

.fade-up {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.7s var(--ease-lifx) forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.18s; }
.delay-3 { animation-delay: 0.28s; }
.delay-4 { animation-delay: 0.38s; }

/* ──── CANVAS / DRAW ──── */

canvas.cursor-crosshair { cursor: crosshair; }

.canvas-frame {
  position: relative;
  background: var(--surface-void);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.canvas-frame::before,
.canvas-frame::after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid var(--ink-30);
  pointer-events: none;
  z-index: 2;
}
.canvas-frame::before {
  top: 12px; left: 12px;
  border-right: none; border-bottom: none;
}
.canvas-frame::after {
  bottom: 12px; right: 12px;
  border-left: none; border-top: none;
}

/* ──── COMPARE SLIDER (result page) ──── */

#compareContainer {
  position: relative;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
  border-radius: var(--radius-lg);
  background: var(--surface-void);
}
#beforeImg,
#afterImg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
#beforeImg {
  clip-path: inset(0 50% 0 0);
}
#sliderBar {
  position: absolute; top: 0; bottom: 0;
  width: 1px;
  background: var(--ink-100);
  transform: translateX(-50%);
  left: 50%;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(251, 254, 243, 0.45);
}
#sliderHandle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 18px;
  background: var(--voltage);
  color: var(--surface-night);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.08em;
  box-shadow: 0 0 16px rgba(226, 252, 82, 0.4);
}

.img-label {
  position: absolute;
  top: 16px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(9, 9, 6, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--ink-100);
  pointer-events: none;
  border: 1px solid var(--hairline);
}
.img-label-before { left: 16px; }
.img-label-after  { right: 16px; }

/* ──── STREETVIEW ──── */

#addressDropdown {
  background: var(--surface-shelf);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
#addressDropdown > * {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--ink-70);
  transition: background var(--dur-fast) var(--ease-lifx),
              color var(--dur-fast) var(--ease-lifx);
}
#addressDropdown > *:last-child { border-bottom: none; }
#addressDropdown > *:hover {
  background: rgba(226, 255, 144, 0.06);
  color: var(--highlight);
}
