/* Vault — deep indigo ground, brass for anything you own or lock,
   monospace for anything you will paste somewhere else. */

:root {
  --ink:       #0E1117;
  --ink-2:     #151A23;
  --ink-3:     #1B212D;
  --ink-4:     #222A38;
  --line:      #29323F;
  --line-soft: #1F2732;
  --paper:     #E4E8F0;
  --muted:     #8892A6;
  --faint:     #5D677A;
  --brass:     #E2A73E;
  --brass-dim: #8A6A2A;
  --seal:      #7C6BE0;
  --danger:    #E5484D;
  --ok:        #3DD68C;

  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r: 10px;
  --pad: 16px;
  --bar-h: 3px;
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body.is-locked { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden { display: none !important; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ------------------------------------------------------------- app shell */

.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--pad);
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper);
  white-space: nowrap;
}

.wordmark .shackle {
  width: 3px;
  height: 18px;
  background: var(--brass);
  border-radius: 2px;
  box-shadow: 0 0 10px -1px var(--brass);
}

.spacer { flex: 1; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--ink-3); color: var(--paper); }
.icon-btn svg { width: 18px; height: 18px; }

/* search */

.search-row {
  padding: 0 var(--pad) 10px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  gap: 8px;
}

.search-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.search-field svg {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px 10px 34px;
  font-size: 16px; /* keeps iOS from zooming on focus */
  color: var(--paper);
}
.search-field input::placeholder { color: var(--faint); }
.search-field input:focus {
  outline: none;
  border-color: var(--brass-dim);
  background: var(--ink-3);
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: var(--r);
  background: var(--brass);
  color: #241A05;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.btn-new:hover { background: #F0B754; }
.btn-new svg { width: 15px; height: 15px; }

/* folder + status chips */

.chips {
  display: flex;
  gap: 6px;
  padding: 0 var(--pad) 10px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.chip:hover { color: var(--paper); border-color: var(--ink-4); }
.chip[aria-pressed="true"] {
  color: var(--paper);
  border-color: var(--brass-dim);
  background: color-mix(in srgb, var(--brass) 12%, var(--ink-2));
}
.chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.chip .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.chip[aria-pressed="true"] .count { color: var(--brass); }

/* ------------------------------------------------------------------ list */

.list {
  flex: 1;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  padding: 4px var(--pad) 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px 12px 12px 15px;
  overflow: hidden;
  transition: border-color 0.12s, background 0.12s;
}
.card:hover { border-color: var(--line); background: var(--ink-3); }

/* the signature: a source-coded edge. solid = a link, hatched = a secret. */
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--bar-h);
  background: var(--edge, var(--faint));
}
.card.is-secret::before {
  background: repeating-linear-gradient(
    180deg,
    var(--brass) 0 5px,
    transparent 5px 9px
  );
}

.card-main { min-width: 0; cursor: pointer; }

.card-title {
  font-size: 15px;
  font-weight: 550;
  line-height: 1.3;
  color: var(--paper);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 12px;
  color: var(--faint);
}
.card-sub .src {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--edge, var(--muted));
}
.card-sub .sep { color: var(--line); }

.status-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.status-tag[data-status="later"]   { color: var(--brass); border-color: var(--brass-dim); }
.status-tag[data-status="doing"]   { color: var(--seal);  border-color: #4A3E8F; }
.status-tag[data-status="done"]    { color: var(--ok);    border-color: #24614A; }
.status-tag[data-status="archived"]{ color: var(--faint); }

.card-excerpt {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-size {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brass-dim);
  letter-spacing: 0.06em;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.act {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--faint);
  transition: background 0.12s, color 0.12s;
}
.act:hover { background: var(--ink-4); color: var(--paper); }
.act svg { width: 16px; height: 16px; }
.act.star-on { color: var(--brass); }
.act.copied { color: var(--ok); }

/* decrypt-wipe: the list reveals as the notes actually decrypt */
@keyframes unseal {
  from { opacity: 0; transform: translateY(4px); clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; transform: none;            clip-path: inset(0 0 0 0); }
}
.card.unsealing {
  animation: unseal 0.34s cubic-bezier(0.22, 0.7, 0.3, 1) backwards;
}

.empty {
  margin: 48px auto;
  max-width: 380px;
  text-align: center;
  color: var(--muted);
}
.empty h2 { font-size: 16px; font-weight: 550; color: var(--paper); margin: 0 0 6px; }
.empty p { margin: 0; font-size: 14px; line-height: 1.5; }

.index-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  padding: 6px 0;
}

/* ----------------------------------------------------------------- sheet */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 720px) { .scrim { align-items: center; } }

.sheet {
  width: 100%;
  max-width: 720px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 720px) { .sheet { border-radius: 14px; max-height: 86dvh; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.sheet-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--ink-2);
  flex: none;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label,
.field-head label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}
.field .hint { font-size: 12px; color: var(--faint); line-height: 1.4; }

.input, .textarea, .select {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 16px;
  color: var(--paper);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brass-dim);
}
.textarea {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  min-height: 160px;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.textarea.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.select { appearance: none; background-image: none; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mini {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.mini:hover { color: var(--paper); border-color: var(--ink-4); }
.mini.on { color: var(--brass); border-color: var(--brass-dim); }

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 550;
  border: 1px solid var(--line);
  background: var(--ink-3);
  color: var(--paper);
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--ink-4); }
.btn-primary {
  background: var(--brass);
  border-color: var(--brass);
  color: #241A05;
}
.btn-primary:hover { background: #F0B754; border-color: #F0B754; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-danger { color: var(--danger); border-color: #5A2226; background: transparent; }
.btn-danger:hover { background: #2A1418; }
.btn-wide { flex: 1; }

/* secret field */

.secret-wrap { position: relative; display: flex; gap: 8px; align-items: stretch; }
.secret-wrap .input { flex: 1; font-family: var(--mono); letter-spacing: 0.04em; }
.redacted {
  -webkit-text-security: disc;
  text-security: disc;
}

/* --------------------------------------------------------------- lock UI */

.lockscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--ink);
  display: grid;
  place-items: center;
  padding: var(--pad);
}

.lock-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lock-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.lock-mark .shackle {
  width: 4px;
  height: 22px;
  background: var(--brass);
  border-radius: 2px;
  box-shadow: 0 0 14px -2px var(--brass);
}

.lock-lede {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.notice {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--muted);
}
.notice.warn { border-color: var(--brass-dim); color: #E9C580; background: #1E1809; }
.notice.bad  { border-color: #5A2226; color: #F0A0A3; background: #1F1113; }
.notice.good { border-color: #24614A; color: #8FE3BB; background: #0E1D17; }
.notice strong { color: inherit; font-weight: 600; }

.meter { display: flex; gap: 4px; height: 3px; }
.meter i {
  flex: 1;
  background: var(--ink-4);
  border-radius: 2px;
  transition: background 0.2s;
}
.meter i.on { background: var(--brass); }
.meter i.on.strong { background: var(--ok); }

/* ----------------------------------------------------------------- toast */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}
.toast {
  background: var(--ink-4);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: rise 0.2s ease backwards;
}
.toast.bad { border-color: #5A2226; color: #F0A0A3; }
.toast.good { border-color: #24614A; color: #8FE3BB; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------- settings bits */

.setting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.setting:last-child { border-bottom: none; }
.setting h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.setting p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.setting .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.code-block {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  word-break: break-all;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--brass);
  user-select: all;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* small utilities, so no element needs a style attribute the CSP would block */
.checkline {
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}
.block-gap { display: block; margin-top: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.inline-row { display: flex; gap: 6px; }
.flush { margin: 0; }
.grow { flex: 1; }

/* paste affordance sitting inside an input */
.in-field-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--faint);
  transition: background 0.12s, color 0.12s;
}
.in-field-btn:hover { background: var(--ink-4); color: var(--paper); }
.in-field-btn svg { width: 16px; height: 16px; }
.search-field input { padding-right: 40px; }

/* a field-head carrying only a label should not stretch it */
.field-head label { flex: none; }

/* quiet status line beside a field label */
.field-note {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--faint);
  align-self: center;
  white-space: nowrap;
}
