/* ============================================================
   AetheriumOS — shared stylesheet
   Dark, technical, terminal-inflected. One accent (sky blue),
   monospace reserved for anything that is literally output.
   ============================================================ */

:root {
  --bg: #09090b;
  --surface: #0d0d11;
  --card: #131316;
  --border: #232328;
  --border-strong: #313138;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 4px 16px -8px rgba(0, 0, 0, 0.5);

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
p { margin: 0; color: var(--text-secondary); }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
code { font-family: var(--font-mono); }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Background grid ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.main-content { padding-top: 96px; padding-bottom: 40px; min-height: 70vh; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  margin-right: auto;
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.brand-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}
.nav-menu {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.nav-link:hover, .nav-link.active { color: #fff; }
.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.menu-toggle {
  display: none;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
}
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
}
.mobile-nav.open { display: flex; }
.mobile-nav .nav-link { padding: 10px 4px; border-bottom: 1px solid var(--border); }
.mobile-auth-block { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 860px) {
  .nav-menu { display: none; }
  .menu-toggle { display: flex; }
  .nav-actions .btn:not(.menu-toggle) { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent-gradient);
  color: #04121b;
}
.btn-primary:hover { box-shadow: 0 0 24px var(--accent-glow); }
.btn-accent {
  background: var(--accent);
  color: #04121b;
}
.btn-accent:hover { box-shadow: 0 0 24px var(--accent-glow); }
.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: #fff;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: #fff; background: var(--surface); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 26px; font-size: 0.95rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.badge-neutral {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.badge-success {
  background: var(--success-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

/* ---------- Hero ---------- */
.hero-section { text-align: center; padding: 32px 0 20px; }
.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.12;
  margin: 20px 0 16px;
}
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  max-width: 640px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.6;
}
.hero-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

/* ---------- Section header ---------- */
.section-header { text-align: center; max-width: 560px; margin: 0 auto 32px; }
.section-header h2 { font-size: 1.9rem; margin-bottom: 10px; }
.section-header p { font-size: 0.95rem; }

/* ---------- Bento grid / cards ---------- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
@media (max-width: 860px) {
  .col-4, .col-6, .col-8 { grid-column: span 12; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--border-strong); }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p { font-size: 0.875rem; line-height: 1.55; }
.card-icon-wrapper {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--accent);
  margin-bottom: 14px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-input, .form-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}
.form-select { appearance: none; cursor: pointer; }

.auth-container { }

/* ---------- Terminal ---------- */
.terminal-card {
  background: #0a0a0c;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.terminal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.terminal-dots { display: flex; gap: 6px; margin-right: 4px; }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }
.terminal-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-x: auto;
  overflow-y: auto;
}
.terminal-body .comment { color: var(--text-tertiary); }
.terminal-body .command { color: var(--accent); }
.terminal-body .output { color: var(--text-secondary); }
.terminal-body .success { color: var(--success); font-weight: 600; }
.terminal-body .error-line { color: var(--danger); }

/* ---------- Progress ---------- */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #0d0d11;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.2s ease;
}

/* ---------- Metric cards / core grid (telemetry) ---------- */
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}
.core-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.core-item {
  background: #0d0d11;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.core-bar-track {
  width: 100%; height: 4px;
  background: #18181b;
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.core-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.3s ease;
}

/* ---------- OS tabs (download page) ---------- */
.os-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 32px; flex-wrap: wrap; }
.os-tab-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.os-tab-btn:hover { border-color: var(--border-strong); color: #fff; }
.os-tab-btn.active {
  background: var(--card);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}
.os-panel { display: none; animation: fadeIn 0.25s ease; }
.os-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Stepper (flasher) ---------- */
.stepper-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
  overflow-x: auto;
  gap: 6px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  opacity: 0.45;
}
.step-item.active, .step-item.done { opacity: 1; }
.step-number {
  width: 24px; height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
}
.step-item.active .step-number { background: var(--accent); border-color: var(--accent); color: #04121b; }
.step-item.done .step-number { background: var(--success); border-color: var(--success); color: #04120b; }
.step-title { font-size: 0.7rem; color: var(--text-secondary); white-space: nowrap; display: none; }
@media (min-width: 640px) { .step-title { display: inline; } }

.flasher-box {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}
.step-pane { display: none; animation: fadeIn 0.25s ease; }
.step-pane.active { display: block; }

.flash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.flash-overlay.open { display: flex; }
.flash-modal {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal (cloud panel) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-content {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.modal-close:hover { color: #fff; }

/* ---------- Table (cloud vault) ---------- */
.storage-table { width: 100%; border-collapse: collapse; text-align: left; }
.storage-table th {
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface);
}
.storage-table td {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.storage-table tr:last-child td { border-bottom: none; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  background: #0d0d11;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(56, 189, 248, 0.03); }

/* ---------- Legacy ports filters ---------- */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 24px; }
.filter-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.filter-chip:hover { color: #fff; border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--card);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}
.search-wrapper { position: relative; margin-bottom: 16px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.search-input-field { padding-left: 42px !important; }

.device-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 10px;
}
.device-card:hover { border-color: var(--border-strong); }
.device-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 28px; margin-top: 60px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-brand p { font-size: 0.85rem; margin-top: 12px; line-height: 1.6; max-width: 260px; }
.footer-heading { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #fff; margin-bottom: 14px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { font-size: 0.85rem; color: var(--text-secondary); transition: color 0.15s ease; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ---------- Toasts ---------- */
#toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: var(--shadow-sm);
  animation: toastIn 0.2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
.toast.leaving { animation: toastOut 0.18s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
