/* ==========================================================================
   Itinerary planner
   ========================================================================== */

.planner { position: relative; padding-top: clamp(170px, 15vw, 210px); }
.planner__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px clamp(32px, 5vw, 96px);
  align-items: end;
  margin-bottom: clamp(28px, 3vw, 44px);
}
.planner__lede > p { color: var(--muted); max-width: 40em; }
.pd-filter {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  transition: background-color 0.3s var(--ease), color 0.3s, border-color 0.3s;
}
.pd-filter:hover { border-color: var(--bone); }
.pd-filter[aria-pressed="true"] { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.pd-textbtn {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 4px;
  transition: background-size 0.5s var(--ease-out), color 0.3s;
}
.pd-textbtn:hover { color: var(--bone); background-size: 100% 1px; }

/* ---------- App frame ---------- */
.planner__app {
  display: grid;
  grid-template-columns: minmax(290px, 0.82fr) minmax(0, 1.4fr) minmax(310px, 0.9fr);
  height: calc(100vh - 88px);
  height: calc(100svh - 88px);
  min-height: 600px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.planner__controls,
.planner__plan {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  padding: 26px 0 40px;
}
.planner__controls { padding-right: clamp(18px, 2vw, 32px); border-right: 1px solid var(--line); }
.planner__plan { padding-left: clamp(18px, 2vw, 32px); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.planner__controls::-webkit-scrollbar,
.planner__plan::-webkit-scrollbar { width: 6px; }
.planner__controls::-webkit-scrollbar-thumb,
.planner__plan::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.pd-step {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 18px;
  padding: 0;
}
.pd-step span { font-style: italic; font-size: 0.95rem; color: var(--red-lit); }
.pd-block { border: 0; margin: 0 0 30px; padding: 0; min-width: 0; }

/* Day fields */
.pd-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.pd-field { display: grid; gap: 6px; min-width: 0; }
.pd-field--full { grid-column: 1 / -1; }
.pd-field > span,
.pd-label { font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--soft); }
.pd-field em,
.pd-label em { font-style: normal; text-transform: none; letter-spacing: 0.02em; opacity: 0.8; }
.pd-field input,
.pd-field select {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 6px 0 9px;
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--bone);
  -webkit-appearance: none;
  appearance: none;
}
.pd-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23efe8dc' stroke-opacity='.6'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  padding-right: 22px;
}
.pd-field select option { background: var(--ink-2); font-family: var(--sans); font-size: 1rem; }
.pd-field input::placeholder { color: rgba(239, 232, 220, 0.28); }
.pd-field input:focus,
.pd-field select:focus { outline: none; border-bottom-color: var(--red-lit); }
.pd-field input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.9); opacity: 0.6; }
.pd-stepper { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-strong); padding-bottom: 4px; }
.pd-stepper button { width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 1.1rem; line-height: 1; transition: background-color 0.3s, color 0.3s; }
.pd-stepper button:hover { background: var(--bone); color: var(--ink); }
.pd-stepper output { font-family: var(--serif); font-size: 1.35rem; }

/* Distillery list */
.pd-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.pd-filter { height: 32px; padding: 0 12px; font-size: 0.72rem; }
.pd-group + .pd-group { margin-top: 18px; }
.pd-group[hidden] { display: none; }
.pd-group__title {
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--soft);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.pd-item {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 8px 12px 2px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s;
}
.pd-item:hover { background: rgba(239, 232, 220, 0.03); }
.pd-item__check {
  position: relative;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: background-color 0.3s, border-color 0.3s;
}
.pd-item__check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--bone);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.3s var(--ease-out);
}
.pd-item[aria-pressed="true"] .pd-item__check { background: var(--red); border-color: var(--red); }
.pd-item[aria-pressed="true"] .pd-item__check::after { transform: rotate(45deg) scale(1); }
.pd-item__text { display: grid; gap: 2px; min-width: 0; }
.pd-item__name { font-family: var(--serif); font-size: 1.22rem; line-height: 1.2; }
.pd-item__note { font-size: 0.82rem; line-height: 1.45; color: var(--muted); }

/* ---------- Map ---------- */
.planner__map { position: relative; display: grid; place-items: center; padding: 16px; min-width: 0; overflow: hidden; }
.pd-map { position: relative; width: min(100%, calc(100svh - 120px)); aspect-ratio: 1; overflow: hidden; }
.pd-map__stage {
  --z: 1;
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transition: transform 1.1s var(--ease-in-out);
}
.pd-map__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* strokes are divided by the zoom so lines keep their weight as the map scales */
.pd-river { fill: none; stroke: rgba(207, 58, 64, 0.38); stroke-width: calc(1px / var(--z)); vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.pd-river--main { stroke: rgba(207, 58, 64, 0.55); stroke-width: calc(1.4px / var(--z)); }
.pd-route { fill: none; stroke: var(--red-lit); stroke-width: calc(2.4px / var(--z)); vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.pd-route--glow { stroke-width: calc(9px / var(--z)); opacity: 0.16; }
.pd-route--home { stroke-width: calc(1.4px / var(--z)); stroke-dasharray: 0.3 0.4; opacity: 0.7; }
.pd-map__markers { position: absolute; inset: 0; }
.pd-map__hint {
  position: absolute;
  right: 0;
  bottom: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--soft);
  pointer-events: none;
}
.pd-map__north { position: absolute; right: 0; top: 0; font-family: var(--serif); font-style: italic; color: var(--soft); text-align: center; }
.pd-map__north::before { content: ""; display: block; width: 1px; height: 28px; margin: 0 auto 6px; background: linear-gradient(var(--red-lit), transparent); }

.pd-marker {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translate(-11px, -50%) scale(calc(1 / var(--z)));
  transform-origin: 11px 50%;
  padding: 2px;
  z-index: 1;
  transition: transform 1.1s var(--ease-in-out);
}
.pd-marker--left { flex-direction: row-reverse; transform: translate(calc(-100% + 11px), -50%) scale(calc(1 / var(--z))); transform-origin: calc(100% - 11px) 50%; }
.pd-marker__dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
}
.pd-marker__dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bone);
  opacity: 0.75;
  box-shadow: 0 0 0 3px rgba(14, 12, 10, 0.7);
  transition: all 0.35s var(--ease-out);
}
.pd-marker__n { position: absolute; font-size: 0.62rem; font-weight: 500; color: var(--bone); opacity: 0; transition: opacity 0.3s; }
.pd-marker__label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--bone);
  text-shadow: 0 0 6px var(--ink), 0 0 2px var(--ink);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.3s, transform 0.4s var(--ease-out);
  pointer-events: none;
}
.pd-marker--left .pd-marker__label { transform: translateX(4px); }
.pd-marker:hover,
.pd-marker:focus-visible,
.pd-marker[aria-pressed="true"] { z-index: 3; }
.pd-marker:hover .pd-marker__label,
.pd-marker:focus-visible .pd-marker__label,
.pd-marker[aria-pressed="true"] .pd-marker__label { opacity: 1; transform: none; }
.pd-marker:hover .pd-marker__dot::before { opacity: 1; box-shadow: 0 0 0 3px rgba(14, 12, 10, 0.7), 0 0 0 4px var(--bone); }
.pd-marker[aria-pressed="true"] .pd-marker__dot::before { width: 18px; height: 18px; background: var(--red); opacity: 1; box-shadow: 0 0 0 3px rgba(14, 12, 10, 0.75), 0 0 0 7px rgba(207, 58, 64, 0.18); }
.pd-marker[aria-pressed="true"] .pd-marker__n { opacity: 1; }
.pd-marker:focus-visible { outline: none; }
.pd-marker:focus-visible .pd-marker__dot::before { box-shadow: 0 0 0 3px rgba(14, 12, 10, 0.7), 0 0 0 5px var(--red-lit); }

.pd-pin,
.pd-lunchpin {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 2;
  transition: left 0.6s var(--ease-out), top 0.6s var(--ease-out);
}
/* start pin reads leftwards so it doesn't collide with a same-named distillery */
.pd-pin { flex-direction: row-reverse; transform: translate(calc(-100% + 6px), -50%) scale(calc(1 / var(--z))); transform-origin: calc(100% - 6px) 50%; }
.pd-pin__dot { width: 11px; height: 11px; background: var(--bone); transform: rotate(45deg); box-shadow: 0 0 0 3px rgba(14, 12, 10, 0.8); }
.pd-pin__label,
.pd-lunchpin__label { font-family: var(--serif); font-style: italic; font-size: 1rem; white-space: nowrap; text-shadow: 0 0 6px var(--ink), 0 0 2px var(--ink); }
.pd-pin.is-offmap { flex-direction: row; transform: translate(-2px, -50%) scale(calc(1 / var(--z))); transform-origin: 2px 50%; }
.pd-pin.is-offmap .pd-pin__dot { width: 0; height: 0; background: none; transform: none; box-shadow: none; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-right: 11px solid var(--bone); }
.pd-lunchpin { flex-direction: column; gap: 3px; transform: translate(-50%, -7px) scale(calc(1 / var(--z))); transform-origin: 50% 7px; }
.pd-pin[hidden],
.pd-lunchpin[hidden] { display: none; }
.pd-lunchpin__dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--bone); background: var(--ink); }
.pd-lunchpin__label { font-size: 0.9rem; color: var(--muted); }

/* Far-off places on the edge of the view, arrow pointing their way, label reading inwards */
.pd-map__edges { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pd-edge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  pointer-events: auto;
  transform: translate(-13px, -50%);
  transition: left 1.1s var(--ease-in-out), top 1.1s var(--ease-in-out);
}
.pd-edge[hidden] { display: none; }
.pd-edge--flip { flex-direction: row-reverse; transform: translate(calc(-100% + 13px), -50%); }
.pd-edge__arrow { width: 18px; height: 18px; flex: none; display: grid; place-items: center; transform: rotate(var(--a, 0deg)); transition: transform 1.1s var(--ease-in-out); }
.pd-edge__arrow::before { content: ""; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 9px solid var(--bone); opacity: 0.6; transition: opacity 0.3s, border-color 0.3s; }
.pd-edge__label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  text-shadow: 0 0 6px var(--ink), 0 0 2px var(--ink);
  transition: color 0.3s;
}
.pd-edge:hover .pd-edge__label,
.pd-edge:focus-visible .pd-edge__label,
.pd-edge[aria-pressed="true"] .pd-edge__label { color: var(--bone); }
.pd-edge:hover .pd-edge__arrow::before { opacity: 1; }
.pd-edge[aria-pressed="true"] .pd-edge__arrow::before { border-left-color: var(--red-lit); opacity: 1; }
.pd-edge:focus-visible { outline: 1px solid var(--red-lit); outline-offset: 2px; }
.pd-edge--pickup { pointer-events: none; }
.pd-edge--pickup .pd-edge__label { font-family: var(--serif); font-style: italic; font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--bone); }

/* ---------- Shortlist ---------- */
[data-pd-plan] { flex: 1; }
.pd-empty { border: 1px dashed var(--line-strong); padding: 26px 24px; }
.pd-empty__title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.2; margin-bottom: 10px; }
.pd-empty p + p { margin-top: 10px; }
.pd-empty p:not(.pd-empty__title) { color: var(--muted); font-size: 0.95rem; }
.pd-empty__hint { font-family: var(--serif); font-style: italic; font-size: 1.05rem !important; }

.pd-shorthead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--soft); }
.pd-short__item { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pd-short__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(207, 58, 64, 0.16); }
.pd-short__text { display: grid; gap: 2px; min-width: 0; }
.pd-short__name { font-family: var(--serif); font-size: 1.25rem; line-height: 1.2; }
.pd-short__area { font-size: 0.6rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--soft); }
.pd-short__remove { width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 0.95rem; line-height: 1; color: var(--muted); transition: background-color 0.3s, color 0.3s; }
.pd-short__remove:hover { background: var(--bone); color: var(--ink); }
.pd-tip { margin-top: 16px; font-family: var(--serif); font-style: italic; font-size: 1.05rem; line-height: 1.4; color: var(--muted); }
.pd-details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 22px 0 18px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pd-details dt { font-size: 0.6rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--soft); }
.pd-details dd { margin: 4px 0 0; font-family: var(--serif); font-size: 1.1rem; line-height: 1.25; overflow-wrap: anywhere; }
.pd-note { font-size: 0.78rem; line-height: 1.55; color: var(--soft); margin-bottom: 10px; }
.pd-actions { display: grid; gap: 14px; justify-items: start; padding-top: 18px; }
.pd-actions .btn { width: 100%; justify-content: space-between; }
.btn:disabled { opacity: 0.35; pointer-events: none; }

/* Mobile summary bar */
.pd-bar { display: none; }

/* Toast */
.pd-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  padding: 12px 20px;
  background: var(--bone);
  color: var(--ink);
  font-size: 0.85rem;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease-out);
  max-width: calc(100vw - 32px);
}
.pd-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Send drawer ---------- */
.pd-drawer { position: fixed; inset: 0; z-index: 130; }
.pd-drawer[hidden] { display: none; }
.pd-drawer__scrim { position: absolute; inset: 0; background: rgba(10, 8, 7, 0.7); opacity: 0; transition: opacity 0.5s var(--ease); }
.pd-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 100%);
  background: var(--ink-2);
  border-left: 1px solid var(--line);
  padding: clamp(28px, 4vw, 56px);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.7s var(--ease-in-out);
}
.pd-drawer.is-open .pd-drawer__scrim { opacity: 1; }
.pd-drawer.is-open .pd-drawer__panel { transform: none; }
.pd-drawer__close { position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 1.3rem; }
.pd-drawer__intro { color: var(--muted); margin-bottom: 26px; }
.pd-drawer__form { display: grid; gap: 22px; }
.pd-drawer__form .field input,
.pd-drawer__form .field textarea { font-size: 1.25rem; }
.pd-drawer__form textarea { min-height: 90px; }
.pd-drawer__summary { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.pd-drawer__summary summary { cursor: pointer; font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.pd-drawer__summary pre { white-space: pre-wrap; font-family: var(--sans); font-size: 0.85rem; line-height: 1.6; color: var(--muted); margin: 12px 0 0; }
.pd-drawer__form .btn { justify-self: start; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .planner__app { grid-template-columns: minmax(270px, 0.85fr) minmax(0, 1.3fr) minmax(290px, 0.95fr); }
  .pd-fields { grid-template-columns: 1fr; }
}

@media (max-width: 1099px) {
  .planner { padding-bottom: 90px; }
  .planner__head { grid-template-columns: 1fr; }
  .planner__app { display: flex; flex-direction: column; height: auto; min-height: 0; border: 0; }
  .planner__controls,
  .planner__plan { overflow: visible; padding: 0; border: 0; }
  /* phone flow: your day -> map -> distilleries -> plan */
  .planner__controls { display: contents; }
  .planner__controls > .pd-block:first-child { order: 1; }
  .planner__map { order: 2; padding: 0; margin: 0 calc(var(--gutter) * -1) 36px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .planner__controls > .pd-block:last-child { order: 3; }
  .planner__plan { order: 4; }
  .pd-map { width: 100%; max-width: 640px; }
  .pd-fields { grid-template-columns: 1fr 1fr; }
  .pd-map__hint { right: var(--gutter); bottom: 10px; }
  .pd-map__north { right: var(--gutter); top: 10px; }
  .pd-marker__label { font-size: 0.52rem; letter-spacing: 0.14em; }
  .pd-pin__label, .pd-lunchpin__label, .pd-edge--pickup .pd-edge__label { font-size: 0.85rem; }
  .pd-edge__label { font-size: 0.52rem; letter-spacing: 0.14em; }
  .pd-actions { padding-bottom: 20px; }

  .pd-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    background: rgba(20, 17, 14, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--muted);
  }
  .pd-bar strong { color: var(--bone); font-weight: 500; }
  .pd-bar__actions { display: flex; align-items: center; gap: 14px; flex: none; }
  .pd-bar .btn { height: 44px; padding: 0 18px; }
  .pd-bar.is-empty .pd-bar__actions { display: none; }
  .pd-toast { bottom: 90px; }
}

@media (max-width: 520px) {
  .pd-fields { grid-template-columns: 1fr; }
  .pd-marker__label { display: none; }
  .pd-marker[aria-pressed="true"] .pd-marker__label { display: inline; }
}
