/* Orbit design system — "Field Notes for Real Life"
   Ink-teal + warm paper, Fraunces headings / Inter body, Orbit Ring motif. */

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-var.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #12262b;
  --paper: #faf7f1;
  --accent: #e8654a;
  --accent-strong: #d14e34;
  --signal: #4c7a5e;
  --muted: #8a9a9b;
  --surface: #f0f4f2;
  --hairline: rgba(18, 38, 43, 0.1);
  --radius: 14px;
  --max-width: 480px;
  --shadow-sm: 0 1px 2px rgba(18, 38, 43, 0.05), 0 1px 1px rgba(18, 38, 43, 0.04);
  --shadow-md: 0 6px 16px rgba(18, 38, 43, 0.09), 0 2px 6px rgba(18, 38, 43, 0.05);
  --shadow-lg: 0 16px 40px rgba(18, 38, 43, 0.16), 0 4px 10px rgba(18, 38, 43, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }

p { line-height: 1.5; margin: 0 0 1em; }

a { color: inherit; }

.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.app-main {
  flex: 1;
  padding: 24px 20px 96px;
}

.centered-screen {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  text-align: center;
  gap: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

/* ---- Orbit Ring motif ----
   A conic-gradient arc, never a numeric badge - fill + color together
   read as a status at a glance (trust level, Experience status, or
   Discover match strength). Stroke width is a fixed fraction of the
   ring's own size so it reads as a deliberate ring at every scale,
   not a hairline. The inner disc's background follows --ring-bg so it
   blends into whatever surface it sits on (paper, card, or elevated
   row) instead of punching a mismatched hole. */
.orbit-ring {
  --ring-size: 44px;
  --ring-stroke: 6px;
  --ring-fill: 0%;
  --ring-color: var(--accent);
  --ring-bg: var(--paper);
  width: var(--ring-size);
  height: var(--ring-size);
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) var(--ring-fill), var(--hairline) 0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background 0.25s ease;
}

.orbit-ring::after {
  content: "";
  width: calc(var(--ring-size) - (var(--ring-stroke) * 2));
  height: calc(var(--ring-size) - (var(--ring-stroke) * 2));
  border-radius: 50%;
  background: var(--ring-bg);
  box-shadow: inset 0 1px 2px rgba(18, 38, 43, 0.06);
}

.orbit-ring.lg { --ring-size: 88px; --ring-stroke: 10px; }
.orbit-ring.sm { --ring-size: 28px; --ring-stroke: 4px; }

.card .orbit-ring, .card-row .orbit-ring { --ring-bg: var(--surface); }

.orbit-ring.status-upcoming { --ring-fill: 15%; --ring-color: var(--muted); }
.orbit-ring.status-going { --ring-fill: 40%; --ring-color: var(--accent); }
.orbit-ring.status-checked_in { --ring-fill: 70%; --ring-color: var(--accent); }
.orbit-ring.status-checked_out { --ring-fill: 100%; --ring-color: var(--signal); }

.orbit-ring.trust-new { --ring-fill: 25%; --ring-color: var(--muted); }
.orbit-ring.trust-verified { --ring-fill: 50%; --ring-color: var(--ink); }
.orbit-ring.trust-trusted { --ring-fill: 75%; --ring-color: var(--accent); }
.orbit-ring.trust-established { --ring-fill: 100%; --ring-color: var(--signal); }

/* Discover match strength - same motif, plain-language categories from
   orbit_scoring.CATEGORY_THRESHOLDS via orbitMatchRingClass(), never a
   numeric score. */
.orbit-ring.match-strong { --ring-fill: 92%; --ring-color: var(--signal); }
.orbit-ring.match-good { --ring-fill: 68%; --ring-color: var(--accent); }
.orbit-ring.match-worth { --ring-fill: 42%; --ring-color: var(--ink); }
.orbit-ring.match-limited { --ring-fill: 18%; --ring-color: var(--muted); }

.orbit-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0% 30%, var(--ink) 30% 65%, var(--muted) 65% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}
.orbit-mark::after {
  content: "";
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--paper);
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

a.card, .card-interactive {
  display: block;
  cursor: pointer;
}

a.card:hover, a.card:focus-visible, .card-interactive:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(18, 38, 43, 0.18);
}

a.card:active, .card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.hairline {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 16px 0;
}

/* ---- Forms ---- */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="time"], input[type="number"],
input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 14px;
  box-shadow: inset 0 1px 2px rgba(18, 38, 43, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(18, 38, 43, 0.08);
}

textarea { resize: vertical; min-height: 80px; }

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -10px 0 14px;
}

button, .btn {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

button:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary {
  background: var(--accent);
  color: var(--paper);
  width: 100%;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(18, 38, 43, 0.22);
  width: 100%;
}
.btn-secondary:hover:not(:disabled) { background: var(--surface); border-color: var(--ink); }
.btn-secondary:active:not(:disabled) { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px;
}
.btn-ghost:hover { color: var(--ink); }

.btn-sm { padding: 8px 12px; font-size: 0.85rem; width: auto; }

/* ---- Tab bar ---- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(18, 38, 43, 0.07);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 0;
}

.tab-item.active { color: var(--accent); }

.tab-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  transition: background 0.15s ease;
}

.tab-item.active .tab-icon {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(232, 101, 74, 0.14);
}

/* ---- Misc ---- */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(18, 38, 43, 0.05);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 0 6px 6px 0;
}

.error-banner {
  background: #fbe4de;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: none;
  box-shadow: var(--shadow-sm);
}
.error-banner.show { display: block; }

.empty-state {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 32px 16px;
  text-align: center;
  border: 1px dashed rgba(18, 38, 43, 0.16);
  border-radius: var(--radius);
  background: rgba(18, 38, 43, 0.02);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}

.app-main h3 { margin-top: 28px; }
.app-main h3:first-of-type { margin-top: 4px; }

.reason-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}
.reason-list li { margin-bottom: 2px; }

.member-name { font-weight: 600; }
.member-name--unset {
  font-style: italic;
  font-weight: 500;
  color: var(--muted);
}

/* ---- AI Guide chat ---- */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-bubble.guide {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.chat-input-row {
  position: fixed;
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: var(--paper);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -4px 16px rgba(18, 38, 43, 0.07);
}

.chat-input-row input {
  margin-bottom: 0;
  flex: 1;
  border-radius: 999px;
}

.chat-input-row button {
  width: auto;
  border-radius: 999px;
}
