/* Night Valley (DESIGN.md). Dark by default, light follows the OS. */

@font-face { font-family: "Albert Sans"; font-weight: 300; font-display: swap; src: url(fonts/albert-sans-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: "Albert Sans"; font-weight: 400; font-display: swap; src: url(fonts/albert-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Albert Sans"; font-weight: 600; font-display: swap; src: url(fonts/albert-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Gloock"; font-weight: 400; font-display: swap; src: url(fonts/gloock-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }

:root {
  --ground: #0c0b0a; --raised: #15130f; --raised-2: #1d1a16;
  --line: #2a2621; --line-strong: #716a5e;
  --text: #eee6d8; --text-2: #b6ac9c; --text-3: #8f8676;
  --ember: #f0603a; --on-ember: #1a0a05; --moss: #a3b18a; --danger: #f0603a;
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --lh: 1.5;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #f3ede3; --raised: #ebe3d6; --raised-2: #e1d7c8;
    --line: #d6cbba; --line-strong: #8a7e6c;
    --text: #1a1612; --text-2: #4a4238; --text-3: #645a4d;
    --ember: #b13a17; --on-ember: #fff4ee; --moss: #3f6b3a; --danger: #b13a17;
    --lh: 1.45;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ground); color: var(--text);
  font: 300 16px/var(--lh) "Albert Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 400; }
h1 { font: 400 39px/1.15 Gloock, Georgia, serif; letter-spacing: -0.01em; }
h2 { font-size: 25px; font-weight: 600; }
h2.editorial { font: 400 31px/1.2 Gloock, Georgia, serif; }
h3 { font-size: 14px; font-weight: 600; color: var(--text-2); margin-top: 32px; }
p { margin: 0; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 400; }
.meta { font-size: 12px; color: var(--text-3); }
.lede { color: var(--text-2); max-width: 60ch; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.error { color: var(--danger); font-weight: 400; min-height: 0; }
.error:empty { display: none; }
.note { color: var(--text-2); font-size: 14px; }
.note:empty { display: none; }
.warn { color: var(--text-2); font-size: 14px; }

/* Controls */
button, input, textarea { font: inherit; color: inherit; }
button {
  border-radius: 6px; padding: 10px 16px; font-weight: 400; cursor: pointer;
  border: 1px solid transparent; transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--ember); color: var(--on-ember); font-weight: 600; }
.secondary { background: transparent; border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--raised-2); }
.ghost { background: transparent; color: var(--text-2); }
.ghost:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.link { background: none; border: 0; padding: 0; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
input, textarea {
  width: 100%; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 10px 12px; font-weight: 300;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="file"] { padding: 8px; }
label { font-size: 14px; font-weight: 400; color: var(--text-2); }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 16px; font-weight: 300; }
.check input { width: auto; accent-color: var(--ember); }
details summary { cursor: pointer; color: var(--text-2); font-size: 14px; margin: 8px 0; }
details[open] > summary { margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack label { margin-top: 8px; }
.stack button[type="submit"] { align-self: flex-start; margin-top: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.key {
  background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px;
  overflow-wrap: anywhere; font-size: 14px; user-select: all;
}

/* Onboarding */
.onboard { min-height: 100%; display: grid; place-items: center; padding: 48px 24px; }
.onboard-inner { width: min(520px, 100%); display: flex; flex-direction: column; gap: 16px; }
.onboard-inner h1 { margin: 4px 0 4px; }
.onboard-inner > .primary, .onboard-inner > .link { align-self: flex-start; }

/* App layout */
#app { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }
.sidebar { background: var(--raised); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.me { padding: 12px; border-bottom: 1px solid var(--line); }
.me-button { width: 100%; text-align: left; background: none; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.me-button:hover { background: var(--raised-2); }
.me-name { font-weight: 600; }
.actions { display: flex; gap: 8px; padding: 12px; }
.actions button { flex: 1; }
.offline { margin: 0 12px 12px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 14px; color: var(--text-2); }
#contact-list { overflow-y: auto; flex: 1; }
.section-label { padding: 16px 16px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }
.contact {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: center;
  width: 100%; min-height: 56px; padding: 8px 16px; text-align: left; border: 0; border-radius: 0; background: none;
}
.contact:hover { background: var(--raised-2); }
.contact[aria-current="true"] { background: var(--raised-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.contact .name { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .preview { grid-column: 1; font-size: 14px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .unread { grid-row: 1 / span 2; grid-column: 2; background: var(--ember); color: var(--on-ember); font-size: 12px; font-weight: 600; border-radius: 10px; padding: 1px 7px; }

.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.back { display: none; align-self: flex-start; margin: 8px; }
.panel { flex: 1; min-height: 0; }
.form-panel { overflow-y: auto; padding: 48px; display: flex; flex-direction: column; gap: 16px; max-width: 680px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px; text-align: center; }
.empty-line { font: 400 25px/1.3 Gloock, Georgia, serif; max-width: 22ch; }

/* Badges: icon plus word, never color alone */
.badge { font-size: 12px; font-weight: 400; }
.badge.verified { color: var(--moss); }
.badge.verified::before { content: "\2713\00a0"; }
.badge.unverified { color: var(--text-3); }
.badge.unverified::before { content: "\25cb\00a0"; }

/* Conversation */
.chat { display: flex; flex-direction: column; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 20px; }
.request { margin: 16px 24px 0; padding: 16px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 6px; display: flex; flex-direction: column; gap: 12px; }
.messages { list-style: none; margin: 0; padding: 24px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.messages li { display: flex; flex-direction: column; max-width: min(65ch, 80%); align-self: flex-start; }
.messages li.mine { align-self: flex-end; align-items: flex-end; }
.bubble { background: var(--raised); padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .bubble { background: var(--ember); color: var(--on-ember); font-weight: 400; }
.messages time { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.messages .day { align-self: center; font-size: 12px; color: var(--text-3); }
.composer { display: flex; gap: 8px; padding: 12px 24px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { resize: none; max-height: 200px; background: var(--raised-2); }
.composer-error { padding: 0 24px 12px; }

/* Verify */
.safety { display: grid; grid-template-columns: repeat(4, max-content); gap: 12px 24px; font-size: 20px; padding: 24px; background: var(--raised); border: 1px solid var(--line); border-radius: 6px; width: max-content; }
.qr { width: 216px; padding: 8px; background: #eee6d8; border-radius: 6px; }
.qr.small { width: 168px; margin: 12px 0; }
.qr svg { display: block; width: 100%; height: auto; }

@media (max-width: 720px) {
  #app { grid-template-columns: 1fr; }
  #app.in-pane .sidebar { display: none; }
  .back { display: block; }
  #app:not(.in-pane) .pane { display: none; }
  .form-panel { padding: 24px 16px; }
  .safety { grid-template-columns: repeat(3, max-content); font-size: 16px; gap: 8px 16px; padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Elements only the web build shows (web/shim.js sets html.web). */
:root:not(.web) [data-web] { display: none !important; }
.warn a { color: inherit; }

/* ---------- banner: full-bleed art on the welcome, unlock and empty screens ---------- */
.onboard.with-banner { display: block; padding: 0 0 48px; }
.onboard.with-banner .onboard-inner { margin: 40px auto 0; padding: 0 24px; width: min(568px, 100%); }
.banner { display: block; width: 100%; height: clamp(160px, 30vw, 380px); object-fit: cover; object-position: left bottom; /* crop sky, never the caption */ }
.empty { padding: 0 0 48px; justify-content: flex-start; }
.empty .banner { height: clamp(160px, 38%, 360px); margin-bottom: 24px; }

/* ---------- web only: the arok.ai/straylight header and footer ---------- */
.site-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--ground); }
.site-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.site-brand svg { width: 22px; height: 22px; flex: none; }
.site-brand circle { fill: var(--ember); }
.site-brand b { font-weight: 600; }
.site-brand b span { color: var(--text-3); font-weight: 400; margin-right: 6px; }
.site-links { display: flex; gap: 2px; }
.site-links a, .site-foot nav a {
  font: 400 11.5px/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-2); text-decoration: none; padding: 10px;
}
.site-links a:hover, .site-foot nav a:hover { color: var(--ember); }
.site-links a[aria-current="page"] { color: var(--text); }
.site-foot { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; padding: 32px 24px 40px; border-top: 1px solid var(--line); }
.site-foot p { margin-top: 12px; max-width: 62ch; color: var(--text-3); font-size: 14px; }
.site-foot p a { color: var(--text-2); }
.site-foot nav { display: flex; flex-wrap: wrap; }
.site-foot nav a { padding: 6px 10px; }
/* The header sits above the app, which keeps the rest of the window; the footer is below the fold. */
:root.web #app { height: calc(100vh - 57px); height: calc(100dvh - 57px); }
:root.web .onboard:not(.with-banner) { min-height: calc(100vh - 57px); }
@media (max-width: 640px) {
  .site-bar { padding: 0 12px; }
  .site-links .opt { display: none; }
}
