:root {
  /* Vibrant violet brand palette -- the original navy-ink + violet
     accent system (matching the logo), turned up with a fuchsia "pop"
     and amber "sun" for gradient moments. Same token NAMES throughout,
     so every stylesheet shifts together with no selector churn. */
  --ink: #14213D;
  --accent: #7C3AED;
  --accent-dark: #5B21B6;
  --accent-ink: #5B21B6;
  --accent-bg-soft: #F3EEFF;
  /* Accent legible on DARK surfaces (the trip-summary pane, hero
     scrims) -- the base violet drops below readable contrast on navy. */
  --accent-bright: #A78BFA;
  /* Gradient companions to the violet accent -- used for high-energy
     moments (CTAs, day chips, hero gradient text), never as body text. */
  --pop: #EC4899;
  --sun: #FBBF24;
  --bg: #FFFFFF;
  --bg-soft: #F4F6F9;
  --muted: #67728A;
  --border: #E1E5EC;
  --danger: #C0392B;
  --danger-bg: #FCEDEB;
  --success: #1E7A46;
  --success-bg: #EAF6EF;
  --on-ink: #F5F6F9;
  --on-ink-muted: rgba(245, 246, 249, 0.68);
  /* Shadow base tinted with the ink color so elevation feels branded. */
  --shadow-ink: 20, 33, 61;
  --font-display: "Bricolage Grotesque", "Archivo", -apple-system, sans-serif;
  --font-ui: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px;

  /* Motion system -- one easing curve and two duration tiers, used
     everywhere motion appears in the app instead of one-off values
     picked per component. --ease-warm is a gentle overshoot-free
     ease-out: quick to start, soft to settle, which reads as "alive"
     rather than mechanical (a linear or ease-in-out curve here feels
     noticeably more robotic side-by-side). --duration-quick is for
     hovers and micro-interactions; --duration-entrance is for anything
     appearing on screen (messages, cards, reveals). */
  --ease-warm: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-quick: 180ms;
  --duration-entrance: 420ms;
}

* {
  box-sizing: border-box;
}

/* Registered so the composer's conic-gradient border angle can animate
   smoothly (unregistered custom properties can't interpolate). Browsers
   without @property simply show the gradient border without rotation. */
@property --ring-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes ring-spin {
  to { --ring-angle: 360deg; }
}

/* Global reduced-motion floor: every entrance/reveal animation in the
   app is built with an .anim-* class below, so disabling motion for
   people who've asked for it is one rule, not a per-component check
   scattered across every stylesheet. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Shared entrance animation: fade + gentle rise. Used for chat
   messages, scroll-reveals, and card entrances alike -- one motion
   vocabulary rather than a different animation per surface. */
@keyframes fade-rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-fade-rise {
  animation: fade-rise-in var(--duration-entrance) var(--ease-warm) both;
}

/* Staggered delays for orchestrated multi-element entrances (the hero
   sequence, a group of cards appearing together) -- small, consistent
   steps rather than one-off timing per page. */
.anim-delay-1 { animation-delay: 90ms; transition-delay: 90ms; }
.anim-delay-2 { animation-delay: 180ms; transition-delay: 180ms; }
.anim-delay-3 { animation-delay: 270ms; transition-delay: 270ms; }
.anim-delay-4 { animation-delay: 360ms; transition-delay: 360ms; }
.anim-delay-5 { animation-delay: 450ms; transition-delay: 450ms; }

/* Applied via JS (IntersectionObserver) to elements that should
   animate in only once they scroll into view, rather than all at once
   on page load. Starts hidden/offset; .in-view triggers the same
   fade-rise keyframe as above. */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-entrance) var(--ease-warm),
              transform var(--duration-entrance) var(--ease-warm);
}

.reveal-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg-soft);
  color: var(--ink);
  min-height: 100vh;
}

.wordmark-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  margin-right: 8px;
  vertical-align: -6px;
}

/* Shared profile dropdown -- used on both companion and landing nav bars.
   Own class names throughout, deliberately not reusing .nav-link, since
   that selector is already ambiguous with more than one match on a page
   (see the earlier querySelector collision bug) -- this avoids repeating
   that mistake with a brand new component. */
.profile-dropdown {
  position: relative;
}

.profile-dropdown-trigger {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent-dark, var(--accent)) 0%, var(--accent) 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s;
  overflow: hidden;
}

.profile-avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-dropdown-trigger:hover,
.profile-dropdown-trigger[aria-expanded="true"] {
  box-shadow: 0 0 0 3px var(--accent-bg-soft);
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: -28px;
  min-width: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(var(--shadow-ink), 0.14);
  padding: 6px;
  z-index: 50;
  animation: profile-dropdown-in 0.15s ease;
}

.profile-dropdown-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 61, 0.32);
  z-index: 40;
  animation: profile-dropdown-backdrop-in 0.15s ease;
}

@keyframes profile-dropdown-backdrop-in {
  from { opacity: 0; }
}

@media (max-width: 640px) {
  .profile-dropdown-menu {
    /* The trigger is a small, 36px circle -- anchoring a 180px-wide
       menu to its right edge pushes the menu's left edge off-screen
       on a narrow phone. A fixed panel with its own margins from both
       viewport edges instead keeps the whole thing on-screen. */
    position: fixed;
    top: 72px;
    left: 16px;
    right: 16px;
    min-width: 0;
  }
}

@keyframes profile-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .profile-dropdown-menu { animation: none; }
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

.profile-dropdown-item:hover {
  background: var(--bg-soft);
}

.profile-dropdown-item-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Offline layer --- */
/* Slim status bar while the device has no connection -- prepended to
   <body> by offline.js on every page. */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 300;
  background: #16132B;
  color: #EDEAFB;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  box-shadow: 0 4px 14px rgba(10, 8, 24, 0.25);
  animation: offline-banner-in 0.3s ease;
}

.offline-banner.leaving {
  opacity: 0;
  transition: opacity 0.3s ease;
}

@keyframes offline-banner-in {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.offline-banner-link {
  color: #A78BFA;
  font-weight: 700;
  text-decoration: none;
  margin-left: 6px;
  white-space: nowrap;
}

.offline-banner-link:hover {
  text-decoration: underline;
}


/* Generic guard for every offline-only element: no author display rule
   may override the hidden attribute. */
[data-offline-show][hidden],
[data-online-only][hidden] {
  display: none !important;
}

/* Inline icon alignment: SVGs are inline-by-default with a baseline
   that sits slightly off from surrounding text, unlike the emoji
   characters they replaced (which had their own font-level vertical
   metrics tuned for text flow). vertical-align: middle corrects this
   globally, everywhere .ui-icon appears next to a label, on any page. */
.ui-icon {
  vertical-align: middle;
  flex-shrink: 0;
}
