/* =========================================================================
   Lumen Edge — Design System
   Sleek minimalist future. Dark graphite surfaces, hairline rims,
   and a single luminous horizon line as the signal of focus and depth.
   ========================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* -------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */
:root {
  /* Color — luminance-only palette, no chromatic accent */
  --color-void: #1b1c22;
  --color-graphite: #0b151e;
  --color-panel: #20222a;
  --color-panel-raised: #262932;
  --color-slate-rise: #47515c;
  --color-hairline: #2f3441;
  --color-foreground: #ffffff;
  --color-muted: #a8aebb;
  --color-lumen: #cfd8e6;

  /* Alpha tokens for hairlines and overlays */
  --alpha-hairline: rgba(255, 255, 255, 0.1);
  --alpha-hairline-strong: rgba(255, 255, 255, 0.16);
  --alpha-foreground-66: rgba(255, 255, 255, 0.66);
  --alpha-foreground-12: rgba(255, 255, 255, 0.12);
  --alpha-foreground-0: rgba(255, 255, 255, 0);

  /* Surface gradients — the system's material vocabulary */
  --surface-gradient: radial-gradient(
    ellipse at bottom,
    rgba(71, 81, 92, 1) 0%,
    rgba(11, 21, 30, 1) 45%
  );
  --surface-gradient-soft: radial-gradient(
    ellipse at bottom,
    rgba(71, 81, 92, 0.55) 0%,
    rgba(11, 21, 30, 0.95) 55%
  );
  --surface-panel-gradient: radial-gradient(
    ellipse at bottom,
    rgba(47, 52, 65, 0.6) 0%,
    rgba(20, 22, 30, 1) 65%
  );

  /* Horizon — the signature 70%-wide gradient highlight at the base */
  --horizon-line: linear-gradient(
    90deg,
    var(--alpha-foreground-0) 0%,
    var(--color-foreground) 50%,
    var(--alpha-foreground-0) 100%
  );
  --horizon-line-lumen: linear-gradient(
    90deg,
    var(--alpha-foreground-0) 0%,
    var(--color-lumen) 50%,
    var(--alpha-foreground-0) 100%
  );

  /* Typography */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --text-display-lg: 44px;
  --text-display-md: 30px;
  --text-display-sm: 22px;
  --text-body-lg: 17px;
  --text-body-md: 15px;
  --text-body-sm: 13px;
  --text-label-sm: 12px;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;

  --tracking-tight: -0.02em;
  --tracking-normal: 0em;
  --tracking-wide: 0.08em;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing — 4px base scale */
  --space-3xs: 2px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 72px;

  /* Radius */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 7px;   /* primary control radius */
  --radius-lg: 14px;  /* card and panel radius */
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Borders & focus */
  --border-hairline: 1px solid var(--color-hairline);
  --rim-inset: inset 0 0 0 1px var(--alpha-hairline);
  --rim-inset-strong: inset 0 0 0 1px var(--alpha-hairline-strong);
  --focus-ring: 0 0 0 1px var(--color-lumen), 0 0 16px rgba(207, 216, 230, 0.25);

  /* Elevation — soft, very dark drop shadows only */
  --shadow-none: none;
  --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.4),
                 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-raised: 0 2px 4px rgba(0, 0, 0, 0.5),
                   0 24px 48px -16px rgba(0, 0, 0, 0.7);

  /* Motion */
  --motion-slow: 1s cubic-bezier(0.15, 0.83, 0.66, 1);
  --motion-medium: 420ms cubic-bezier(0.15, 0.83, 0.66, 1);
  --motion-fast: 200ms cubic-bezier(0.15, 0.83, 0.66, 1);
}

/* -------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-void);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--color-lumen);
  color: var(--color-graphite);
}

/* -------------------------------------------------------------------------
   Typography primitives
   ------------------------------------------------------------------------- */
.display-lg,
.display-md,
.display-sm {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-foreground);
  margin: 0;
}
.display-lg { font-size: var(--text-display-lg); font-weight: var(--weight-bold); }
.display-md { font-size: var(--text-display-md); }
.display-sm { font-size: var(--text-display-sm); }

.body-lg { font-size: var(--text-body-lg); line-height: var(--leading-normal); color: var(--color-muted); }
.body-md { font-size: var(--text-body-md); line-height: var(--leading-normal); color: var(--color-muted); }
.body-sm { font-size: var(--text-body-sm); line-height: var(--leading-snug); color: var(--color-muted); }

.label-sm {
  font-family: var(--font-display);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

.mono {
  font-family: var(--font-mono);
  font-weight: var(--weight-regular);
  letter-spacing: 0;
}

/* -------------------------------------------------------------------------
   Layout primitives
   ------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.stack > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }
.row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.divider {
  height: 1px;
  background: var(--color-hairline);
  border: 0;
  margin: var(--space-lg) 0;
}

/* -------------------------------------------------------------------------
   Surface — the reusable radial-gradient material
   ------------------------------------------------------------------------- */
.surface {
  position: relative;
  background: var(--surface-gradient);
  box-shadow: var(--rim-inset);
  color: var(--alpha-foreground-66);
  border-radius: var(--radius-md);
  isolation: isolate;
}

/* Horizon: the 70%-wide bottom highlight that fades in on interaction */
.surface::before,
.btn::before,
.input::before,
.tab.is-active::before,
.checkbox input:checked ~ .checkbox-box::before,
.horizon-panel::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 15%;
  width: 70%;
  height: 1px;
  background: var(--horizon-line);
  opacity: 0.2;
  transition: opacity var(--motion-slow);
  pointer-events: none;
}

/* -------------------------------------------------------------------------
   Button
   ------------------------------------------------------------------------- */
.btn {
  --btn-color: var(--alpha-foreground-66);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-width: 120px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-gradient);
  box-shadow: var(--rim-inset);
  color: var(--btn-color);
  font-family: var(--font-display);
  font-size: var(--text-body-md);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-normal);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  isolation: isolate;
  transition: color var(--motion-slow),
              transform var(--motion-slow),
              box-shadow var(--motion-slow);
}

.btn:hover {
  color: var(--color-foreground);
  transform: scale(1.04) translateY(-3px);
  box-shadow: var(--rim-inset-strong);
}
.btn:hover::before { opacity: 1; }

.btn:focus-visible {
  outline: none;
  box-shadow: var(--rim-inset-strong), var(--focus-ring);
}
.btn:focus-visible::before { opacity: 1; }

.btn:active {
  transform: translateY(-1px) scale(1.01);
  transition-duration: 240ms;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn[disabled]:hover::before,
.btn:disabled:hover::before { opacity: 0.2; }

/* Variants */
.btn-secondary {
  background: var(--color-panel);
  box-shadow: var(--rim-inset);
}

.btn-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--color-hairline);
  color: var(--color-muted);
}
.btn-ghost:hover { color: var(--color-foreground); }

.btn-sm {
  min-width: 0;
  padding: 8px 14px;
  font-size: var(--text-body-sm);
}

.btn-lg {
  padding: 16px 24px;
  font-size: var(--text-body-lg);
}

/* -------------------------------------------------------------------------
   Input & form field
   ------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.field-label {
  font-family: var(--font-display);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

.input {
  position: relative;
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--rim-inset);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: 1.25;
  isolation: isolate;
  transition: box-shadow var(--motion-medium), background var(--motion-medium);
}

.input::placeholder { color: var(--color-muted); opacity: 0.7; }

.input:hover { box-shadow: var(--rim-inset-strong); }

.input:focus,
.input:focus-visible {
  outline: none;
  background: var(--color-panel-raised);
  box-shadow: var(--rim-inset-strong);
}
.input:focus::before,
.input:focus-visible::before { opacity: 1; }

/* Field wrapper enables the horizon line on inputs */
.field .input-wrap {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-md);
}
.field .input-wrap::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 15%;
  width: 70%;
  height: 1px;
  background: var(--horizon-line-lumen);
  opacity: 0;
  transition: opacity var(--motion-medium);
  pointer-events: none;
}
.field .input-wrap:focus-within::after { opacity: 1; }

/* -------------------------------------------------------------------------
   Card
   ------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--color-panel);
  background-image: var(--surface-panel-gradient);
  border-radius: var(--radius-lg);
  box-shadow: var(--rim-inset), var(--shadow-card);
  padding: var(--space-lg);
  color: var(--color-foreground);
  isolation: isolate;
  overflow: hidden;
  transition: box-shadow var(--motion-slow), transform var(--motion-slow);
}

.card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 15%;
  width: 70%;
  height: 1px;
  background: var(--horizon-line);
  opacity: 0.18;
  pointer-events: none;
}

.card.is-featured::after {
  opacity: 0.85;
  background: var(--horizon-line-lumen);
}

.card-eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--text-display-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  color: var(--color-foreground);
  margin: 0 0 var(--space-xs);
}
.card-body { color: var(--color-muted); margin: 0; }

/* -------------------------------------------------------------------------
   Checkbox
   ------------------------------------------------------------------------- */
.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
  color: var(--color-muted);
  font-size: var(--text-body-md);
}

.checkbox input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.checkbox-box {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--color-panel);
  box-shadow: var(--rim-inset);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  isolation: isolate;
  transition: background var(--motion-medium), box-shadow var(--motion-medium);
}

.checkbox-box svg {
  width: 12px;
  height: 12px;
  color: var(--color-lumen);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--motion-fast), transform var(--motion-medium);
}

.checkbox input:checked ~ .checkbox-box {
  background: linear-gradient(180deg, var(--color-slate-rise) 0%, var(--color-graphite) 100%);
  box-shadow: var(--rim-inset-strong);
}
.checkbox input:checked ~ .checkbox-box svg {
  opacity: 1;
  transform: scale(1);
}

.checkbox input:checked ~ .checkbox-box::before {
  opacity: 1;
  background: var(--horizon-line-lumen);
}

.checkbox input:focus-visible ~ .checkbox-box {
  box-shadow: var(--rim-inset-strong), var(--focus-ring);
}

.checkbox:has(input:checked) { color: var(--color-foreground); }

/* -------------------------------------------------------------------------
   Tabs
   ------------------------------------------------------------------------- */
.tabs {
  display: inline-flex;
  align-items: stretch;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--color-panel);
  box-shadow: var(--rim-inset);
  gap: 2px;
}

.tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-normal);
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  isolation: isolate;
  transition: color var(--motion-medium), background var(--motion-medium),
              box-shadow var(--motion-medium);
}

.tab:hover { color: var(--color-foreground); }

.tab.is-active {
  color: var(--color-foreground);
  background: var(--surface-gradient);
  box-shadow: var(--rim-inset);
}
.tab.is-active::before { opacity: 1; }

.tab:focus-visible {
  outline: none;
  box-shadow: var(--rim-inset-strong), var(--focus-ring);
}

/* -------------------------------------------------------------------------
   Horizon Panel — signature element
   ------------------------------------------------------------------------- */
.horizon-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-lg) var(--space-xl);
  background: var(--surface-gradient);
  border-radius: var(--radius-lg);
  box-shadow: var(--rim-inset), var(--shadow-raised);
  color: var(--color-foreground);
  isolation: isolate;
  overflow: hidden;
}

.horizon-panel::before {
  width: 70%;
  left: 15%;
  background: var(--horizon-line-lumen);
  opacity: 0.9;
  animation: horizon-pulse 4.5s ease-in-out infinite;
}

@keyframes horizon-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.horizon-panel .status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-lumen);
  box-shadow: 0 0 12px rgba(207, 216, 230, 0.7);
}

.horizon-panel .panel-eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
  display: block;
  margin-bottom: var(--space-2xs);
}
.horizon-panel .panel-title {
  font-family: var(--font-display);
  font-size: var(--text-display-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

.horizon-panel .panel-grow { flex: 1 1 auto; }

/* -------------------------------------------------------------------------
   Chip / Tag (pill)
   ------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--color-panel);
  box-shadow: var(--rim-inset);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--text-label-sm);
  letter-spacing: 0.02em;
}

/* -------------------------------------------------------------------------
   Icon sizing utility (works with Lucide via currentColor)
   ------------------------------------------------------------------------- */
.icon {
  width: 1em;
  height: 1em;
  display: inline-flex;
  color: currentColor;
  stroke-width: 1.5;
}
.icon-sm { font-size: 14px; }
.icon-md { font-size: 18px; }
.icon-lg { font-size: 24px; }

/* -------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
