/* Curata — design system.
   Motion personality: Corporate/Premium. Signature easing --e; durations 140/280/520. */

:root {
  --ink: #07080b;
  --ink-1: #0c0e13;
  --ink-2: #12151c;
  --ink-3: #191d26;
  --line: #232833;
  --line-soft: #1a1e27;

  --text: #e9ecf2;
  --text-2: #9aa3b5;
  --text-3: #626b7d;

  --accent: #6d5ef8;
  --accent-2: #8f83ff;
  --mint: #22e6a0;
  --amber: #ffb64d;
  --rose: #ff6b8a;

  --e: cubic-bezier(0.2, 0, 0, 1);
  --e-out: cubic-bezier(0.05, 0.7, 0.1, 1);
  --e-in: cubic-bezier(0.3, 0, 1, 1);
  --t-quick: 140ms;
  --t-std: 280ms;
  --t-slow: 520ms;

  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 15px/1.55 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 8px; border: 3px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: #262c38; }

/* ── ambient layer (third motion layer: background life) ───────────── */
.amb {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.amb i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); opacity: .5;
}
.amb i:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: #3a2fa8; }
.amb i:nth-child(2) { width: 38vw; height: 38vw; right: -10vw; top: 22vh; background: #0e5f4d; opacity: .35; }
.amb i:nth-child(3) { width: 30vw; height: 30vw; left: 32vw; bottom: -16vw; background: #4a2160; opacity: .3; }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── shell ─────────────────────────────────────────────────────────── */
.shell { position: relative; z-index: 2; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.side {
  border-right: 1px solid var(--line-soft);
  background: rgba(9, 10, 14, .72);
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--accent), var(--mint));
  display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #08090c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 18px rgba(109, 94, 248, .35);
}
.brand b { font-size: 16px; letter-spacing: -.03em; font-weight: 650; }
.brand small { display: block; font-size: 10.5px; color: var(--text-3); letter-spacing: .09em; text-transform: uppercase; margin-top: -1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 16px 10px 7px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 500; position: relative;
  transition: color var(--t-quick) var(--e), background var(--t-quick) var(--e);
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: .78; transition: opacity var(--t-quick) var(--e), transform var(--t-quick) var(--e); }
.nav a:hover { color: var(--text); background: var(--ink-2); }
.nav a:hover svg { opacity: 1; transform: translateX(1px); }
.nav a.on { color: #fff; background: var(--ink-3); }
.nav a.on svg { opacity: 1; color: var(--accent-2); }
.nav a.on::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav .badge {
  margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 20px;
  background: var(--ink-3); color: var(--text-2); border: 1px solid var(--line);
}
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ── main / topbar ─────────────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 14px; padding: 16px 30px;
  border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 20;
  background: rgba(7, 8, 11, .78); backdrop-filter: blur(18px);
}
.top h1 { font-size: 19px; }
.top .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.view { padding: 26px 30px 60px; max-width: 1420px; width: 100%; }
.view[hidden] { display: none; }

/* ── controls ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--ink-2); color: var(--text);
  font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background var(--t-quick) var(--e), border-color var(--t-quick) var(--e),
              transform var(--t-quick) var(--e), box-shadow var(--t-quick) var(--e);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--ink-3); border-color: #2c3341; }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #5a4be0); border-color: transparent; color: #fff;
  box-shadow: 0 4px 16px rgba(109, 94, 248, .3);
}
.btn.primary:hover { box-shadow: 0 6px 22px rgba(109, 94, 248, .45); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0) scale(.97); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--ink-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.input, select.input, textarea.input {
  background: var(--ink-1); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; width: 100%; outline: none;
  transition: border-color var(--t-quick) var(--e), box-shadow var(--t-quick) var(--e);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 94, 248, .16); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; font-size: 14.5px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239aa3b5' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--ink-1); color: var(--text-2);
  font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
  transition: all var(--t-quick) var(--e);
}
.chip:hover { border-color: #2f3644; color: var(--text); }
.chip.on { background: rgba(109, 94, 248, .14); border-color: var(--accent); color: #cfc9ff; }
.chip.on::before { content: '✓'; font-size: 10px; }

/* ── cards / layout ────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, rgba(20, 23, 31, .82), rgba(14, 16, 22, .82));
  border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 18px;
  backdrop-filter: blur(10px);
}
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
.sec-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 13px; }
.sec-head h2 { font-size: 15px; letter-spacing: -.01em; }
.sec-head .rule { flex: 1; height: 1px; background: var(--line-soft); }
.muted { color: var(--text-3); font-size: 13px; }

/* stat tiles */
.stat { position: relative; overflow: hidden; }
.stat .k { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.stat .v { font-size: 29px; font-weight: 650; letter-spacing: -.035em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.stat .d b { color: var(--mint); font-weight: 600; }
.stat .spark { position: absolute; right: 14px; bottom: 12px; width: 74px; height: 30px; opacity: .8; }

/* ── trend rows ────────────────────────────────────────────────────── */
.trend {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: center;
  padding: 13px 15px; border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--ink-1); margin-bottom: 8px; cursor: pointer;
  transition: border-color var(--t-quick) var(--e), background var(--t-quick) var(--e), transform var(--t-quick) var(--e);
}
.trend:hover { border-color: #2b3240; background: var(--ink-2); transform: translateX(2px); }
.opp {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; flex: none;
  background: var(--ink-3); border: 1px solid var(--line);
}
.opp.hot { background: rgba(34, 230, 160, .12); border-color: rgba(34, 230, 160, .35); color: var(--mint); }
.opp.warm { background: rgba(255, 182, 77, .1); border-color: rgba(255, 182, 77, .3); color: var(--amber); }
.trend .t { font-size: 14.5px; font-weight: 550; letter-spacing: -.01em; }
.trend .m { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.src {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 650;
  padding: 2px 7px; border-radius: 5px; background: var(--ink-3); color: var(--text-2);
}
.src.github { color: #d7c9ff; } .src.hackernews { color: #ffb083; }
.src.devto { color: #a5c8ff; } .src.npm { color: #ff9aa9; } .src.seed { color: var(--text-3); }

.bar { height: 3px; border-radius: 3px; background: var(--ink-3); overflow: hidden; width: 58px; display: inline-block; vertical-align: middle; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent-2); }

/* ── idea cards ────────────────────────────────────────────────────── */
.idea {
  border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--ink-1);
  padding: 15px; display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  transition: border-color var(--t-std) var(--e), transform var(--t-std) var(--e), box-shadow var(--t-std) var(--e);
}
.idea:hover { border-color: #303849; transform: translateY(-2px); box-shadow: var(--shadow); }
.idea .row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.idea h3 { font-size: 14.5px; line-height: 1.4; font-weight: 550; }
.pf {
  display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px;
  border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--ink-3); flex: none;
}
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line);
  color: var(--text-2); background: var(--ink-2);
}
.tag.educate { color: #a5c8ff; border-color: rgba(165, 200, 255, .25); }
.tag.prove { color: var(--mint); border-color: rgba(34, 230, 160, .25); }
.tag.engage { color: var(--amber); border-color: rgba(255, 182, 77, .25); }
.tag.promote { color: var(--rose); border-color: rgba(255, 107, 138, .25); }
.idea .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ── calendar ──────────────────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-h { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); font-weight: 650; padding: 0 4px 6px; }
.day {
  min-height: 132px; border: 1px solid var(--line-soft); border-radius: 12px;
  background: var(--ink-1); padding: 9px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color var(--t-quick) var(--e);
}
.day.today { border-color: rgba(109, 94, 248, .45); background: rgba(109, 94, 248, .05); }
.day.weekend { background: rgba(12, 14, 19, .6); }
.day .dn { font-size: 12px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.day.today .dn { color: var(--accent-2); }
.slot {
  border-radius: 8px; padding: 7px 8px; background: var(--ink-2); border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent); cursor: pointer; font-size: 11.5px; line-height: 1.35;
  transition: background var(--t-quick) var(--e), transform var(--t-quick) var(--e);
}
.slot:hover { background: var(--ink-3); transform: translateX(2px); }
.slot .st { display: flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.slot .sb { margin-top: 3px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slot.posted { border-left-color: var(--mint); opacity: .65; }

/* ── composer ──────────────────────────────────────────────────────── */
.preview {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-1); padding: 16px;
  white-space: pre-wrap; font-size: 14.5px; line-height: 1.62; min-height: 200px;
}
.meter { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.meter .track { flex: 1; height: 4px; border-radius: 4px; background: var(--ink-3); overflow: hidden; }
.meter .track i { display: block; height: 100%; background: var(--mint); border-radius: 4px; transition: width var(--t-std) var(--e), background var(--t-std) var(--e); }
.meter.over .track i { background: var(--rose); }

/* ── misc ──────────────────────────────────────────────────────────── */
.pill-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(34, 230, 160, .6); animation: pulse 2.4s var(--e) infinite; }
.dot.warn { background: var(--amber); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,230,160,.5); } 70% { box-shadow: 0 0 0 7px rgba(34,230,160,0); } 100% { box-shadow: 0 0 0 0 rgba(34,230,160,0); } }

.empty { text-align: center; padding: 54px 20px; color: var(--text-3); }
.empty svg { width: 34px; height: 34px; opacity: .3; margin-bottom: 10px; }

.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 11px; padding: 10px 15px;
  font-size: 13.5px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px;
}
.toast .dot { background: var(--accent-2); animation: none; }
.toast.ok .dot { background: var(--mint); }
.toast.err .dot { background: var(--rose); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(3, 4, 6, .62); backdrop-filter: blur(3px); z-index: 90; opacity: 0; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); z-index: 100;
  background: var(--ink-1); border-left: 1px solid var(--line); display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
}
.drawer-h { padding: 18px 22px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; }
.drawer-b { padding: 20px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.drawer-f { padding: 14px 22px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; }

/* loading skeleton */
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--ink-2) 25%, var(--ink-3) 50%, var(--ink-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* heatmap */
.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 10px; }
.heat .hl { color: var(--text-3); display: grid; place-items: center; font-weight: 600; }
.heat .hc { aspect-ratio: 1; border-radius: 3px; background: var(--ink-2); transition: transform var(--t-quick) var(--e); }
.heat .hc:hover { transform: scale(1.35); z-index: 2; position: relative; }

@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 244px; z-index: 80; transform: translateX(-100%); transition: transform var(--t-std) var(--e); }
  .side.open { transform: none; }
  .view, .top { padding-left: 16px; padding-right: 16px; }
  .g-3, .g-2, .g-4 { grid-template-columns: 1fr; }
  .cal { grid-template-columns: repeat(2, 1fr); }
  .cal-h { display: none; }

  /* The topbar subtitle collapses into a tall column at this width and shoves
     the actions off-screen — drop it and let the actions take their own row. */
  .top { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; gap: 10px; }
  .top .sub { display: none; }
  .top h1 { font-size: 17px; white-space: nowrap; }
  .top-actions { margin-left: auto; width: 100%; gap: 8px; }
  .top-actions #nicheSel { flex: 1; min-width: 0; }
  .top-actions .btn { flex: none; }
  #btnRefresh span, #btnRefresh { font-size: 12.5px; }

  /* Trend/queue rows: two columns, action drops beneath the text. */
  .trend { grid-template-columns: 38px 1fr; gap: 10px; padding: 12px; }
  .trend > :last-child { grid-column: 1 / -1; justify-self: start; }
  .trend .m { gap: 8px; font-size: 11.5px; }

  .drawer { width: 100%; }
  .heat { grid-template-columns: 26px repeat(24, 1fr); gap: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
