/* Wanderfar: shared styles.
   Colours are tokens taken from the logo, so the Settings tab (a later step) can override them per user. */

:root {
  /* Brand */
  --rose: #dd969b;            /* the logo's own rose: decoration only, too light for text */
  --brand: #b5475a;           /* deeper rose for buttons and links (5.2:1 on white) */
  --brand-hover: #973a4a;
  --on-brand: #ffffff;

  /* Surfaces and text */
  --paper: #fff8f7;
  --surface: #ffffff;
  --ink: #3b2430;
  --ink-soft: #7a5b66;
  --line: #ebd3d5;            /* dividers */
  --field-border: #b8828b;    /* input outlines (3:1 against the surface) */
  --danger: #a31621;
  --danger-bg: #fdecee;
  --ok: #1b6b45;
  --ok-bg: #e9f6ef;

  /* The hero always stays light so the logo artwork sits on its intended background */
  --hero-bg: linear-gradient(165deg, #fff6f5 0%, #ffe6e7 100%);
  --hero-ink: #3b2430;
  --hero-soft: #7a5b66;

  --display: 'Quicksand', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #f0a3ac;
    --brand-hover: #f7bbc2;
    --on-brand: #2a1219;
    --paper: #1e1419;
    --surface: #2a1b22;
    --ink: #f8ecee;
    --ink-soft: #cdaeb6;
    --line: #4a3540;
    --field-border: #8f6c77;
    --danger: #ff9a9f;
    --danger-bg: #3a1a1f;
    --ok: #7bd9a6;
    --ok-bg: #16301f;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--body);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
/* App shell: header + main content + footer stacked in a column, so the footer always sits
   at (or below) the bottom of the viewport instead of jumping around while a page loads. */
body.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
body.app-body > #view { flex: 1 0 auto; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- Auth page ---------- */

.auth {
  min-height: calc(100vh - 38px);
  min-height: calc(100dvh - 38px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.hero {
  background: var(--hero-bg);
  color: var(--hero-ink);
  padding: clamp(24px, 4.5vw, 56px);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  text-align: center;
}
.hero h1 { width: 100%; display: flex; justify-content: center; line-height: 0; }
.logo {
  display: block;
  width: min(100%, 520px);
  height: auto;
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.lede { margin: 0; max-width: 34ch; color: var(--hero-soft); font-size: 1.1rem; animation: rise 0.8s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.fine { margin: 0; color: var(--hero-soft); font-size: 0.9rem; animation: rise 0.8s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.panel { display: grid; place-items: center; padding: 32px 20px; }
.panel > .card { width: min(100%, 420px); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 2px solid var(--line); margin-bottom: 24px; }
.tab {
  background: none; border: 0; cursor: pointer;
  padding: 12px 4px; margin-bottom: -2px;
  font-weight: 700; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }

.view-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.view-note { margin: 0 0 20px; color: var(--ink-soft); }

/* Messages never rely on colour alone: errors carry a text prefix. */
.msg { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); border-left-width: 4px; background: var(--surface); }
.msg.error { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.msg.error::before { content: 'Error: '; font-weight: 700; }
.msg.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.msg.soft { border-color: var(--field-border); color: var(--ink-soft); background: var(--tint); }

.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: block; margin-bottom: 6px; font-weight: 700; font-size: 0.95rem; }
.field > .pw { display: block; }
.field input {
  width: 100%; padding: 11px 12px;
  background: var(--surface);
  border: 1.5px solid var(--field-border);
  border-radius: var(--radius);
}
.field input:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent); outline-offset: 0; }
.field small { display: block; margin-top: 6px; color: var(--ink-soft); }
.code-input { font-size: 1.6rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }

.pw { position: relative; }
.pw input { padding-right: 68px; }
.pw button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; padding: 6px 8px;
  color: var(--ink-soft); font-size: 0.9rem; font-weight: 700;
}

.btn {
  width: 100%; padding: 12px 16px; cursor: pointer;
  background: var(--brand); color: var(--on-brand);
  border: 0; border-radius: var(--radius); font-weight: 700;
}
.btn:hover { background: var(--brand-hover); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn.quiet { width: auto; background: none; color: var(--ink); border: 1.5px solid var(--field-border); padding: 8px 14px; }
.btn.quiet:hover { background: var(--surface); }

.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.link:hover { color: var(--brand-hover); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -4px 0 16px; }
.stack { display: grid; gap: 12px; margin-top: 20px; justify-items: start; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--ink-soft); font-size: 0.9rem; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
#google-button { min-height: 44px; display: flex; justify-content: center; }

/* ---------- App shell ---------- */

.shell-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand-link { display: inline-block; line-height: 0; }
.wordmark { height: 34px; width: auto; display: block; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--brand); color: var(--on-brand); font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.shell-main { max-width: 760px; margin: 0 auto; padding: clamp(24px, 6vw, 64px) clamp(16px, 4vw, 40px); }
.shell-main h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
.empty { margin-top: 32px; padding: 28px; border: 1.5px dashed var(--field-border); border-radius: var(--radius); background: var(--surface); }
.empty h2 { font-size: 1.25rem; margin-bottom: 6px; }
.empty p { margin: 0; color: var(--ink-soft); }
.shell-foot { margin-top: 32px; }

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .hero { padding: 20px 16px 4px; gap: 0; }
  .logo { width: min(78%, 320px); }
  .lede, .fine { display: none; }
  .panel { padding: 16px 16px 40px; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  .logo, .lede, .fine { animation: none; }
}

/* Safety notice shown above the header on every page */
.notice { background: var(--ink); color: var(--paper); padding: 8px clamp(16px, 4vw, 40px); font-size: 0.9rem; text-align: center; }
.notice strong { font-weight: 700; }

