/* Kota: a warm hut, wood and ember. One sheet for sign-in and the app. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --ground: #f6f1ea;
  --panel: #fffdf9;
  --sunk: #efe7dc;
  --border: #ddd1c1;
  --text: #2b2118;
  --soft: #4d4034;
  --muted: #7b6d5f;
  --accent: #a4561d;
  --accent-ink: #fffaf3;
  --warn: #a83a26;
  --ok: #3f7a3a;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17120e;
    --panel: #201a15;
    --sunk: #120e0b;
    --border: #3a3027;
    --text: #f1e9df;
    --soft: #d6cabd;
    --muted: #a6978a;
    --accent: #e39a5a;
    --accent-ink: #1b130c;
    --warn: #f0a08c;
    --ok: #9fd39a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--ground); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }

/* ---- controls ---- */

label { font: 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus, select:focus { border-color: var(--accent); outline: none; }
input.code { font: 500 24px var(--mono); letter-spacing: 0.3em; text-align: center; }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.secondary { background: var(--panel); color: var(--soft); border: 1px solid var(--border); }
.secondary:hover { border-color: var(--accent); color: var(--accent); }
.danger { color: var(--warn); }
.txt {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.status {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--soft);
}
.status.error { border-color: var(--warn); color: var(--warn); }

/* ---- sign-in ---- */

.card {
  max-width: 440px;
  margin: 0 auto;
  padding: max(56px, 10vh) 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card h1 { margin: 0; font-size: clamp(2.4rem, 9vw, 3.2rem); font-weight: 500; line-height: 1; }
.crumb { font: 13px var(--mono); color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.lead { color: var(--soft); }
#methods, .method, .nostr, #nostr-app, #bunker-form { display: flex; flex-direction: column; gap: 12px; }
.method-btn { width: 100%; min-height: 46px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 12px var(--mono); text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.nostr { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.qr { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); font-size: 14px; }
.qr > div { width: 220px; max-width: 100%; background: #fff; border-radius: 8px; padding: 6px; line-height: 0; }
.qr svg { width: 100%; height: auto; }
.more summary { cursor: pointer; color: var(--soft); font-size: 14px; }
.more[open] { display: flex; flex-direction: column; gap: 12px; }

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

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  background: var(--ground);
  border-bottom: 1px solid var(--border);
}
.brand { font: 600 20px var(--display); color: var(--text); text-decoration: none; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--soft); text-decoration: none; }
.tabs a.on { background: var(--sunk); color: var(--text); font-weight: 500; }
.me { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.me .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; color: var(--text); text-decoration: none; }
.me .name:hover { color: var(--accent); }
.nowrap { white-space: nowrap; }

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
.side { display: flex; flex-direction: column; gap: 18px; }
.side p { overflow-wrap: anywhere; }
.side h3 { margin: 0 0 6px; font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 400; }
.side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--soft); text-decoration: none; overflow-wrap: anywhere; }
.side a:hover { background: var(--sunk); }
.side a.on { background: var(--sunk); color: var(--text); font-weight: 500; }
.side .owner { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-family: var(--display); font-size: 20px; }
.crumbs a { color: var(--text); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--muted); }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--sunk);
  color: var(--muted);
  font: 12px var(--mono);
}
.badge.write { color: var(--ok); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }

.files { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.files th { text-align: left; font: 12px var(--mono); color: var(--muted); font-weight: 400; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--sunk); }
.files td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.files tr:last-child td { border-bottom: 0; }
.files td.name { overflow-wrap: anywhere; }
.files td.name a { color: var(--text); text-decoration: none; }
.files td.name a:hover { color: var(--accent); }
.files td.num { white-space: nowrap; color: var(--muted); font-size: 13px; }
.files td.acts { text-align: right; white-space: nowrap; }
.files td.acts button { margin-left: 10px; }
.icon { display: inline-block; width: 1.4em; color: var(--muted); }
@media (max-width: 560px) {
  .files .when { display: none; }
}
.empty { padding: 28px; text-align: center; color: var(--muted); }
.drop { outline: 2px dashed var(--accent); outline-offset: 4px; }

.meter { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); }
.usage { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }

.grants { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); align-items: center; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--soft); }

/* ---- people ---- */

.section { display: flex; flex-direction: column; gap: 10px; }
.section h2 { margin: 6px 0 0; font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pcard { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pcard .title { font: 600 16px var(--display); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pcard .npub { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.pcard ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pcard li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pcard li .grow { flex: 1 1 8em; min-width: 0; overflow-wrap: anywhere; }
.pcard label { text-transform: none; font: 14px Inter, system-ui, sans-serif; color: var(--soft); letter-spacing: 0; }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline > input, .inline > select { flex: 1 1 160px; width: auto; }

/* ---- dialogs ---- */

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 20px;
}
dialog::backdrop { background: rgba(20, 12, 6, 0.45); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-size: 20px; }
dialog ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
dialog li { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--ground);
  z-index: 10;
}
.toast.error { background: var(--warn); color: #fff; }
.pcard input:not([type="checkbox"]) { min-height: 36px; }
.pcard details ul { margin-top: 8px; }

/* ---- avatars and the account button ---- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--sunk);
  border: 1px solid var(--border);
  color: var(--soft);
  font: 600 12px var(--display);
  overflow: hidden;
}
.avatar.small { width: 20px; height: 20px; font-size: 10px; }
.avatar.large { width: 64px; height: 64px; font-size: 22px; }
.account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--panel);
  cursor: pointer;
  min-width: 0;
}
.account:hover { border-color: var(--accent); }
.profile-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.profile-head h2 { margin: 0; }
.profile-head p { overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-right: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.chip .avatar { margin-left: -6px; }
@media (max-width: 560px) {
  .account .name { display: none; }
  .account { padding: 3px; }
}
.badge.kind { margin-left: 8px; color: var(--soft); }
.files td.name a { display: inline-flex; align-items: center; gap: 6px; }

/* ---- get started ---- */

.card.wide { max-width: 720px; }
.step { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.step h2 { margin: 6px 0 0; font-size: 20px; }
.step h3 { margin: 8px 0 0; font-size: 15px; color: var(--soft); }
pre.cmd {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font: 14px var(--mono);
  overflow-x: auto;
  user-select: all;
}
.downloads { margin: 8px 0; padding-left: 20px; }

.welcome { padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }
.welcome li { display: list-item; }
#inv-list li { font-size: 13px; }
.guide ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.guide .kinds { list-style: none; padding-left: 4px; }
.toc { line-height: 1.9; }
.faq dt { font-weight: 600; margin-top: 10px; }
.faq dd { margin: 4px 0 0; color: var(--soft); }
#by-avatar:empty { display: none; }
