/* ─────────────────────────────────────────────────────────────
   Privora shared styles. Every page loads this file first.
   Page-specific styles stay inside each page.
   ───────────────────────────────────────────────────────────── */


/* Fonts are bundled in the fonts/ folder, so they work offline. */
@font-face { font-family: 'Syne'; src: url('fonts/syne.woff') format('woff'); font-weight: 600 800; font-style: normal; font-display: swap; }

@font-face { font-family: 'DM Sans'; src: url('fonts/dm-sans.woff') format('woff'); font-weight: 400 700; font-style: normal; font-display: swap; }

@font-face { font-family: 'DM Mono'; src: url('fonts/dm-mono-400.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }

@font-face { font-family: 'DM Mono'; src: url('fonts/dm-mono-500.woff') format('woff'); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --bg: #080c14;
  --surface: #0d1420;
  --surface-2: #121b2e;
  --line: rgba(99, 179, 237, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #63b3ed;
  --accent-2: #4fd1c5;
  --star: #f6e05e;
  --danger: #fc8181;
  --font-display: 'Syne', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 64px;
  --pad: clamp(1rem, 4vw, 2.5rem);
}

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

[hidden] { display: none !important; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 600px at 0% 0%, rgba(99, 179, 237, 0.08), transparent 70%),
    radial-gradient(520px 520px at 100% 100%, rgba(79, 209, 197, 0.06), transparent 70%),
    linear-gradient(rgba(99, 179, 237, 0.03) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(99, 179, 237, 0.03) 1px, transparent 1px) 0 0 / 48px 48px;
}

html[data-lite] body::before { display: none; }

html[data-lite] .site-header { backdrop-filter: none; background: var(--bg); }

html[data-lite] *, html[data-lite] *::before, html[data-lite] *::after { transition: none !important; animation: none !important; }

html[data-lite] .toast, html[data-lite] dialog, html[data-lite] .sel-bar { box-shadow: none; }

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

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--bg);
  padding: 8px 14px; border-radius: 0 0 8px 8px; font-weight: 600; text-decoration: none;
}

.skip-link:focus { top: 0; }

.icon {
  width: 1em; height: 1em; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}

.icon.filled { fill: currentColor; }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 0.93em; }

.wrap { max-width: 1240px; margin-inline: auto; padding-inline: max(var(--pad), env(safe-area-inset-left)) max(var(--pad), env(safe-area-inset-right)); }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--header-h);
  min-width: 0;
  overflow: hidden; /* never scroll the header sideways */
}

.header-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; /* logo + account controls stay on-screen */
}

/* Search (when present on home) must shrink instead of pushing logout away */
.site-header .search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
}

.logo {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0; color: var(--text); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
}

.logo b { color: var(--accent); font-weight: 800; }

.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--bg);
}

.logo-mark .icon { width: 17px; height: 17px; stroke-width: 2; }

.home-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted);
  text-decoration: none; padding: 6px 10px; border-radius: 8px;
}

.home-link:hover { color: var(--text); background: rgba(99, 179, 237, 0.08); }

.home-link .icon { width: 15px; height: 15px; }

.device-badge {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; font-size: 12px; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; background: var(--surface);
}

.device-badge .icon { width: 12px; height: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}

.btn:hover { border-color: rgba(99, 179, 237, 0.45); background: rgba(99, 179, 237, 0.08); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn .icon { width: 15px; height: 15px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }

.btn-primary:hover { background: #90cdf4; border-color: #90cdf4; }

.btn-danger { color: var(--danger); border-color: rgba(252, 129, 129, 0.35); }

.btn-danger:hover { background: rgba(252, 129, 129, 0.1); border-color: rgba(252, 129, 129, 0.6); }

.icon-btn {
  flex-shrink: 0;
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}

.icon-btn:hover:not(:disabled) { background: rgba(99, 179, 237, 0.1); color: var(--text); }

.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.icon-btn .icon { width: 19px; height: 19px; }

.icon-btn.danger:hover:not(:disabled) { color: var(--danger); background: rgba(252, 129, 129, 0.1); }

.link-btn { font: inherit; font-size: 12.5px; color: var(--danger); background: none; border: 0; border-radius: 6px; padding: 4px 8px; cursor: pointer; }

.link-btn:hover { background: rgba(252, 129, 129, 0.1); }

.notice {
  margin-bottom: 16px; padding: 12px 16px; border-radius: 10px;
  border: 1px solid rgba(252, 129, 129, 0.35); background: rgba(252, 129, 129, 0.07);
  color: #feb2b2; font-size: 14px;
}

.select {
  font: inherit; font-size: 12.5px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}

dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; width: min(92vw, 400px);
}

/* 30-day trash retention note inside confirm dialogs */
dialog .trash-warning {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--danger, #fc8181);
}
dialog .trash-warning strong { font-weight: 600; }

dialog::backdrop { background: rgba(4, 7, 12, 0.7); }

dialog h2 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-bottom: 8px; }

dialog p { color: var(--muted); font-size: 14px; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast {
  width: max-content; position: fixed; left: 50%; transform: translateX(-50%); z-index: 80; bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px; max-width: min(92vw, 460px); padding: 10px 14px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.toast-btn { font: inherit; font-size: 13.5px; font-weight: 600; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 2px 4px; }

@media (max-width: 720px) {
  .device-badge { display: none; }
  .site-header .wrap { gap: 8px; }
  .site-header .logo span:not(.logo-mark) { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; } }

::-webkit-scrollbar { width: 6px; height: 6px; }

::-webkit-scrollbar-track { background: transparent; }

::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; }
