/* ============================================================
   Trip assistant (partials/assistant.ejs, js/assistant.js)
   Loaded only when the assistant is switched on.

   A phone gets the whole screen, sized to the part the keyboard
   leaves visible. From 600px up it is a panel in the dock's
   corner, which it covers while open; it carries its own
   WhatsApp handoff, so nothing is lost. Square corners, the two
   accents doing their usual jobs: cyan to act, gold to mark.
   ============================================================ */

/* the launcher in the dock, and the in-page links that open it */
.dock__btn--asst{
  background:var(--deep); color:var(--lagoon);
  border:1px solid var(--lagoon); cursor:pointer;
}
.dock__btn--asst svg{ width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linejoin:round; }
/* display rules above would otherwise beat the hidden attribute */
.dock__btn[hidden], .asstLnk[hidden], .asst[hidden], .asst__hand[hidden], .asst__act[hidden]{ display:none; }
button.asstLnk{ background:none; border:0; padding:0 0 7px; cursor:pointer; text-align:left; }
/* Below 1024px (where the menu button takes over) the launcher waits behind
   the dock's "more" button and in the menu, so the dock stays two buttons tall
   and covers nothing new, the footer's own links included. */
@media not all and (min-width:1024px){ .dock__btn--asstOut{ display:none !important; } }
@media (min-width:1024px){ .dock__btn--asstIn{ display:none !important; } }
/* the mobile menu entry, set like the menu's links */
button.drawer__asst{
  display:flex; width:100%; padding:14px 0; text-align:left;
  font-family:var(--ff-d); font-weight:300; font-size:clamp(1.9rem,9vw,2.9rem);
  line-height:1.1; letter-spacing:-.02em; color:var(--paper);
  border-bottom:1px solid rgba(248,245,242,.14);
}

.asst{
  position:fixed; z-index:120;              /* above the header (100) and dock (80) */
  top:0; left:0; right:0;
  height:100vh; height:100dvh;
  height:var(--asst-h, 100dvh);             /* set from visualViewport while a keyboard is open */
  display:flex; flex-direction:column;
  overflow:hidden; overscroll-behavior:contain;
  background:var(--deep); color:var(--paper);
  font-family:var(--ff-b);
}
.asst:focus, .asst__title:focus{ outline:none; }
/* With room for it (wide enough, and tall enough: not a phone turned
   sideways), a corner panel just left of the dock, which stays usable.
   The test matches matchMedia in js/assistant.js. */
@media (min-width:600px) and (min-height:560px){
  .asst{
    top:auto; left:auto; right:92px; bottom:24px;   /* dock: 24px edge + 52px button + 16px gap */
    width:min(420px, calc(100vw - 116px));
    height:min(680px, calc(100vh - 48px));
    height:min(680px, calc(100dvh - 48px));
    border:1px solid var(--line);
    box-shadow:0 10px 30px rgba(8,7,7,.45);
  }
}
/* Otherwise a full-screen sheet, and the page behind it must not scroll. */
@media not all and (min-width:600px) and (min-height:560px){
  html.asst-open, html.asst-open body{ overflow:hidden; }
}

.asst__head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  padding:18px 20px 16px; border-bottom:1px solid var(--line);
  padding-top:max(18px, env(safe-area-inset-top));
}
.asst__eyebrow{
  margin:0 0 8px; font-size:var(--fs-mi); font-weight:500; line-height:1;
  letter-spacing:.2em; text-transform:uppercase; color:var(--gold);
}
.asst__eyebrow::before{
  content:""; display:inline-block; width:18px; height:1px; margin-right:10px;
  vertical-align:middle; background:var(--gold);
}
.asst__title{
  margin:0; font-family:var(--ff-d); font-weight:300; font-size:var(--fs-h3); line-height:1.15;
}
.asst__x{
  flex:none; width:44px; height:44px; margin:-10px -12px 0 0;
  display:inline-flex; align-items:center; justify-content:center;
  background:none; border:0; color:var(--paper); cursor:pointer;
}
.asst__x svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.5; }
.asst__x:hover{ color:var(--lagoon); }
.asst__x:focus-visible, .asst__sug:focus-visible, .asst__act:focus-visible, .asst__send:focus-visible{
  outline:2px solid var(--lagoon); outline-offset:2px;
}

.asst__log{
  flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain;
  padding:18px 20px 8px;
}
.asst__intro p{ margin:0 0 16px; color:var(--ink-2); font-size:.9rem; line-height:1.6; }
.asst__intro[hidden]{ display:none; }
.asst__sugs{ display:grid; gap:8px; margin-bottom:18px; }


.asst__sug{
  text-align:left; padding:11px 14px; min-height:44px;
  background:transparent; color:var(--paper);
  border:1px solid var(--line); border-radius:2px;
  font-family:var(--ff-b); font-size:.9rem; line-height:1.4; cursor:pointer;
  transition:border-color .25s var(--ease);
}
.asst__sug:hover{ border-color:var(--lagoon); }

.asst__msgs{ list-style:none; margin:0; padding:0; display:grid; gap:18px; }
.asst__m{ font-size:1rem; line-height:1.6; overflow-wrap:anywhere; }
.asst__m--user{
  justify-self:end; max-width:86%; padding:10px 14px;
  background:var(--sand); border:1px solid var(--line); border-radius:2px;
  white-space:pre-wrap;
}
.asst__m--bot{ padding-left:14px; border-left:1px solid var(--gold); color:var(--paper); }
.asst__m--bot p{ margin:0 0 .75em; }
.asst__m--bot ul, .asst__m--bot ol{ margin:0 0 .75em; padding-left:1.2em; }
.asst__m--bot ul{ list-style:disc; }
.asst__m--bot ol{ list-style:decimal; }
.asst__m--bot li{ margin:.25em 0; }
.asst__m--bot > :last-child, .asst__body > :last-child{ margin-bottom:0; }
.asst__m--bot strong{ font-weight:600; }
.asst__m--bot a{ color:var(--paper); text-decoration:none; border-bottom:1px solid var(--lagoon); }
.asst__m--bot a:hover{ color:var(--lagoon); }
/* an answer's links, and the related questions under it */
.asst__links{ list-style:none; margin:.75em 0 0; padding:0; display:grid; gap:6px; }
.asst__links a{ color:var(--paper); text-decoration:none; border-bottom:1px solid var(--lagoon); }
.asst__links a:hover{ color:var(--lagoon); }
.asst__rel{ display:grid; gap:6px; margin-top:12px; }
.asst__relh{ margin:0; font-size:var(--fs-mi); font-weight:500; letter-spacing:.18em; text-transform:uppercase; color:var(--ink-2); }
.asst__flag{ margin:.75em 0 0; font-size:.9rem; color:var(--ink-2); }
.asst__m--err{ color:var(--ink-2); font-size:.9rem; line-height:1.55; }

.asst__sr, .asst__label{
  position:absolute; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap;
}

.asst__foot{
  border-top:1px solid var(--line);
  padding:12px 20px 12px;
  padding-bottom:max(12px, env(safe-area-inset-bottom));
}
.asst__hand{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 20px; margin-bottom:10px; }
.asst__act{
  display:inline-block; padding:8px 0; min-height:36px;
  background:none; border:0; border-bottom:1px solid var(--line); border-radius:0;
  font-family:var(--ff-b); font-size:var(--fs-mi); font-weight:500; line-height:1.4;
  letter-spacing:.18em; text-transform:uppercase; color:var(--paper);
  text-decoration:none; cursor:pointer;
  transition:border-color .25s var(--ease), color .25s var(--ease);
}
.asst__act--wa{ border-bottom-color:var(--lagoon); }
.asst__act:hover{ color:var(--lagoon); border-bottom-color:var(--lagoon); }

.asst__form{ display:flex; align-items:flex-end; gap:10px; }
.asst__input{
  flex:1 1 auto; min-width:0; min-height:46px; max-height:140px; resize:none;
  padding:12px 12px; margin:0;
  background:var(--ink); color:var(--paper);
  border:1px solid var(--line); border-radius:2px;
  font-family:var(--ff-b); font-size:1rem; line-height:1.4;   /* 16px: no zoom on iPhone */
}
.asst__input::placeholder{ color:var(--ink-2); opacity:1; }
.asst__input:focus{ outline:none; border-color:var(--lagoon); box-shadow:0 0 0 1px var(--lagoon); }
.asst__send{
  flex:none; width:46px; height:46px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--lagoon); color:#0c0b0b;
  border:1px solid var(--lagoon); border-radius:2px; cursor:pointer;
  transition:filter .25s var(--ease);
}
.asst__send:hover{ filter:brightness(1.08); }
.asst__send svg{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; }

.asst__note{ margin:10px 0 0; font-size:.75rem; line-height:1.5; color:var(--ink-2); }
.asst__note a{ color:var(--ink-2); border-bottom:1px solid var(--line); text-decoration:none; }
.asst__note a:hover{ color:var(--paper); }

@media (prefers-reduced-motion:reduce){
  .asst__sug, .asst__act, .asst__send{ transition:none; }
}
