/* Archi OS — editorial light shell (v2)
 * Ink-first palette. Accent reserved for focus + active.
 * Fraunces serif for display numbers. Layered micro-shadows.
 * Reference: Linear / Stripe / Vercel — craft over chrome.
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Fraunces:opsz,wght@9..144,400;9..144,500&display=swap');

:root {
  /* ── Ink system (replaces text/muted/dim) ── */
  --ink:        #0A0A0A;   /* primary text, logos, primary buttons */
  --ink-2:      #1F2024;   /* headings */
  --ink-mute:   #525866;   /* body + metadata */
  --ink-soft:   #8A8F98;   /* captions, timestamps, placeholders */

  /* ── Surfaces ── */
  --bg:         #FFFFFF;   /* page */
  --bg-card:    #FFFFFF;   /* resting card */
  --bg-soft:    #FAFAFA;   /* hover / zebra */
  --bg-hover:   #F5F5F5;   /* nav hover, list hover */

  /* ── Lines (do most of the heavy lifting) ── */
  --line:       #E8E8ED;
  --line-2:     #D4D4D8;   /* hover border */
  --line-3:     #BDBEC3;   /* focused-but-unselected */

  /* ── Accent — used ONLY for focus ring, active nav, 1 CTA/screen ── */
  --accent:      #2563EB;
  --accent-soft: #DBEAFE;
  --accent-hover:#1D4ED8;

  /* ── Status ── */
  --success:     #16A34A;
  --warn:        #D97706;
  --danger:      #DC2626;
  --gold:        #F59E0B;

  /* ── Back-compat aliases (old class refs still render) ── */
  --text:         var(--ink);
  --text-muted:   var(--ink-mute);
  --text-dim:     var(--ink-soft);
  --border:       var(--line);
  --border-strong:var(--line-2);
  --border-hover: var(--ink);
  --navy:         var(--bg);
  --navy-2:       var(--bg-card);
  --navy-3:       var(--bg-soft);
  --navy-4:       var(--line-2);
  --cream:        #FAF8F6;

  /* ── Radii — tighter, de-pilled ── */
  --radius-sm:   6px;      /* chips, badges */
  --radius-md:   8px;      /* inputs, buttons */
  --radius-lg:   10px;     /* cards (was 16) */
  --radius-xl:   14px;     /* large panels */

  /* ── Shadows — stacked, nearly invisible (Linear move) ── */
  --shadow-sm:
    0 0 0 1px rgba(10,10,10,0.03),
    0 1px 2px rgba(10,10,10,0.04);
  --shadow-md:
    0 0 0 1px rgba(10,10,10,0.04),
    0 1px 2px rgba(10,10,10,0.04),
    0 4px 12px -2px rgba(10,10,10,0.05);
  --shadow-lg:
    0 0 0 1px rgba(10,10,10,0.05),
    0 2px 4px rgba(10,10,10,0.04),
    0 12px 28px -6px rgba(10,10,10,0.10);

  /* ── Spacing rhythm (8-pt, bias large) ── */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* ── Type ── */
  --font-sans:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Global micro-motion — 150-200ms ease, no bounce */
a, button, input, textarea, select,
.card, .tile, .list-item, .nav a, .badge, .btn,
.user-pill, .chip, .pill {
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 200ms ease,
    transform 200ms ease;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h1 { font-size: 28px; letter-spacing: -0.03em; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; font-weight: 500; }

/* Display serif — use for dashboard tile numbers + page h1 on spotlight screens */
.display,
.tile-number,
.stat-number,
h1.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  font-size: 40px;
  line-height: 1.05;
  color: var(--ink);
}

a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 250ms ease, color 150ms ease;
}
a:hover { background-size: 100% 1px; color: var(--ink); }
a.plain, a.plain:hover { background-image: none; }

button {
  font-family: inherit; font-size: inherit; cursor: pointer;
  border: 0; background: none;
}

input, textarea, select {
  font-family: inherit; font-size: 14px;
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-soft); }
input:hover, textarea:hover, select:hover { border-color: var(--line-2); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(150%) blur(8px);
  z-index: 10;
}

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 500; font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-decoration: none;
  background-image: none;
}
.brand:hover { background-image: none; color: var(--ink); }
.brand-mark { display: inline-flex; color: var(--ink); }
.brand-mark svg { display: block; width: 16px; height: 16px; }
.brand-mark svg * { stroke: currentColor; fill: none; }
.brand-os {
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 400;
  margin-left: 6px;
  letter-spacing: 0.08em;
  font-size: 0.7em;
  text-transform: uppercase;
}

/* Nav — left-border slide, no pill fill */
.nav {
  display: flex; gap: 2px;
  font-size: 13px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
  padding: 0 24px;
}
.nav a {
  color: var(--ink-mute);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  background-image: none;
  position: relative;
}
.nav a:hover {
  color: var(--ink);
  background: var(--bg-hover);
  background-image: none;
}
.nav a.active {
  color: var(--ink);
  background: var(--bg-hover);
  font-weight: 600;
}
.nav a.active::before {
  content: '';
  position: absolute;
  left: 6px; right: 6px; bottom: 3px;
  height: 2px; border-radius: 2px;
  background: var(--ink);
}

/* Topbar right */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-mute);
  background: var(--bg-card);
  cursor: pointer;
}
.user-pill:hover { border-color: var(--line-2); color: var(--ink); }
.avatar-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  display: inline-grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 600;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  background-image: none;
}
.btn:hover { background: #000; color: #fff; background-image: none; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: var(--accent-hover); }
.btn:disabled { background: var(--line-2); color: var(--ink-soft); cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--bg-soft); border-color: var(--line-2); }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card.hover:hover,
.card.interactive:hover {
  border-color: var(--line-2);
  background: var(--bg-soft);
}
.card h3 { margin-bottom: 6px; }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  background: var(--bg-hover); color: var(--ink-mute);
  border: 1px solid var(--line);
}
.badge.calm   { background: #F0FDF4; color: var(--success); border-color: #DCFCE7; }
.badge.warn   { background: #FFFBEB; color: var(--warn);    border-color: #FEF3C7; }
.badge.alert  { background: #FEF2F2; color: var(--danger);  border-color: #FEE2E2; }
.badge.muted  { background: var(--bg-soft); color: var(--ink-mute); }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ─── Helpers ────────────────────────────────────────── */
.muted { color: var(--ink-mute); font-size: 13px; }
.tiny  { font-size: 12px; color: var(--ink-soft); }
.eyebrow {
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-mute);
}

/* ─── Page heads ─────────────────────────────────────── */
.page-head { margin-bottom: 40px; }
.page-head h1 { font-size: 28px; line-height: 1.15; margin-bottom: 6px; letter-spacing: -0.03em; }
.page-head h1.display { font-size: 40px; font-family: var(--font-display); font-weight: 400; }
.page-head .sub { color: var(--ink-mute); font-size: 15px; max-width: 60ch; }

/* Give pages room to breathe */
main, .page, .page-wrap { padding-top: var(--s-6); padding-bottom: var(--s-8); }

/* ─── Empty state ────────────────────────────────────── */
.empty {
  padding: 56px 24px; text-align: center;
  background: var(--bg-card); border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }
.empty p  { color: var(--ink-mute); font-size: 14px; max-width: 480px; margin: 0 auto 16px; }

/* ─── List / detail ──────────────────────────────────── */
.split { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }
.list-panel { padding: 16px; }
.list-panel h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-soft); margin-bottom: 12px; font-weight: 500;
}
.list-item {
  padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}
.list-item:hover { background: var(--bg-hover); border-left-color: var(--line-2); }
.list-item.active {
  background: var(--bg-hover);
  border-left-color: var(--ink);
}
.list-item .name { font-weight: 500; color: var(--ink); font-size: 14px; }
.list-item .meta { font-size: 11px; color: var(--ink-mute); margin-top: 2px; }

/* ─── Dashboard bento overrides (the big win) ───────── */
.tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.tile:hover {
  border-color: var(--line-2);
  background: var(--bg-soft);
  box-shadow: var(--shadow-sm);
  transform: none;
}
/* Kill the blue gradient primary tile — use ink instead, sparingly */
.tile.primary {
  background: var(--ink) !important;
  color: #fff;
  border-color: var(--ink);
  box-shadow: var(--shadow-md);
}
.tile.primary:hover { background: #000 !important; }
.tile.primary h3,
.tile.primary .tile-desc,
.tile.primary .tile-cta { color: #fff; }
.tile.primary .tile-desc { opacity: 0.8; }
.tile.primary .tile-cta { opacity: 0.95; }

.tile-icon {
  display: inline-flex; width: 28px; height: 28px;
  align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--ink-mute);
  opacity: 1;
}
.tile.primary .tile-icon { color: #fff; opacity: 0.9; }
.tile h3 { font-size: 17px; margin-bottom: 4px; font-weight: 600; letter-spacing: -0.015em; }
.tile-desc { color: var(--ink-mute); font-size: 13.5px; line-height: 1.55; }
.tile.primary .tile-desc { color: rgba(255,255,255,0.78); }
.tile-cta { margin-top: 16px; font-size: 13px; color: var(--ink); font-weight: 500; }

/* Rise-in animation for tile numbers + metrics (400ms) */
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.tile-number, .stat-number { animation: rise 400ms cubic-bezier(.2,.6,.2,1) both; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ─── Focus ring (accessibility) ─────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible, a:focus-visible { outline-offset: 3px; }
