/* Journal: dark, quiet, legible. */

* { box-sizing: border-box; }

:root {
  --bg: #0e0f12;
  --panel: #15171c;
  --panel-2: #1b1e25;
  --line: #262a33;
  --text: #d8d2c4;
  --muted: #8a877e;
  --accent: #9fb18a;
  --accent-2: #b89b6a;
  --danger: #a65c5c;
  --good: #7fa884;
  --bad: #a67c5c;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.55 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85em; }
.spacer { flex: 1; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
input:focus, select:focus, textarea:focus, .body:focus { outline: 1px solid var(--accent); outline-offset: 0; }
select option { background: #1b1e25; }
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 14px; cursor: pointer; color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: #2b3a2a; border-color: #3a5038; }
.btn.danger { border-color: #4a2e2e; color: #d6a2a2; }
.btn.small { padding: 4px 10px; font-size: 0.9em; }

/* ---- splash ---- */
.splash {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: opacity 0.6s ease 0.5s;
}
.splash .wash {
  position: absolute; inset: -20%;
  background:
    radial-gradient(40% 50% at 30% 40%, rgba(92,110,80,0.35), transparent 70%),
    radial-gradient(35% 45% at 70% 60%, rgba(120,98,70,0.30), transparent 70%),
    radial-gradient(30% 40% at 55% 25%, rgba(70,90,120,0.25), transparent 70%);
  filter: blur(60px);
  animation: wash 60s ease-in-out infinite alternate;
}
@keyframes wash {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(4%, -3%) scale(1.08); }
  100% { transform: translate(-3%, 4%) scale(1.02); }
}
.particle-canvas { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.8s ease; }
.splash-word {
  position: relative; font-size: clamp(2.6em, 9vw, 6em); letter-spacing: 0.04em;
  color: var(--text); opacity: 0; animation: fadein 2.2s ease 0.3s forwards;
  user-select: none; pointer-events: none;
  transition: transform 0.9s cubic-bezier(.4,.1,.2,1), opacity 0.9s ease;
}
@keyframes fadein { to { opacity: 1; } }
.splash-hint {
  position: absolute; bottom: 10vh; color: var(--muted); font-size: 0.9em; opacity: 0;
  animation: fadein 1.5s ease 2.2s forwards; pointer-events: none;
}
.splash.go { pointer-events: none; opacity: 0; }
.splash.go .particle-canvas, .splash.go .splash-hint { opacity: 0; }
.splash.go .splash-word { transform: translate(var(--dx, 0), var(--dy, -40vh)) scale(var(--ds, 0.3)); opacity: 0; }

/* ---- header ---- */
.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 1.35em; font-weight: normal; letter-spacing: 0.04em; opacity: 0; transition: opacity 0.6s ease; }
.brand h1.in { opacity: 1; }
.logo { width: 30px; height: 30px; fill: none; stroke: var(--text); stroke-width: 3; }
.search { flex: 1; min-width: 0; max-width: 520px; }
.status { font-size: 0.8em; color: var(--muted); white-space: nowrap; }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 8px; background: #555; vertical-align: middle; }
.status .dot.on { background: var(--good); }

/* ---- layout ---- */
.main {
  display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px;
  padding: 16px; max-width: 1400px; margin: 0 auto;
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 1.05em; font-weight: normal; letter-spacing: 0.03em; color: var(--accent-2); }

/* ---- feed ---- */
.feed { position: sticky; top: 66px; align-self: start; max-height: calc(100vh - 82px); display: flex; flex-direction: column; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.filters select, .filters input { min-width: 0; font-size: 0.9em; padding: 5px 8px; }
.cards { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
}
.card:hover { border-color: #3a4150; }
.card.active { border-color: var(--accent); }
.card .c-title { font-size: 1em; }
.card .c-meta { grid-column: 1 / -1; color: var(--muted); font-size: 0.8em; display: flex; gap: 8px; flex-wrap: wrap; }
.card .c-excerpt { grid-column: 1 / -1; color: #b7b1a4; font-size: 0.88em; line-height: 1.4; max-height: 3.9em; overflow: hidden; }
.card .c-thumb { grid-row: 1 / span 2; width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.card .c-reading { grid-column: 1 / -1; font-size: 0.8em; color: var(--accent); }
.tag { display: inline-block; background: #22272f; border-radius: 10px; padding: 0 8px; font-size: 0.85em; color: #a9b7a1; }
.empty { color: var(--muted); font-style: italic; padding: 20px; text-align: center; }

/* ---- editor ---- */
.work { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.editor .meta-row { display: flex; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.editor .title { width: 100%; font-size: 1.3em; margin-bottom: 8px; background: transparent; border-color: transparent; border-bottom-color: var(--line); border-radius: 0; padding-left: 2px; }
.editor .row { display: flex; gap: 6px; flex-wrap: wrap; }
.editor .row select { flex: 0 0 auto; }
.editor .row #e-type { flex: 1 1 120px; min-width: 100px; }
.editor .row #e-tags { flex: 2 1 200px; min-width: 140px; }
.tag-suggest { display: flex; gap: 6px; flex-wrap: wrap; min-height: 6px; margin: 6px 0; }
.tag-suggest .tag { cursor: pointer; }
.tag-suggest .tag:hover { background: #2b3a2a; }
.toolbar { display: flex; gap: 4px; align-items: center; margin: 6px 0 4px; }
.toolbar button { background: transparent; border: 1px solid transparent; border-radius: 4px; width: 30px; height: 28px; cursor: pointer; color: var(--text); }
.toolbar button:hover { border-color: var(--line); background: var(--panel-2); }
.body {
  min-height: 220px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.body:empty::before { content: attr(data-placeholder); color: var(--muted); }
.body.drag { border-color: var(--accent); }
.body h1, .body h2, .body h3 { font-weight: normal; margin: 0.6em 0 0.3em; color: var(--accent-2); }
.body h2 { font-size: 1.2em; }
.body p { margin: 0 0 0.7em; }
.body ul, .body ol { margin: 0 0 0.7em; padding-left: 1.4em; }
.body a { color: var(--accent); }
.intake { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.intake-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 0.9em; }
.intake-row #e-url { flex: 1 1 200px; min-width: 160px; }
.original img { max-width: 100%; max-height: 320px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.original .fname { color: var(--muted); font-size: 0.8em; margin-top: 4px; }
.transcript textarea { width: 100%; resize: vertical; font-family: inherit; }
.transcript-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; margin-top: 12px; align-items: center; }

/* ---- mirror ---- */
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 70px; align-items: end; margin-bottom: 10px; }
.bar { background: #2a3140; border-radius: 3px 3px 0 0; position: relative; min-height: 2px; }
.bar::after { content: attr(data-short); position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: 0.65em; color: var(--muted); padding-top: 3px; }
.bar.hi { background: var(--accent); }
.bars-wrap { padding-bottom: 18px; }
.lens-block { margin: 10px 0; }
.lens-block h3 { margin: 0 0 4px; font-size: 0.95em; font-weight: normal; color: var(--text); }
.reading { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; font-size: 0.92em; flex-wrap: wrap; }
.reading .fam { color: var(--muted); font-size: 0.85em; }
.reading .dist { color: var(--muted); font-size: 0.8em; margin-left: auto; }
.dim { border-top: 1px solid var(--line); padding: 8px 0; }
.dim .dim-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.dim .dim-name { color: var(--accent-2); }
.dim .dim-val { color: var(--muted); font-size: 0.85em; }
.dim .dim-sent { margin: 4px 0; }
.dim .cites { color: var(--muted); font-size: 0.85em; font-style: italic; }
.marks { display: inline-flex; gap: 4px; margin-left: auto; align-items: center; }
.marks button { background: transparent; border: 1px solid var(--line); border-radius: 4px; width: 26px; height: 24px; cursor: pointer; color: var(--muted); font-size: 0.85em; }
.marks button.on.yes { border-color: var(--good); color: var(--good); }
.marks button.on.no { border-color: var(--bad); color: var(--bad); }
.marks button.on.note { border-color: var(--accent-2); color: var(--accent-2); }
.note-text { color: var(--muted); font-size: 0.85em; margin-top: 3px; white-space: pre-wrap; }

/* ---- guide ---- */
.proposal { border-top: 1px solid var(--line); padding: 10px 0; }
.proposal .p-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.proposal .p-name { color: var(--accent-2); }
.proposal .p-trad { color: var(--muted); font-size: 0.85em; }
.proposal blockquote { margin: 6px 0; padding-left: 10px; border-left: 2px solid var(--line); color: #b7b1a4; font-style: italic; }
.proposal .p-why { font-size: 0.9em; }
.proposal .p-sugg { margin-top: 6px; color: var(--accent); }
.proposal .p-src { color: var(--muted); font-size: 0.8em; }

/* ---- phone ---- */
@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; padding: 16px; }
  .feed { position: static; max-height: none; }
  .cards { max-height: 46vh; }
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .status { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .bars { height: 54px; }
}

/* ---- sign-in (public name only) ---- */
.signin { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; }
.signin .logo.big { width: 64px; height: 64px; }
.signin-word { font-size: 2em; letter-spacing: 0.04em; }
