/* ============================================================
   Friend Meetup — styles
   ============================================================ */

/* Global safety net: an author-level `display` on a class otherwise beats the
   browser's [hidden] { display: none }, which silently leaves modals visible.
   Declaring it once here means styling can never reintroduce that bug. */
[hidden] { display: none !important; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #fbfbf9;
  --surface-3: #f1f1ed;

  --text-primary: #14140f;
  --text-secondary: #5a5a52;
  --text-muted: #8d8d82;

  --border: rgba(20, 20, 15, 0.08);
  --border-strong: rgba(20, 20, 15, 0.16);

  --shadow-sm: 0 1px 2px rgba(20, 20, 15, 0.04), 0 1px 3px rgba(20, 20, 15, 0.05);
  --shadow-md: 0 2px 4px rgba(20, 20, 15, 0.04), 0 8px 20px rgba(20, 20, 15, 0.07);
  --shadow-lg: 0 12px 40px rgba(20, 20, 15, 0.14);

  --brand: #e25f2c;
  --brand-hover: #c94f20;
  --brand-soft: #fdf0e9;
  --brand-ink: #ffffff;
  --gradient: linear-gradient(135deg, #eb6834 0%, #e87ba4 100%);

  --good: #0a8f0a;
  --good-soft: #e6f5e6;
  --warning: #9a6600;
  --warning-soft: #fdf2da;
  --neutral: #78786f;
  --neutral-soft: #eeeeea;

  --meter-track: #e3ecf9;
  --meter-fill: #2a78d6;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #0e0e0d;
    --surface: #1a1a18;
    --surface-2: #211f1e;
    --surface-3: #2a2a27;

    --text-primary: #f7f7f4;
    --text-secondary: #b9b9ae;
    --text-muted: #8d8d82;

    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);

    --brand: #f0784a;
    --brand-hover: #f78d63;
    --brand-soft: #34190f;
    --brand-ink: #1a1a18;

    --good: #3cc23c;
    --good-soft: #14300f;
    --warning: #f0b53c;
    --warning-soft: #332609;
    --neutral: #9a9a90;
    --neutral-soft: #2a2a27;

    /* Must sit close to the surface: a saturated track reads as a filled bar,
       which contradicts a "0 yes" label sitting right beside it. */
    --meter-track: #142032;
    --meter-fill: #4d93e8;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; font-size: 1rem; }

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

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { transform: translateY(1px); }

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 8px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
}
.btn-text:hover { color: var(--text-primary); }

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Name modal ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(14, 14, 13, 0.5);
  backdrop-filter: blur(4px);
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 22px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.gate-emoji { font-size: 2rem; line-height: 1; margin-bottom: 10px; }
.gate-card h2 { font-size: 1.25rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.gate-card p { color: var(--text-secondary); margin: 0 0 20px; font-size: 0.92rem; }

#name-form { display: flex; gap: 8px; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="text"]::placeholder { color: var(--text-muted); }

/* ---------- Topbar ---------- */
/* Header, banner and tabs stick as ONE unit. Sticking them separately would
   mean hardcoding the tab bar's offset to the header's exact pixel height,
   which breaks the moment the header wraps to two lines. */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  font-size: 1.3rem;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  border-radius: 11px;
  flex-shrink: 0;
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.whoami {
  font-size: 0.86rem;
  color: var(--text-secondary);
  text-align: right;
  min-width: 0;
}
.whoami.whoami-set {
  display: flex;
  align-items: center;
  gap: 8px;
}
.whoami .link-btn {
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whoami .link-btn:hover { color: var(--text-primary); }

/* No `display` here by design — see the [hidden] note at the top. */
.banner {
  padding: 11px 20px;
  background: var(--warning-soft);
  color: var(--warning);
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
  font-weight: 500;
  text-align: center;
}

/* ---------- Tabs ---------- */
.tabs {
  background: transparent;
}
.tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 4px;
}
.tab-btn {
  flex: 0 0 auto;
  min-width: 96px;
  background: none;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.tab-btn.active {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-sm);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade 0.22s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.section-head { margin-bottom: 22px; }
.section-head h1 {
  font-size: 1.45rem;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.section-head p { color: var(--text-secondary); margin: 0; font-size: 0.93rem; }

.empty {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 18px;
  text-align: center;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* ---------- When: holiday weekend cards ---------- */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.slot-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.slot-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.slot-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.slot-emoji { font-size: 1rem; }
.slot-name { font-weight: 650; letter-spacing: -0.01em; }
.slot-dates {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin-bottom: 13px;
}

/* Segmented 3-way control */
.segmented {
  display: flex;
  gap: 3px;
  background: var(--surface-3);
  border-radius: 10px;
  padding: 3px;
}
.seg {
  flex: 1;
  border: none;
  background: none;
  border-radius: 7px;
  padding: 8px 4px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg:hover { color: var(--text-primary); }
.seg.active { box-shadow: var(--shadow-sm); }
.seg-yes.active { background: var(--good-soft); color: var(--good); }
.seg-maybe.active { background: var(--warning-soft); color: var(--warning); }
.seg-no.active { background: var(--surface); color: var(--neutral); }

/* ---------- Where ---------- */
.dest-form { display: flex; gap: 8px; margin-bottom: 18px; }

.suggestions { margin-bottom: 24px; }
.suggestions-label {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 9px;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.chip:disabled {
  opacity: 0.4;
  cursor: default;
  text-decoration: line-through;
}
.chip:disabled:hover {
  border-color: var(--border-strong);
  color: var(--text-secondary);
  background: var(--surface);
}

.dest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dest-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  transition: box-shadow 0.18s ease;
}
.dest-item:hover { box-shadow: var(--shadow-md); }
.dest-main { flex: 1; min-width: 150px; }
.dest-name { font-weight: 600; letter-spacing: -0.01em; }
.dest-meta { display: block; color: var(--text-muted); font-size: 0.79rem; margin-top: 1px; }

.avatars { display: flex; }
.avatar {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--brand-ink);
  background: var(--brand);
  border: 2px solid var(--surface);
  margin-left: -7px;
}
.avatar:first-child { margin-left: 0; }

.vote-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vote-btn:hover { border-color: var(--good); color: var(--good); }
.vote-btn.active {
  background: var(--good-soft);
  color: var(--good);
  border-color: var(--good);
}

/* ---------- Results ---------- */
.top-pick-card {
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 26px;
  text-align: center;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}
.top-pick-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
  margin-bottom: 8px;
}
.top-pick-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.top-pick-sub { font-size: 0.9rem; opacity: 0.92; margin-top: 6px; }

.results-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
@media (max-width: 680px) {
  .results-columns { grid-template-columns: 1fr; gap: 28px; }
}
.results-col h2 {
  font-size: 0.79rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 14px;
}

.meter-list { display: flex; flex-direction: column; gap: 15px; }
.meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.89rem;
  margin-bottom: 6px;
}
.meter-label { font-weight: 600; }
.meter-sublabel { color: var(--text-muted); font-size: 0.83rem; white-space: nowrap; }
.meter-track {
  height: 9px;
  border-radius: 999px;
  background: var(--meter-track);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: var(--meter-fill);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.meter-row.is-top .meter-label::after {
  content: "Leading";
  margin-left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
}

.raw-table-details {
  margin-top: 36px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.raw-table-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.raw-table-details summary:hover { color: var(--text-primary); }
.table-scroll { overflow-x: auto; }
.raw-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 0.84rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.raw-table th, .raw-table td {
  padding: 9px 11px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.raw-table tr:last-child td, .raw-table tr:last-child th { border-bottom: none; }
.raw-table thead th {
  background: var(--surface-2);
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}
.raw-table tbody th {
  text-align: left;
  font-weight: 600;
  background: var(--surface-2);
}
.raw-table .cell-yes { color: var(--good); font-weight: 700; }
.raw-table .cell-maybe { color: var(--warning); font-weight: 700; }
.raw-table .cell-no { color: var(--text-secondary); }
.raw-table .cell-unset { color: var(--text-muted); opacity: 0.5; }
