/* Clarity Atlas web reader — brand palette, read-only, no inline styles
   (the CSP forbids them). Dark near-black + gold, matching the app. */

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e222b;
  --ink: #f7f7f5;
  --muted: #9aa1ac;
  --gold: #8a6e33;
  --gold-lite: #c8a15a;
  --line: #2a2f3a;
  --warn: #e0b341;
  --err: #ef6b6b;
  --radius: 12px;
  --maxw: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#app {
  min-height: 100%;
}

/* ---- centered cards (link / unlock) ---- */

.card {
  max-width: 560px;
  margin: 8vh auto;
  padding: 32px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 26px;
  margin: 0 0 12px;
}

.lede {
  color: var(--muted);
  margin: 0 0 20px;
}

.steps {
  color: var(--ink);
  padding-left: 20px;
  margin: 0 0 22px;
}
.steps li {
  margin: 6px 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 13px 14px;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
input[type='text'] {
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
input:focus {
  outline: 2px solid var(--gold-lite);
  border-color: transparent;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

button.primary {
  background: var(--gold);
  color: #fff;
  border: none;
  padding: 12px 18px;
  font-size: 16px;
  border-radius: 10px;
  cursor: pointer;
}
button.primary:hover {
  background: var(--gold-lite);
}
button.primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 0;
}
.foot {
  color: var(--muted);
  font-size: 13px;
  margin: 22px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.error {
  color: var(--err);
  font-size: 14px;
  margin: 0;
  min-height: 1.2em;
}
.linklike {
  color: var(--gold-lite);
  cursor: pointer;
  text-decoration: underline;
}

/* ---- reader ---- */

.reader {
  max-width: var(--maxw);
  margin: 0 auto;
  /* Fixed to the viewport (not min-height): the page itself never scrolls —
   * the note list and the note view each scroll on their own. */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.bar .brand {
  font-family: Georgia, serif;
  letter-spacing: 0.12em;
  font-size: 15px;
}
.bar .spacer {
  flex: 1;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
button.ghost:hover {
  color: var(--ink);
  border-color: var(--gold);
}

.banner {
  margin: 0;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.banner.warn {
  color: var(--warn);
}

.panes {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}
.notelist {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Pinned filter: fixed at the top of the pane; only the items below scroll. */
.notesearch {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}
.notesearch input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.notesearch input:focus {
  outline: 2px solid var(--gold-lite);
  border-color: transparent;
}

.noteitems {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
  min-height: 0;
}
.noteitem {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 15px;
}
.noteitem:hover {
  background: var(--panel2);
}
.noteitem.active {
  background: var(--panel2);
  box-shadow: inset 3px 0 0 var(--gold);
}

.noteview {
  padding: 24px 28px;
  overflow-y: auto;
  max-width: 720px;
}
.noteview h2 {
  font-family: Georgia, serif;
  margin: 0 0 14px;
}
.noteview .body {
  color: #e6e8ec;
  word-wrap: break-word;
}
.noteview .body a {
  color: var(--gold-lite);
}
.noteview .body mark {
  background: #4a3b18;
  color: #ffe6ad;
}
.empty,
.loading {
  color: var(--muted);
}

/* ---- attachments (V2: decrypted in-browser, shown via blob: URLs) ---- */

.attach-photo {
  margin: 14px 0;
}
.attach-photo img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.attach-audio,
.attach-file {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.attach-name {
  color: var(--ink);
  font-size: 14px;
  word-break: break-all;
}
.attach-audio audio {
  flex: 1;
  min-width: 200px;
  height: 36px;
}
.noteview .hint {
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0 0;
}

@media (max-width: 720px) {
  .panes {
    grid-template-columns: 1fr;
  }
  .notelist {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 38vh;
  }
}
