/* the-vault. Direction: discreet, exact, reassuring. A sealed cellar:
   graphite neutrals, one whisky-amber accent, secret names as mono labels. */

:root {
  --bg: #f6f6f5;
  --surface: #ffffff;
  --raised: #f1f1ef;
  --text: #1c1c1b;
  --text-2: #5c5c59;
  --text-3: #767672;
  --line: rgba(28, 28, 27, 0.09);
  --line-strong: rgba(28, 28, 27, 0.16);
  --accent: #9a4f12;
  --accent-ink: #8a4610;
  --on-accent: #ffffff;
  --primary-bg: var(--accent);
  --primary-fg: var(--on-accent);
  --primary-hover: #84430f;
  --danger: #a63d32;
  --shadow: 0 1px 2px rgba(28, 28, 27, 0.04), 0 4px 16px rgba(28, 28, 27, 0.05);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --fast: 120ms;
  --enter: 240ms;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131313;
    --surface: #1b1b1b;
    --raised: #232322;
    --text: #ededec;
    --text-2: #a8a8a4;
    --text-3: #808079;
    --line: rgba(237, 237, 236, 0.08);
    --line-strong: rgba(237, 237, 236, 0.16);
    --accent: #d48a45;
    --accent-ink: #d9944f;
    --primary-bg: #ebeae7;
    --primary-fg: #161616;
    --primary-hover: #ffffff;
    --danger: #e07a6e;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }

h1 { font-size: 28px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: 16px; line-height: 1.4; font-weight: 500; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 13px; }
.muted { color: var(--text-3); }

.icon { flex: none; display: block; }

a { color: inherit; }

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

/* Bar */

.bar {
  height: 56px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 500;
}

.bar-end { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-2); }
.bar-end form { margin: 0; }
.who { font-family: var(--mono); }
.mode { color: var(--accent-ink); }

/* Page */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
  animation: enter var(--enter) var(--ease) both;
}

@keyframes enter { from { opacity: 0; transform: translateY(4px); } }

.head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; }
.small-head { margin-bottom: 16px; }
.count { color: var(--text-3); font-size: 13px; }

.back { margin-bottom: 16px; }

/* Links and buttons */

.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}
.link:hover { color: var(--text); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.button:active { transform: scale(0.98); }
.button.primary { background: var(--primary-bg); color: var(--primary-fg); }
.button.primary:hover { background: var(--primary-hover); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Sign-in */

.intro {
  min-height: calc(100vh - 56px - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
}

.intro-text { display: grid; gap: 24px; justify-items: start; max-width: 520px; }
.intro h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; }
.lead { color: var(--text-2); font-size: 17px; line-height: 1.55; }

.notice {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-2);
}
.notice .icon { margin-top: 3px; }
.notice-title { color: var(--text); font-weight: 500; margin-bottom: 4px; }

.preview {
  display: grid;
  place-items: center;
  padding: 48px 32px;
  border-radius: 20px;
  background: var(--raised);
}
.preview .receipt { width: 100%; max-width: 420px; }

/* Receipt: the moment after a write */

.receipt {
  display: grid;
  gap: 16px;
  padding: 24px;
  margin-bottom: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.preview .receipt { margin-bottom: 0; }

.receipt-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.receipt-head .seal { transform: rotate(-8deg); }

.receipt-meta {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
  font-size: 13px;
}
.receipt-meta div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.receipt-meta dt { color: var(--text-3); }

.snippet {
  margin: 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--raised);
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
}

/* Signature: secret name label */

.tag {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raised);
  font: 400 13px/20px var(--mono);
  overflow-wrap: anywhere;
}
.tag-prefix { color: var(--text-3); }
.tag-suffix { color: var(--text); }
.tag.lg { padding: 8px 12px; border-radius: 8px; font-size: 17px; line-height: 24px; justify-self: start; }

/* Lists */

.rows { border-top: 1px solid var(--line); }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--fast) var(--ease);
}
.row:hover { background: var(--raised); }
.row .icon { color: var(--text-3); }
.row-main { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.row-title { font-weight: 500; }

.list { display: grid; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list-meta { display: flex; gap: 12px; flex: none; }

.empty { display: grid; gap: 8px; justify-items: start; max-width: 560px; padding: 48px 0; }
.empty-title { font-size: 17px; font-weight: 500; }

.alert {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--danger);
}
.alert .icon { margin-top: 3px; }

/* App page */

.split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.panel > h2 { margin-bottom: 20px; }
.panel.quiet { background: transparent; }

.form { display: grid; gap: 24px; }
.form .button { justify-self: start; }

.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }

.hint { font-size: 13px; color: var(--text-3); }
.hint[data-state="new"] { color: var(--text-2); }
.hint[data-state="update"] { color: var(--accent-ink); }
.hint[data-state="foreign"],
.hint[data-state="invalid"],
.hint[data-state="error"] { color: var(--danger); }

input[type="text"], input[type="password"] {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1 var(--sans);
  transition: border-color var(--fast) var(--ease);
}
input.mono { font-family: var(--mono); font-size: 14px; }
input::placeholder { color: var(--text-3); }
input:focus { outline: none; border-color: var(--accent); }

.name-input {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color var(--fast) var(--ease);
}
.name-input:focus-within { border-color: var(--accent); }
.name-input input { border: 0; border-radius: 0; background: transparent; }
.name-prefix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 12px;
  color: var(--text-3);
  font-size: 14px;
  white-space: nowrap;
  user-select: none;
}
.name-input input { padding-left: 0; }

.secret-input { position: relative; }
.secret-input input { padding-right: 48px; font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em; }
.reveal {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.reveal:hover { background: var(--raised); color: var(--text); }
.reveal .when-shown, .reveal[aria-pressed="true"] .when-hidden { display: none; }
.reveal[aria-pressed="true"] .when-shown { display: block; }

.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--accent); }
[hidden] { display: none !important; }

/* Small screens */

@media (max-width: 860px) {
  .bar { padding: 0 16px; }
  .who { display: none; }
  .page { padding: 24px 16px; }
  .intro { grid-template-columns: 1fr; gap: 40px; min-height: 0; padding-top: 24px; }
  .intro h1 { font-size: 30px; }
  .preview { padding: 24px 16px; }
  .split { grid-template-columns: 1fr; }
  .row { grid-template-columns: minmax(0, 1fr) 16px; }
  .row > .muted { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
