/* ─────────────────────────────────────────────────────────────────
   FLYWHEEL V7 SHELL — LOCKED CSS TOKENS + PATTERNS
   ─────────────────────────────────────────────────────────────────
   This file is the source of truth for the v7 dashboard shell.
   It's brand-neutral so the same shell ships for every client
   (SGA, ETS, Aeir, Drain Detective, …). Client brand colors only
   appear inside client assets rendered within the shell — never
   on the shell chrome itself.

   Locked decisions (do NOT change without updating MEMORY.md):
   - Accent is solid black. Same across all client deploys.
   - Sidebar bg is light-grey #FAFAFA; main bg is pure white.
   - Cards have a default elevation shadow + hover lift.
   - Typography: Geist (sans) + JetBrains Mono (numbers/captions).
   - Cards have generous radii (24px outer, 20px inner).
   - Main content max-width: 1400px, centered horizontally.

   See _v7-shell/README.md for usage notes.
   ─────────────────────────────────────────────────────────────── */

:root {
  /* ── CORE PALETTE — brand-neutral, identical for every client ── */
  --accent: #000000;
  --accent-soft: rgba(0, 0, 0, 0.1);
  --accent-fg: #ffffff;

  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #111111;
  --ink-soft: #2a2a2a;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --line-strong: #d6d6d6;

  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-card-hover:
    0 8px 20px rgba(17, 17, 17, 0.08), 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-elevated: 0 20px 40px rgba(17, 17, 17, 0.16);

  /* ── STATUS / TYPE CHIP PASTELS (categorical, not workflow) ── */
  --chip-draft-bg: #f8e7d6;
  --chip-draft-fg: #8b4513;
  --chip-ready-bg: #d7ebdd;
  --chip-ready-fg: #1f5132;
  --chip-review-bg: #e6e0f4;
  --chip-review-fg: #4b3a82;
  --chip-published-bg: #d9e5f3;
  --chip-published-fg: #1e3a6e;
  --chip-archived-bg: #e6e4dc;
  --chip-archived-fg: #5c5c5c;

  /* ── SPACING / RADII ── */
  --radius-card: 24px;
  --radius-card-sm: 20px;
  --radius-control: 8px;
  --radius-control-sm: 6px;
  --radius-pill: 999px;

  --pad-main: 56px 64px 96px;
  --pad-breadcrumb: 16px 64px;
  --main-max-width: 1400px;
}

[x-cloak] {
  display: none !important;
}

html,
body {
  background: var(--bg);
  color: var(--ink);
}
body {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}
.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.caption {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   SHELL LAYOUT
   ─────────────────────────────────────────────────────────────── */
.shell {
  min-height: 100vh;
  position: relative;
}

.main-wrap {
  transition: margin-left 220ms cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 100vh;
}
.main-wrap.shifted {
  margin-left: 280px;
}

/* ─────────────────────────────────────────────────────────────────
   AUTO-HIDE SIDEBAR (macOS auto-hide menu bar metaphor)
   ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  background: #fafafa;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition:
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 220ms ease;
  z-index: 35;
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar.open:not(.pinned) {
  box-shadow: var(--shadow-elevated);
}

/* Trigger strip — always visible on left edge, hover/click reveals sidebar */
.sidebar-trigger {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  z-index: 40;
  cursor: pointer;
  display: flex;
  align-items: stretch;
  justify-content: center;
  transition: background 180ms ease;
}
.sidebar-trigger::after {
  content: "";
  display: block;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 40%,
    rgba(0, 0, 0, 0.15) 60%,
    transparent 100%
  );
  transition: background 180ms ease;
}
.sidebar-trigger:hover {
  background: rgba(0, 0, 0, 0.04);
}
.sidebar-trigger:hover::after {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.45) 60%,
    transparent 100%
  );
}

/* Backdrop scrim when sidebar is open but not pinned */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(17, 17, 17, 0.08);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.sidebar-scrim.show {
  opacity: 1;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────────
   SIDEBAR NAV — Accordion groups + nested-list + flyout
   ─────────────────────────────────────────────────────────────── */
.sidebar-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: var(--radius-control-sm);
  transition:
    background 120ms ease,
    color 120ms ease;
  user-select: none;
}
.sidebar-label:hover {
  background: #f0f0f0;
  color: var(--ink-soft);
}
.sidebar-label .chev {
  width: 10px;
  height: 10px;
  margin-left: auto;
  opacity: 0.6;
  transition: transform 180ms ease;
}
.sidebar-label.expanded .chev {
  transform: rotate(90deg);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-control-sm);
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
  position: relative;
  text-decoration: none;
}
.nav-item:hover {
  background: #f3f3f3;
}
.nav-item .icon {
  width: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-item .count {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  background: #f3f3f3;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  min-width: 22px;
  text-align: center;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  border-color: rgba(0, 0, 0, 0.15);
}
.nav-item.active .count {
  background: var(--accent);
  color: var(--accent-fg);
}
.nav-item .flyout-chev {
  width: 11px;
  height: 11px;
  opacity: 0.5;
  margin-left: 4px;
}

/* Accordion body */
.group-body {
  overflow: hidden;
  transition:
    max-height 240ms ease,
    opacity 180ms ease,
    margin 180ms ease;
}
.group-body.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
.group-body.expanded {
  max-height: 600px;
  opacity: 1;
}

/* Nested-list — visual tree indent for sub-items inside a group */
.nested-list {
  margin-left: 14px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.nested-list .nav-item {
  padding-left: 8px;
}

/* Pin button in sidebar header — toggles persistent open */
.pin-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-control-sm);
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
  margin-left: auto;
}
.pin-btn:hover {
  background: #f0f0f0;
  color: var(--ink-soft);
}
.pin-btn.pinned {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 0, 0, 0.18);
}

/* Fly-out submenu — appears to the right of an active sidebar item.
   IMPORTANT: hover handlers must call BOTH sidebarHoverOpen/Close and
   cancelFlyoutClose/scheduleFlyoutClose to handle the boundary cleanly. */
.flyout {
  position: fixed;
  left: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elevated);
  padding: 8px;
  min-width: 220px;
  z-index: 38;
}
.flyout .flyout-head {
  padding: 6px 10px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   COMMON CHROME ELEMENTS
   ─────────────────────────────────────────────────────────────── */
.search {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  transition: border-color 120ms ease;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  background: #f3f3f3;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-left: auto;
}

.btn-primary {
  background: var(--ink);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 120ms ease;
  border: none;
}
.btn-primary:hover {
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn-ghost:hover {
  background: #f3f3f3;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  border: none;
}

/* Avatar / persona pills (filter row above asset grids) */
.avatar-pill {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 120ms ease;
}
.avatar-pill:hover {
  border-color: var(--line-strong);
}
.avatar-pill.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

/* Categorical chips (status, type) — pastel-tinted, never client-brand */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: "Geist", sans-serif;
}
.chip-draft {
  background: var(--chip-draft-bg);
  color: var(--chip-draft-fg);
}
.chip-ready {
  background: var(--chip-ready-bg);
  color: var(--chip-ready-fg);
}
.chip-review {
  background: var(--chip-review-bg);
  color: var(--chip-review-fg);
}
.chip-published {
  background: var(--chip-published-bg);
  color: var(--chip-published-fg);
}
.chip-archived {
  background: var(--chip-archived-bg);
  color: var(--chip-archived-fg);
}

/* ─────────────────────────────────────────────────────────────────
   FILTER BAR + DROPDOWN MENUS (used above asset grids)
   ─────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-sm);
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-control-sm);
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
  position: relative;
}
.filter-btn:hover {
  background: #f3f3f3;
  border-color: var(--line-strong);
}
.filter-btn.has-value {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(0, 0, 0, 0.2);
  font-weight: 500;
}
.filter-btn .chev {
  width: 11px;
  height: 11px;
  opacity: 0.6;
}
.filter-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}
.filter-results {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
.filter-results .mono-num {
  color: var(--ink);
  font-weight: 500;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-sm);
  box-shadow: var(--shadow-card-hover);
  padding: 4px;
  min-width: 200px;
  z-index: 30;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-control-sm);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 120ms ease;
  text-decoration: none;
}
.menu-item:hover {
  background: #f3f3f3;
}
.menu-item.active {
  color: var(--accent);
}
.menu-item .check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0;
}
.menu-item.active .check {
  opacity: 1;
}
.menu-item .count-tag {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────
   CARDS (all content cards in the dashboard)
   - Radii 24/20 (outer/inner). Padding generous (~26x28).
   - Use minmax(0, 1fr) on grid tracks so columns are pixel-equal.
   - Hover lift via shadow + small translateY.
   ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  min-width: 0;
}
.card.clickable {
  cursor: pointer;
}
.card.clickable:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

/* Hover-meta pill collision guard (locked).
   Cards that pin a tiny mono pill in the top-right corner (e.g. "OPEN ↵"
   or "OPEN ↗") render it position:absolute; top:12px; right:14px; and it
   can be ~110px wide for longer labels ("OPEN INTEL"). Reserve header
   right-padding so a long kicker/title wraps before colliding with the
   pill AND so a right-aligned chip (e.g. a "BATTLE CARD" type chip) does
   not sit underneath it. The component adds .has-hovermeta to the card
   automatically whenever an opts.hoverMeta pill is rendered.
   120px is the LOCKED value (bumped from 96px after the sales-assets
   chip + pill collision). Do not lower it. */
.dash-card.has-hovermeta .dash-card-header {
  padding-right: 120px;
}

/* ─────────────────────────────────────────────────────────────────
   FEED CARDS — shared patterns for LinkedIn-style and YouTube-style
   content cards. Used by social-content, video, case-studies,
   seo-blog, newsletter sections.

   Locked rules (do NOT change):
   - Body text clamped to fixed line count (no variable heights from
     variable text). Min-height reserves space for short content too.
   - Photo uses aspect-ratio (no fixed pixel heights). 1.91:1 is
     LinkedIn-feed standard; 16:9 for video.
   - Reactions/actions row sits flush against photo (no margin-top: auto).
   - Card uses overflow: hidden so nested image clips to card radius.
   ─────────────────────────────────────────────────────────────── */
.feed-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.feed-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

/* Photo container — defaults to LinkedIn 1.91:1; override class for video */
.feed-card-photo {
  aspect-ratio: 1.91 / 1;
  background: linear-gradient(135deg, #f3f3f3 0%, #ececeb 100%);
  box-shadow: inset 0 0 0 1px var(--line);
  position: relative;
  overflow: hidden;
}
.feed-card-photo.aspect-video {
  aspect-ratio: 16 / 9;
}
.feed-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
}
/* Placeholder caption — only used when no real image loads */
.feed-card-photo .placeholder-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.92),
    rgba(255, 255, 255, 0)
  );
}

/* Text clamps — apply these to body/title text inside feed cards.
   The min-height on -3 reserves space even when content is shorter
   than 3 lines (prevents the photo from jumping up). */
.feed-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(3 * 1.5em);
}

/* Action row — sits flush against the photo. NO margin-top: auto.
   Border-top creates the visual separation. */
.feed-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ─────────────────────────────────────────────────────────────────
   DRAWER (right-side slide-over for asset detail)
   ─────────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.32);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 32px -8px rgba(17, 17, 17, 0.16);
}
.drawer.open {
  transform: translateX(0);
}
.drawer-head {
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
}
.drawer-foot {
  padding: 22px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 120ms ease;
  text-decoration: none;
}
.icon-btn:hover {
  background: #f3f3f3;
}

/* ─────────────────────────────────────────────────────────────────
   SCROLLBAR POLISH
   ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
