/* LanternScout — the Weekend Planner's form as a dialog over the landing page (index.html#plan, planner-form.js).
   Opens the way Scout's form does: the real landing dimmed and blurred behind it, the card eased in, a sheet from the
   bottom on phones. The form's own rules below come from planner.css, scoped to the dialog so they cannot reach
   Scout's controls on this page. */

/* The planner's colour inside the dialog (Scout's page is amber): every shared control reads these. */
#planner-dialog {
  --accent:          var(--navy);
  --accent-strong:   var(--navy);
  --accent-soft:     var(--navy-light);
  --accent-hover:    #14273f;
  --accent-border:   rgba(29, 58, 94, 0.35);
  --accent-ring:     rgba(29, 58, 94, 0.12);
  --accent-contrast: #fff;
}

.planner-dialog:not([hidden]) {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center; padding: 2.5rem 1rem;
  /* The same dim and blur as Scout's form, with no fade on this layer (a blurred backdrop that faded flickered). */
  background: rgba(18, 36, 58, 0.42); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
.planner-dialog__card {
  position: relative; width: 100%; max-width: 640px; margin-block: auto; padding: 2rem 2rem 2.5rem;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 24px; text-align: start;
  box-shadow: 0 30px 80px -20px rgba(18, 36, 58, 0.55);
  animation: ls-card-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
html.planner-open { overflow: hidden; }
/* The landing's own animations rest while the dialog is open (a moving page under a blur is redrawn every frame). */
html.planner-open #landing-shell, html.planner-open #landing-shell * { animation-play-state: paused !important; }
@media (max-width: 600px) {
  .planner-dialog:not([hidden]) { padding: 2.5rem 0.6rem max(0.6rem, env(safe-area-inset-bottom)); align-items: stretch; }
  .planner-dialog__card { margin: auto 0 0; border-radius: 22px; padding: 1.75rem 1.1rem 2.5rem; }
}

#planner-dialog .planner-close {
  position: absolute; top: 0.9rem; inset-inline-end: 0.9rem; width: 44px; height: 44px; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--navy-light); color: var(--navy);
}
#planner-dialog .planner-close:hover, #planner-dialog .planner-close:focus-visible { background: #dce8f5; }
#planner-dialog .planner-title { padding-inline-end: 3rem; }

/* Loading: the loading card takes the form card's place on the same dimmed scene, as on Scout. */
.planner-dialog--loading .planner-dialog__card { visibility: hidden; animation: none; }
.planner-dialog--loading #planner-view-loading { visibility: visible; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ── The form's own rules, from planner.css ── */
#planner-dialog .planner-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--navy);
  margin: 0 0 1.5rem;
  line-height: 1.2;
}
#planner-dialog .form-group {
  margin-bottom: 1.75rem;
}
#planner-dialog .form-label .optional {
  font-weight: 400;
  color: var(--muted);
}
#planner-dialog .form-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 58, 94, 0.12); }
#planner-dialog .form-input.input-error { border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
#planner-dialog textarea.form-input {
  resize: vertical;
  min-height: 72px;
}
#planner-dialog .plan-address-wrap {
  position: relative;
}
#planner-dialog .address-ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 8px 24px -4px rgba(29,58,94,0.18);
  list-style: none;
  padding: 4px;
  margin: 0;
  z-index: 500;
  overflow: hidden;
}
#planner-dialog .address-ac-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  line-height: 1.35;
}
#planner-dialog .address-ac-item:hover,
#planner-dialog .address-ac-item--active {
  background: var(--navy-light);
  color: var(--navy);
}
#planner-dialog .field-hint { font-size: 0.74rem; color: var(--muted); opacity: 0.8; margin: 0.4rem 0 0; }
#planner-dialog .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#planner-dialog .chip.chip--active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
#planner-dialog .form-input--hero {
  font-size: 1rem;
  line-height: 1.55;
  /* Permanent navy border + soft glow from page load, matching Scout's
     .ls-textarea (border: 2px solid var(--amber) + a constant box-shadow) —
     the hero field should read as the primary input even before it's touched. */
  border: 2px solid var(--navy);
  box-shadow: 0 0 0 3px rgba(29, 58, 94, 0.09);
}
#planner-dialog .form-input--hero:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 58, 94, 0.15); }
#planner-dialog .char-count {
  display: block;
  margin: 0.35rem 0 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: end;
}
#planner-dialog .form-error {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: #b91c1c;
  margin-bottom: 1.25rem;
}
#planner-dialog .planner-btn-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}
#planner-dialog .planner-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 160ms, border-color 160ms;
}
#planner-dialog .planner-secondary-btn svg { width: 16px; height: 16px; }
#planner-dialog .planner-secondary-btn:hover { background: var(--navy-light); border-color: var(--border-strong); }
#planner-dialog .plan-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  padding: 0.9rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 160ms;
}
#planner-dialog .plan-submit-btn:hover { opacity: 0.88; }
#planner-dialog .plan-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#planner-dialog .plan-submit-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
#planner-dialog .wrapup-feedback textarea.form-input { margin-top: 0.65rem; resize: none; width: 100%; text-align: left; font-size: 0.9rem; }
#planner-dialog .share-label { display: flex; align-items: flex-start; gap: 0.4rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); cursor: pointer; text-align: left; }
#planner-dialog .clickwrap-notice {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin: 0.9rem 0 0;
  line-height: 1.5;
}
#planner-dialog .clickwrap-notice a { color: var(--navy); font-weight: 600; }
#planner-dialog .food-chip {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid #f0c48f;
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
}
#planner-dialog .food-chip:hover { background: #ffeed8; }
#planner-dialog .food-chip--on { background: #ffd9a8; border-color: #e58a1f; }
#planner-dialog .food-chip:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
#planner-dialog .planner-sub { margin: -0.4rem 0 1.25rem; font-size: 0.95rem; color: var(--muted); }
#planner-dialog #plan-note:placeholder-shown ~ .char-count { display: none; }
#planner-dialog #plan-note:not(:placeholder-shown) ~ .note-range { display: none; }
#planner-dialog .customize { margin: 0.4rem 0 1.25rem; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
#planner-dialog .customize__summary {
  display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem; align-items: center;
  padding: 0.85rem 1rem; cursor: pointer; list-style: none;
}
#planner-dialog .customize__summary::-webkit-details-marker { display: none; }
#planner-dialog .customize__title { font-weight: 800; font-size: 0.95rem; color: var(--navy); }
#planner-dialog .customize__line { grid-column: 1; font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
#planner-dialog .customize__edit {
  grid-column: 2; grid-row: 1 / span 2; padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1.5px solid var(--border-strong); font-size: 0.82rem; font-weight: 700; color: var(--navy);
}
#planner-dialog .customize[open] .customize__edit { background: var(--navy-light); }
#planner-dialog .customize[open] .customize__line { display: none; }
#planner-dialog .customize__group { padding: 0.9rem 1rem; border-top: 1px solid var(--border); }
#planner-dialog .plan-when .customize__group:first-child,
#planner-dialog .plan-more .customize__group:first-child { border-top: 0; }
#planner-dialog .customize__head { margin: 0 0 0.6rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber-strong); }
#planner-dialog .form-label--sub { margin-top: 0.85rem; font-size: 0.84rem; }
#planner-dialog .customize .time-row { margin-top: 0.7rem; }

/* Scout's own .share-label (its "email me" row) centres itself in a 340px column: not inside this form. */
#planner-dialog .share-label { justify-content: flex-start; max-width: none; }
.planner-dialog--loading { overflow: hidden !important; }

/* Getting around: four short options on one row on a phone (they used to wrap onto two). */
@media (max-width: 600px) {
  #planner-dialog #travel-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
  #planner-dialog #travel-chips .quickadd-chip { padding-inline: 0.2rem; text-align: center; font-size: 0.82rem; white-space: nowrap; }
}
