/* Dark-mode variable overrides. Pages define the light-mode values in their
   own inline <style>; this block only supplies the dark-mode counterparts,
   activated via the data-theme attribute theme.js sets on <html>. */
:root[data-theme="dark"] {
  --bg: #1B1E19;
  --card: #242821;
  --text: #EDEAE3;
  --muted: #A8A29A;
  --border: #3A3E34;
  --bar-bg: #3A3E34;
  --bar-fill: #6FA85E;
  --wnb-bg: #3A2E52;
  --wnb-text: #C9AEF0;
  --scrutiny-bg: #33362D;
  --brown-text: #D9A972;
  --green-text: #7FBF6B;
  --emergency-accent: #E08579;
  --emergency-bg: #33211F;

  /* Chat-only tokens with no existing light-mode counterpart to inherit
     from — see internal/portal/templates/chat.html's :root{} block. */
  --confirm-destructive-bg: #3A2622;
  --confirm-destructive-border: #C96A5C;
  --confirm-destructive-text: #E8B4AA;
}

/* Global header & nav — shared by every authenticated page via
   templates/header.html ({{template "header" .}}). Colors come from each
   page's own :root{} custom properties (all pages define the same set), so
   this file only needs to own the layout/shape rules once. */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; }
.logo { height: 32px; width: auto; }
.brand-name { font-size: .9rem; font-weight: 700; color: var(--brown-text); }
nav { display: flex; align-items: center; gap: 1rem; }
.nav-link { font-size: .85rem; color: var(--green-text); text-decoration: none; font-weight: 600; }
.nav-link:hover { text-decoration: underline; }
/* Logout is a same-origin POST form (see header.html) so it shows up as a
   plain nav link, not a button — display:contents removes the form's own
   box from the nav's flex layout, and button.nav-link strips button chrome. */
.logout-form { display: contents; }
button.nav-link { background: none; border: none; padding: 0; font: inherit; cursor: pointer; }

/* Profile name + click-to-toggle Vibe Passport disclosure */
.profile { position: relative; }
.profile-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .3rem .6rem .3rem .4rem;
  cursor: pointer;
}
.profile-toggle:hover { background: var(--bg); border-color: var(--border); }
.profile-toggle:disabled { cursor: default; }
.profile-toggle:disabled:hover { background: none; border-color: transparent; }
.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  font-size: .85rem;
  flex-shrink: 0;
}
.profile-caret { color: var(--muted); transition: transform .15s; flex-shrink: 0; }
.profile-toggle[aria-expanded="true"] .profile-caret { transform: rotate(180deg); }

.passport-panel {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  width: 364px;
  max-width: calc(100vw - 2rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  animation: passport-in .15s ease-out;
}
:root[data-theme="dark"] .passport-panel { box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.passport-panel.hidden { display: none; }
@keyframes passport-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.passport-heading {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--green-text);
  margin-bottom: .85rem;
}
.passport-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .85rem .75rem; }
.passport-item { display: flex; align-items: flex-start; gap: .5rem; min-width: 0; }
.passport-text { min-width: 0; }
.passport-icon { font-size: 1.15rem; line-height: 1.3; flex-shrink: 0; }
.passport-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; overflow-wrap: break-word; }
.passport-value { font-size: .85rem; font-weight: 600; color: var(--text); line-height: 1.3; overflow-wrap: break-word; }

@media (max-width: 640px) {
  header { flex-wrap: wrap; row-gap: .5rem; }
  nav { flex-wrap: wrap; gap: .5rem .85rem; width: 100%; justify-content: flex-end; }
}

/* Per-person Adventure Passport popup on the trip detail page's Event Plan
   (templates/trip.html's "person" template + static/person-popup.js). One
   shared panel, JS-positioned next to whichever name was clicked — same
   .passport-panel card chrome as the header's own-profile popup above,
   just position:fixed instead of anchored under a single header button. */
.passport-panel.person-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  width: 460px;
  z-index: 50;
}
.person-popup-empty {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: .85rem;
}
.person-popup-empty.hidden,
#person-popup-grid.hidden {
  display: none;
}
.person-popup-discourse-link {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--green-text);
  text-decoration: none;
}
.person-popup-discourse-link:hover { text-decoration: underline; }

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.theme-toggle-fixed {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: var(--card, #FFFFFF);
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.footer-logo { height: 36px; width: auto; margin-bottom: .5rem; }
.footer-tagline {
  font-size: .9rem;
  font-weight: 600;
  color: var(--brown-text);
  margin-bottom: 1rem;
}
.footer-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: .75rem;
}
.footer-social-link {
  color: var(--muted);
  display: inline-flex;
}
.footer-social-link:hover { color: var(--green-text); }
.footer-copyright { font-size: .75rem; color: var(--muted); }
