/* OneNav — Liquid Glass aesthetic */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--fg);
  background: var(--bg-base);
  overflow-x: hidden;
}

body {
  overflow-y: auto;
}

:root {
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ─── Light mode (default) ───────────────────────────────────── */
.theme-light {
  --fg: #0a1a2e;
  --fg-muted: rgba(10, 26, 46, 0.62);
  --fg-dim: rgba(10, 26, 46, 0.42);
  --bg-base: #b8d4e8;
  --glass-bg: rgba(255, 255, 255, 0.42);
  --glass-bg-strong: rgba(255, 255, 255, 0.58);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shine: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 8px 28px rgba(10, 40, 80, 0.10), 0 2px 8px rgba(10, 40, 80, 0.06);
  --divider: rgba(10, 26, 46, 0.08);
  --accent: #0a84ff;
  --ok: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
}

/* ─── Dark mode ──────────────────────────────────────────────── */
.theme-dark {
  --fg: #e8f0ff;
  --fg-muted: rgba(232, 240, 255, 0.62);
  --fg-dim: rgba(232, 240, 255, 0.38);
  --bg-base: #0a1628;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-strong: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shine: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
  --divider: rgba(255, 255, 255, 0.08);
  --accent: #0a84ff;
  --ok: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
}

/* ─── Wallpaper (sky-blue horizon, Mac-style) ────────────────── */
.wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.wallpaper::before {
  /* big soft horizontal bands, pre-mixed rather than runtime blurred */
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(ellipse 78% 36% at 20% 15%, rgba(255, 255, 255, 0.42), transparent 58%),
    radial-gradient(ellipse 96% 44% at 80% 85%, rgba(56, 128, 200, 0.34), transparent 54%),
    radial-gradient(ellipse 64% 28% at 75% 25%, rgba(200, 225, 245, 0.36), transparent 58%),
    linear-gradient(180deg, #b8dcf0 0%, #84b8df 38%, #4a88c4 72%, #2c5d96 100%);
  opacity: 0.98;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.theme-dark .wallpaper::before {
  background:
    radial-gradient(ellipse 66% 30% at 20% 18%, rgba(80, 130, 200, 0.34), transparent 58%),
    radial-gradient(ellipse 96% 46% at 80% 85%, rgba(20, 60, 120, 0.42), transparent 54%),
    radial-gradient(ellipse 64% 28% at 78% 30%, rgba(100, 150, 220, 0.24), transparent 58%),
    linear-gradient(180deg, #1a3458 0%, #102a4a 38%, #081c36 72%, #04101f 100%);
  opacity: 0.98;
}

/* ─── Frosted panel surface without runtime backdrop sampling ─ */
.glass {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.30), rgba(255,255,255,0.16)),
    var(--glass-bg);
  border: 0.5px solid var(--glass-border);
  border-radius: var(--r, 22px);
  isolation: isolate;
  contain: paint;
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-shine),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}
.theme-dark .glass {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
    var(--glass-bg);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 var(--glass-shine),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.glass-strong {
  background: var(--glass-bg-strong);
}

/* specular highlight overlay — disabled pointer events and kept cheap */
.glass-spec::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 120% 60% at 50% -20%, rgba(255, 255, 255, 0.3), transparent 60%);
  pointer-events: none;
  opacity: 0.8;
  z-index: 0;
}
.theme-dark .glass-spec::after {
  background:
    radial-gradient(ellipse 120% 60% at 50% -20%, rgba(255, 255, 255, 0.08), transparent 60%);
}
.glass > *, .glass-spec > * { position: relative; z-index: 1; }

.search-bar {
  contain: none;
  overflow: visible;
  z-index: 20;
}

/* ─── Utility ───────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 500;
}

/* buttons */
.btn-ghost {
  appearance: none;
  border: none;
  background: none;
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* scrollbar */
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15); border-radius: 99px;
}

/* ─── Tile grid ─────────────────────────────────────────────── */
/* IMPORTANT: no :hover transforms/filters on tiles.
   Any transform/filter on a descendant of a .glass element (backdrop-filter)
   causes the blur-backdrop layer to recomposite each mouse move, which reads
   as flicker. Keep tiles statically painted. Active press is fine (one-shot). */
.tile {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.tile:active { opacity: 0.7; }
.tile.dragging { opacity: 0.4; }
.tile.dragging { opacity: 0.4; }
.tile.wiggle {
  animation: wiggle 0.35s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.2deg); }
}

.tile.glass {
  background: var(--glass-bg-strong);
}

.tile-icon {
  contain: paint;
}

.pin-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-base);
  z-index: 2;
}

/* ─── Monitor widget ────────────────────────────────────────── */
.metric-ring {
  --p: 0;
  background: conic-gradient(currentColor calc(var(--p) * 1%), rgba(255,255,255,0.12) 0);
  mask: radial-gradient(circle, transparent 58%, black 60%);
  -webkit-mask: radial-gradient(circle, transparent 58%, black 60%);
}

/* sparkline shimmer */
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  animation: live-pulse 1.6s ease-in-out infinite;
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 20, 35, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-card {
  animation: slide-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

/* ─── Input ─────────────────────────────────────────────────── */
.input-reset {
  appearance: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  width: 100%;
}
.input-reset::placeholder { color: var(--fg-dim); }

/* ─── Tweaks panel ──────────────────────────────────────────── */
.tweaks-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 280px;
  padding: 16px;
  font-size: 13px;
}
.tweaks-panel h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.tweaks-panel .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  gap: 10px;
}
.tweaks-panel select, .tweaks-panel input[type="range"] {
  flex: 1;
  min-width: 0;
}

/* ─── Segmented control ─────────────────────────────────────── */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 9999px;
  gap: 2px;
  background: rgba(0,0,0,0.06);
}
.theme-dark .segmented { background: rgba(255,255,255,0.06); }
.segmented button {
  appearance: none;
  border: none;
  padding: 6px 14px;
  border-radius: 9999px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.segmented button.active {
  background: var(--glass-bg-strong);
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* prevent iOS safari long-press callout */
.no-callout {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
