/* ══════════════════════════════════════════
   Signal Archive — style.css
   ══════════════════════════════════════════ */

/* ── THEME VARIABLES (aligned with Signal Tasks) ── */
:root, [data-theme="light"] {
  --bg:      #f4f1eb;
  --bg2:     #ece8de;
  --bg3:     #e2dcd2;
  --bg4:     #d2c9bb;
  --ink:     #1c1a16;
  --ink2:    #3a3028;
  --ink3:    #6a5e50;
  --ink4:    #8a7e70;
  --ink5:    #b8ae9e;
  --rule:    #ccc3b4;
  --rule2:   #ddd7cd;
  --paper:   #faf8f4;

  --accent:  #b85c2a;
  --accent2: rgba(184, 92, 42, 0.09);

  /* category accent colors */
  --green:   #2a6b45;
  --blue:    #2a4e7a;
  --purple:  #5a3a7a;
  --gold:    #8a6a1a;

  --input-bg:  #ece8de;
  --card-bg:   #f4f1eb;
  --shadow:    0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
  --noise-opacity: 0.55;
}

[data-theme="dark"] {
  --bg:      #141210;
  --bg2:     #1c1916;
  --bg3:     #242018;
  --bg4:     #2e2920;
  --ink:     #e2dbd0;
  --ink2:    #b8ae9e;
  --ink3:    #857870;
  --ink4:    #5a5248;
  --ink5:    #302c28;
  --rule:    #302c28;
  --rule2:   #242018;
  --paper:   #1c1916;

  --accent:  #d47a3e;
  --accent2: rgba(212, 122, 62, 0.10);

  /* category accent colors — lighter for dark bg contrast */
  --green:   #5ea870;
  --blue:    #6a94c8;
  --purple:  #9a7ac8;
  --gold:    #c8a840;

  --input-bg:  #1c1916;
  --card-bg:   #141210;
  --shadow:    0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.2);
  --noise-opacity: 0.22;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* noise texture overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: var(--noise-opacity);
  transition: opacity 0.3s;
}

/* scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink5); }

/* ── LAYOUT ── */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: background 0.3s, border-color 0.3s;
}

.sidebar-head {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.brand {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.15rem;
}
.brand em { font-style: italic; color: var(--accent); }
.brand-sub {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink4);
}

/* theme toggle — same as tasks */
.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.7rem;
}
.mode-lbl {
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink4);
}
.mode-btn {
  width: 32px;
  height: 18px;
  background: var(--rule);
  border-radius: 9px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}
.mode-btn::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--ink4);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.25s, background 0.25s;
}
[data-theme="dark"] .mode-btn::after { transform: translateX(14px); background: var(--accent); }
[data-theme="dark"] .mode-btn { background: var(--ink5); }

/* ── SIDEBAR SEARCH ── */
.search-wrap {
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--rule2);
  border-radius: 2px;
  padding: 0.28rem 0.6rem;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--ink2);
  outline: none;
  transition: border-color 0.2s;
}
.search-input::placeholder { color: var(--ink5); }
.search-input:focus { border-color: var(--ink4); }

/* ── SIDEBAR NAV ── */
.sidebar-nav {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.nav-lbl {
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink4);
  padding: 0.3rem 1.2rem 0.2rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 1.2rem;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: 0.03em;
  transition: background 0.12s, color 0.12s;
  user-select: none;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--bg3); color: var(--ink2); }
.nav-item.active { background: var(--bg3); color: var(--ink); border-left-color: var(--accent); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  font-size: 8px;
  color: var(--ink4);
  background: var(--bg4);
  padding: 0 0.35rem;
  border-radius: 2px;
  min-width: 16px;
  text-align: center;
}
.nav-item.active .nav-count { background: var(--bg4); color: var(--ink3); }

/* ── SIDEBAR STATS ── */
.sidebar-stats {
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--ink3);
  margin-bottom: 0.2rem;
}
.stat-val { color: var(--ink2); font-weight: 500; }

.activity-wrap { margin-top: 0.6rem; }
.activity-lbl {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 0.35rem;
}
.activity-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 22px;
}
.act-bar {
  flex: 1;
  background: var(--rule);
  border-radius: 1px;
  min-height: 2px;
  transition: background 0.3s;
}

/* ── SIDEBAR EXPORT ── */
.sidebar-export {
  padding: 0.7rem 1.2rem;
  margin-top: auto;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-shrink: 0;
}
.exp-btn {
  display: block;
  width: 100%;
  padding: 0.28rem 0.6rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink3);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, color 0.12s;
}
.exp-btn:hover { border-color: var(--ink4); color: var(--ink2); }

/* ── MAIN AREA ── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
}

/* ── COMPOSE ── */
.compose {
  background: var(--bg2);
  border-bottom: 1px solid var(--rule);
  padding: 1.2rem 1.6rem;
  transition: background 0.3s;
  flex-shrink: 0;
}
.compose-title-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink);
  outline: none;
  padding: 0.2rem 0;
  margin-bottom: 0.7rem;
  transition: border-color 0.2s;
}
.compose-title-input::placeholder { color: var(--ink5); font-style: italic; }
.compose-title-input:focus { border-bottom-color: var(--ink4); }

.compose-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

/* category select — matches tasks' meta-select */
.cat-select {
  appearance: none;
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.18rem 1.4rem 0.18rem 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink2);
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 0l3.5 4L7 0z' fill='%236a5e50'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  transition: border-color 0.12s;
}
.cat-select:focus, .cat-select:hover { border-color: var(--ink4); }

/* signal strength */
.signal-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink4);
}
.signal-btns { display: flex; gap: 3px; }
.signal-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  color: var(--ink4);
  transition: all 0.12s;
}
.signal-btn:hover { border-color: var(--ink4); color: var(--ink3); }
.signal-btn.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.compose-body {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  resize: none;
  line-height: 1.8;
  min-height: 72px;
  padding: 0.3rem 0;
  transition: border-color 0.2s;
}
.compose-body::placeholder { color: var(--ink5); }
.compose-body:focus { border-bottom-color: var(--ink4); }

.compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.7rem;
}
.compose-foot-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.char-count { font-size: 8px; color: var(--ink5); letter-spacing: 0.04em; }
.kbd-hint { font-size: 8px; color: var(--ink5); letter-spacing: 0.04em; }

.submit-btn {
  padding: 0.28rem 1rem;
  background: var(--ink);
  border: none;
  border-radius: 2px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  cursor: pointer;
  transition: opacity 0.15s;
}
.submit-btn:hover { opacity: 0.8; }
.submit-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.submit-btn.editing { background: var(--accent); }

/* ── ENTRIES HEADER ── */
.entries-head {
  padding: 0.7rem 1.6rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
  gap: 1rem;
}
.entries-label {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink4);
  flex: 1;
}

/* sort select — same style as tasks */
.sort-select {
  appearance: none;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.18rem 1.4rem 0.18rem 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--ink3);
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 0l3.5 4L7 0z' fill='%236a5e50'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  transition: border-color 0.12s;
}
.sort-select:hover, .sort-select:focus { border-color: var(--ink4); color: var(--ink2); }

/* ── ENTRIES LIST ── */
.entries-list { flex: 1; }

.empty-state {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--ink4);
  font-size: 11px;
}
.empty-state .empty-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--ink3);
  margin-bottom: 0.4rem;
}

/* ── ENTRY CARDS ── */
.entry-card {
  padding: 1.1rem 1.6rem;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s;
  position: relative;
  cursor: default;
}
.entry-card:hover { background: var(--bg2); }
.entry-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.entry-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}
.entry-title {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.3;
  flex: 1;
  color: var(--ink);
}

/* entry action buttons — revealed on hover */
.entry-actions {
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 0.12s;
  flex-shrink: 0;
  align-items: flex-start;
}
.entry-card:hover .entry-actions { opacity: 1; }
.entry-action-btn {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.12rem 0.4rem;
  font-size: 9px;
  color: var(--ink3);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.04em;
  transition: all 0.12s;
}
.entry-action-btn:hover { border-color: var(--ink4); color: var(--ink2); }
.entry-action-btn.del:hover { border-color: var(--blocked); color: var(--blocked); }
.entry-action-btn.confirm-del {
  border-color: var(--blocked);
  color: var(--blocked);
  animation: pulse-border 0.35s ease;
}

/* reuse blocked color for danger */
:root,[data-theme="light"] { --blocked: #8a3a2a; }
[data-theme="dark"]         { --blocked: #c04840; }

@keyframes pulse-border {
  0%   { box-shadow: 0 0 0 0 rgba(138, 58, 42, 0.3); }
  100% { box-shadow: 0 0 0 4px rgba(138, 58, 42, 0); }
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.entry-tag {
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.05rem 0.4rem;
  border-radius: 1px;
  font-weight: 500;
}
.entry-date {
  font-size: 8px;
  color: var(--ink4);
  letter-spacing: 0.04em;
}
.entry-edited {
  font-size: 8px;
  color: var(--ink5);
  letter-spacing: 0.04em;
  font-style: italic;
}
.entry-signal {
  display: flex;
  gap: 3px;
  margin-left: auto;
}
.signal-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--rule);
}
.signal-pip.filled { border-color: transparent; }

.entry-body {
  font-size: 11px;
  color: var(--ink2);
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}
.entry-body.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.expand-btn {
  background: none;
  border: none;
  font-family: 'DM Mono', monospace;
  font-size: 8px;
  color: var(--ink4);
  cursor: pointer;
  padding: 0;
  margin-top: 0.3rem;
  letter-spacing: 0.06em;
  display: block;
  transition: color 0.12s;
}
.expand-btn:hover { color: var(--ink3); }

/* ── CATEGORY COLORS ── */
/* dot colors */
.dot-observation { background: var(--accent); }
.dot-hypothesis  { background: var(--green); }
.dot-discovery   { background: var(--blue); }
.dot-anomaly     { background: var(--purple); }
.dot-question    { background: var(--gold); }

/* left border stripe */
.card-observation::before { background: var(--accent); }
.card-hypothesis::before  { background: var(--green); }
.card-discovery::before   { background: var(--blue); }
.card-anomaly::before     { background: var(--purple); }
.card-question::before    { background: var(--gold); }

/* category tag chips */
.tag-observation { background: rgba(184,92,42,0.10);  color: var(--accent); }
.tag-hypothesis  { background: rgba(42,107,69,0.10);  color: var(--green); }
.tag-discovery   { background: rgba(42,78,122,0.10);  color: var(--blue); }
.tag-anomaly     { background: rgba(90,58,122,0.10);  color: var(--purple); }
.tag-question    { background: rgba(138,106,26,0.10); color: var(--gold); }

/* signal pip fills */
.pip-observation { background: var(--accent); }
.pip-hypothesis  { background: var(--green); }
.pip-discovery   { background: var(--blue); }
.pip-anomaly     { background: var(--purple); }
.pip-question    { background: var(--gold); }

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 0.4rem 1rem;
  border-radius: 2px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .compose { padding: 1rem 1.2rem; }
  .entry-card { padding: 0.9rem 1.2rem; }
  .entries-head { padding: 0.6rem 1.2rem; }
}
