/* JunaHub design tokens — Style C "Quiet monochrome" (design handover v2.0, HANDOVER.md).
   Terracotta (--fresh) is reserved for freshness. Primary actions are black pills,
   never coloured. */
:root {
  --ground: #ffffff;
  --ground-chat: #f2f3f5;
  --surface-2: #f7f8f9;
  --field: #f2f3f5;
  --ink: #141414;
  --muted: #6b6f75;
  /* decoration only (borders, dots, icons): 3.3:1 on white is too light for text */
  --muted-2: #8a8f96;
  --line: #e9ebee;
  --line-card: #e3e5e8;
  --line-row: #f2f3f5;
  --fresh: #b8532e;
  --fresh-bg: #f7ebe6;
  /* terracotta as text on the tint: the handover's #b8532e is 4.2:1 there, this is 4.7:1 */
  --fresh-on-bg: #ab4c29;
  --warn: #8a4b00;
  --warn-bg: #fbf1e3;
  --admin-side: #141414;
  --admin-side-on: #2a2a2a;
  --shadow-card: 0 1px 3px rgba(20, 20, 20, 0.06);
  --font: "Manrope", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
/* hidden means hidden, whatever display the element's class gives it */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--ink); }
/* keyboard focus is always visible, and the same everywhere */
a:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 8px; background: var(--ink); color: #ffffff; font-size: 14px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; color: #ffffff; outline-color: #ffffff; }
/* the page itself takes focus from the skip link, without a ring around everything */
#page:focus { outline: none; }
a:hover { color: #000000; }
h1, h2, .display { font-family: var(--font); font-weight: 800; letter-spacing: -0.02em; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: var(--font-mono); font-weight: 500; }
.mu { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* wordmark: lowercase "junahub" */
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }

/* photo placeholder: a soft grey gradient with a small caption, never hatched */
.ph {
  position: relative;
  background: linear-gradient(160deg, #d8dbdf 0%, #e8eaed 55%, #f2f3f5 100%);
  border-radius: 16px;
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: 8px 10px;
  color: #5a5f66; font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase;
  text-decoration: none;
}
.photo { background-size: cover; background-position: center; border-radius: 16px; }

/* loading skeleton: bars sit at the final element's size */
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk { background: linear-gradient(90deg, #e9ebee 0%, #f2f3f5 40%, #e9ebee 80%); background-size: 200% 100%; animation: sk 1.6s linear infinite; border-radius: 6px; }

/* freshness */
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fresh); white-space: nowrap; }
.fresh .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--fresh); flex-shrink: 0; }
.fresh.pill { height: 28px; padding: 0 10px; border-radius: 14px; background: var(--ground); }
.fresh.tint { height: 36px; padding: 0 12px; border-radius: 8px; background: var(--fresh-bg); color: var(--fresh-on-bg); }
.fresh.gone { color: var(--muted); }
.fresh.gone .dot { background: var(--muted-2); }

/* provenance chip */
.src {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 2px 6px;
  border-radius: 4px; background: var(--field); color: #5a5f66; white-space: nowrap;
  align-self: flex-start;
}
.src-verified { background: var(--fresh-bg); color: var(--fresh-on-bg); }
.src-gap { background: var(--warn-bg); color: var(--warn); }

/* buttons: pills; labels never wrap */
.pri, .sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 24px;
  font-family: inherit; font-size: 15px; font-weight: 700;
  text-decoration: none; white-space: nowrap;
}
.pri { background: var(--ink); color: #ffffff; border: none; }
.pri:hover { background: #000000; color: #ffffff; }
.sec { background: var(--ground); color: var(--ink); border: 1.5px solid var(--ink); }
.pri.sm, .sec.sm { height: 36px; padding: 0 16px; border-radius: 18px; font-size: 13px; }
.pri[disabled], .sec[disabled] { opacity: 0.4; cursor: default; }

/* chips, toggles, tabs */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 19px; border: 1px solid var(--line-card); background: var(--ground);
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.chip.on { border-color: var(--ink); }
.tog { display: inline-flex; background: var(--field); border-radius: 20px; padding: 3px; font-size: 12px; font-weight: 700; }
.tog button { padding: 0 12px; height: 28px; border: none; border-radius: 14px; background: none; color: var(--muted); font-weight: 700; font-size: 12px; }
.tog button.on { background: var(--ink); color: #ffffff; }
.tab {
  display: inline-flex; align-items: center; height: 44px; padding: 0 4px; border: none; background: none;
  font-family: inherit; font-size: 15px; font-weight: 700; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none;
}
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.tag { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; background: var(--field); color: #5a5f66; }
.tag-fresh { background: var(--fresh-bg); color: var(--fresh-on-bg); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }

/* inputs: 16px so iOS Safari never zooms */
.in {
  height: 48px; border: 1px solid var(--line-card); border-radius: 12px; padding: 0 14px;
  font-family: inherit; font-size: 16px; color: var(--ink); outline: none; width: 100%;
  background: var(--ground);
}
.in:focus { border-color: var(--ink); }
textarea.in { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; }

/* cards and tiles */
.card {
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  background: var(--ground); border: 1px solid var(--line-card); border-radius: 16px;
  box-shadow: var(--shadow-card); text-decoration: none; color: var(--ink);
}
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.tile .v.gap { color: var(--muted); }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-row); font-size: 14px;
}
.row:last-child { border-bottom: none; }

/* layout */
.page { max-width: 1280px; margin: 0 auto; padding: 0 48px; }
.stack { display: flex; flex-direction: column; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 48px; background: var(--ground); border-bottom: 1px solid var(--line);
}
.site-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  min-height: 56px; padding: 12px 48px; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer .links { display: flex; gap: 20px; }

/* ---------- mobile (≤720px) ---------- */
/* .m-only / .m-flex render only on mobile, .d-only only on desktop. */
.m-only, .m-flex { display: none !important; }
/* Fixed bottom bar for the primary action. */
.m-bar { display: none; }
@media (max-width: 720px) {
  input, textarea, select { font-size: 16px !important; }
  .d-only { display: none !important; }
  .m-only { display: block !important; }
  .m-flex { display: flex !important; }
  .page { padding: 0 16px; }
  .grid-3 { grid-template-columns: 1fr; gap: 16px; }
  .site-header { height: 56px; padding: 0 16px; }
  .site-footer { padding: 12px 16px; }
  .m-bar {
    display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ground);
    border-top: 1px solid var(--line);
  }
  .m-bar .pri, .m-bar .sec { flex-grow: 1; height: 44px; font-size: 14px; padding: 0 12px; }
  .has-bar { padding-bottom: 110px !important; }
}
