/* location.css — the delivery-address dialog, the address picker (also used by checkout), the self-updating "arrives …"
   lines, the header widget's text cap and the phone-width account-menu row, all driven by location.js. Every class is
   .kml- / .kmp- prefixed so nothing here can collide with styles.css; colours come from its :root tokens. */

/* --brand-red is only ~3:1 against --bg-alt, fine for a button fill but too dim for 12-13px text, so text that has to
   be read (errors, the Free 2-Day accent) uses these two lighter shades of the same hues. */
:root{
  --kml-ok:#2fc08f;
  --kml-err:#ff7388;
}

/* ================= HEADER WIDGET ================= */
/* The widget's text now reads "Delivering to Miami, FL 33101". Its markup, font sizes and line height stay exactly as
   styles.css has them (so the box keeps its two-line height and the slide/tuck/no-anim header animations measure the
   same thing); all this adds is a cap on how wide the text may grow — a long city ends in an ellipsis instead of
   pushing the rest of the header along. location.js adds the full text as a tooltip when it has been cut. */
.loc-widget .loc-text{ min-width:0; max-width:196px; }
.loc-widget .loc-text small{ display:flex; min-width:0; white-space:nowrap; }
.loc-widget .loc-text small b{ min-width:0; overflow:hidden; text-overflow:ellipsis; }
.loc-widget .loc-text u{ white-space:nowrap; }
/* Same two-line shape as the Account widget beside it: a small regular label on top ("Hi, Guest" / "Update Location"),
   the one bold line under it ("Account & Orders" / the city), same sizes and line heights, so the two read as a pair.
   The label is the <u> in the markup, so the column is flipped rather than the markup reordered. */
.loc-widget .loc-text{ flex-direction:column-reverse; }
.loc-widget .loc-text u{ font-size:10.4167px; line-height:14.0625px; font-weight:400; text-decoration:none; opacity:.9; }
.loc-widget .loc-text small{ font-size:12.5px; line-height:16.875px; opacity:1; }
.loc-widget .loc-text small b{ font-size:inherit; font-weight:700; }
/* While the search overlay is open, app.js slides this widget into the gap between the logo and the search bar. That gap
   is (viewport - 640px)/2 minus the logo (145px, with the widget's own 36px of icon and padding taken off), so the text is
   capped to what fits — the old "Delivering to 10001" always did — instead of running under the bar. At widths where
   even the old text overflowed the gap (under ~1210px) the floor keeps it that size. */
/* (No longer clamped here: app.js's wireLocationFit() decides whether the full widget fits the gap and otherwise drops it to its icon.) */
body.search-open .loc-widget .loc-text{ max-width:196px; }

/* ================= DIALOG ================= */
/* Same look as .overlay / .checkout-modal in styles.css, but its own element and a higher z-index (130): it has to
   open on top of whatever is already up — checkout, the cart drawer, the filters panel — and must not be swept up by
   the generic .overlay wiring in app.js, which would close it behind location.js's back. */
.kml-overlay{
  position:fixed; inset:0; z-index:130; display:flex; align-items:center; justify-content:center;
  padding:20px; background:rgba(0,0,0,.5); overscroll-behavior:contain;
}
.kml-overlay[hidden]{ display:none; }
.kml-modal [hidden]{ display:none !important; }
.kml-modal{
  /* The padding the dialog's contents sit in (.kml-pad) and the sticky Apply bar (.kml-actions) both use; declared here, on
     the scroller, so scroll-padding below can be worked out from them. Phones override them in the media query. */
  --kml-px:28px; --kml-pb:28px;
  position:relative; width:100%; max-width:480px;
  max-height:calc(100vh - 40px); max-height:calc(100dvh - 40px);
  overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain;
  /* Things scrolled or focused into view stop short of the sticky Apply bar (12px + 46px button + bottom padding + its
     1px border) instead of ending up underneath it. */
  scroll-padding-bottom:calc(12px + 46px + var(--kml-pb) + 1px + 12px);
  background:var(--bg-alt); color:var(--ink); border-radius:12px; box-shadow:var(--shadow-lg);
  font-size:14px; line-height:1.45;
  animation:kmlIn .18s ease-out;
}
.kml-modal:focus{ outline:none; }
@keyframes kmlIn{ from{ opacity:0; transform:translateY(8px) scale(.985); } to{ opacity:1; transform:none; } }

.kml-close{
  position:absolute; top:14px; right:14px; z-index:2; width:32px; height:32px; padding:0;
  display:flex; align-items:center; justify-content:center;
  background:var(--line); color:var(--ink); border:none; border-radius:50%; cursor:pointer;
}
.kml-close:hover{ background:var(--line-strong); }

.kml-pad{ padding:var(--kml-pb) var(--kml-px); }
.kml-title{ margin:0 40px 6px 0; font-size:19px; font-weight:800; line-height:1.25; }
.kml-lead{ margin:0 0 18px; color:var(--muted); font-size:13.5px; line-height:1.5; }

.kml-err{ margin:12px 0 0; font-size:13px; font-weight:600; color:var(--kml-err); }
.kml-err:empty{ display:none; }

.kml-apply{
  width:100%; height:46px; padding:0 24px;
  background:var(--btn-bg); color:var(--btn-ink); border:none; border-radius:6px;
  font:inherit; font-size:14.5px; font-weight:700; cursor:pointer;
}
.kml-apply:hover{ background:var(--btn-bg-hover); color:var(--btn-ink);}
.kml-actions{
  /* Stays at the foot of the dialog while its (tall) contents scroll, so Apply is never off-screen on a phone. */
  position:sticky; bottom:0; z-index:1; margin:16px calc(var(--kml-px) * -1) calc(var(--kml-pb) * -1);
  padding:12px var(--kml-px) var(--kml-pb); background:var(--bg-alt); border-top:1px solid var(--line);
}

.kml-apply:focus-visible, .kml-close:focus-visible, .kml-saved-remove:focus-visible, .kmp-find:focus-visible, .kmp-link:focus-visible{
  outline:2px solid #fff; outline-offset:2px;
}

/* ---- saved addresses: radio cards ---- */
.kml-saved{ margin:0 0 16px; }
.kml-sub{ margin:0 0 8px; font-size:10.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:var(--muted); }
.kml-saved-list{ display:grid; gap:8px; }
.kml-saved-row{ display:flex; align-items:center; gap:6px; }
.kml-saved-card{
  flex:1 1 auto; min-width:0; display:flex; align-items:flex-start; gap:12px; padding:12px 14px;
  background:var(--bg); border:1px solid var(--line-strong); border-radius:8px; cursor:pointer;
}
.kml-saved-card:hover{ border-color:var(--muted); }
.kml-saved-row.is-sel .kml-saved-card{ border-color:#ffffff; background:rgba(255,255,255,0.064); }
.kml-radio{ flex:0 0 auto; width:18px; height:18px; margin:1px 0 0; accent-color:#ffffff; cursor:pointer; }
.kml-saved-body{ display:flex; flex-direction:column; align-items:flex-start; min-width:0; overflow-wrap:anywhere; }
.kml-saved-street{ font-size:14px; font-weight:700; }
.kml-saved-city{ font-size:13px; color:var(--muted); }
.kml-saved-tag{
  align-self:flex-start; margin-top:5px; padding:1px 8px; border-radius:999px;
  background:rgba(47,192,143,.14); color:var(--kml-ok); font-size:11px; font-weight:800; letter-spacing:.02em;
}
.kml-saved-new .kml-saved-street{ font-weight:600; }
.kml-saved-remove{
  flex:0 0 auto; padding:10px 6px; background:none; border:none; color:var(--muted); cursor:pointer;
  font:inherit; font-size:13px; font-weight:600; text-decoration:underline; text-underline-offset:2px;
}
.kml-saved-remove:hover{ color:var(--kml-err); }
/* The card with the keyboard on it, not just any card the mouse touched. */
.kml-saved-card:focus-within{ outline:2px solid #fff; outline-offset:2px; }
@supports selector(:has(*)){
  .kml-saved-card:focus-within{ outline:none; }
  .kml-saved-card:has(:focus-visible){ outline:2px solid #fff; outline-offset:2px; }
}

/* ---- the live confirmation card: sits one step darker than the modal (--bg) like a recessed panel ---- */
.kml-result{ margin-top:18px; }
.kml-result:empty{ display:none; }
.kml-card{ background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:14px 16px; }
.kml-where{ display:flex; align-items:flex-start; gap:10px; font-size:14.5px; }
.kml-where svg{ flex:0 0 auto; margin-top:2px; color:#ffffff; }
.kml-where-text{ display:flex; flex-direction:column; min-width:0; overflow-wrap:anywhere; }
.kml-where-city{ color:var(--muted); font-size:12.5px; font-weight:600; }
.kml-rows{ list-style:none; margin:12px 0 0; padding:0; display:grid; gap:10px; }
.kml-row{ display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 10px; }
.kml-tag{
  padding:2px 9px; border-radius:999px; background:var(--line); color:var(--ink);
  font-size:12px; font-weight:800; white-space:nowrap;
}
.kml-tag-free-2-day{ background:rgba(47,192,143,.14); color:var(--kml-ok); }
.kml-when{ font-size:14px; }
.kml-when b{ font-weight:800; }
.kml-cap{ flex:1 0 100%; font-size:12px; color:var(--muted); }
.kml-note{
  margin:12px 0 0; padding:9px 11px; background:var(--line); border-radius:6px;
  font-size:12.5px; line-height:1.45;
}
.kml-ships{ margin:12px 0 0; padding-top:12px; border-top:1px solid var(--line); font-size:13px; }
.kml-fine{ margin:4px 0 0; font-size:12px; color:var(--muted); }

/* Spoken only — the ": " between "Free 2-Day" and "arrives …" that the layout shows as a gap, and the dialog's own
   announcements ("Removed 12 Analytical Way …"). */
.kml-sr{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden;
  clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0;
}

/* Phones: pin the dialog to the top rather than the middle. With the on-screen keyboard up (iOS does not shrink the
   fixed layer) a centred dialog slides under the keyboard along with the field the shopper is typing in. */
@media (max-width:560px){
  .kml-overlay{ align-items:flex-start; padding:16px; }
  .kml-modal{ --kml-px:18px; --kml-pb:20px; }
  .kml-pad{ padding-top:22px; }
}
@media (prefers-reduced-motion:reduce){
  .kml-modal{ animation:none; }
}

/* ================= ADDRESS PICKER (KMLocation.mountPicker) ================= */
/* Self-contained: it sits in the dialog and in checkout, so it sets its own colours, field look and sizes rather than
   leaning on either one's form styles. */
.kmp{ color:var(--ink); font-size:14px; line-height:1.45; text-align:left; }
.kmp [hidden]{ display:none !important; }
.kmp-label{ display:block; margin:0 0 5px; font-size:12.5px; font-weight:600; color:var(--muted); }
.kmp-opt{ font-weight:400; }

.kmp-field{ display:flex; gap:10px; }
/* 16px on phones (below): iOS Safari zooms the whole page into any smaller field when it is focused. */
.kmp-input{
  display:block; width:100%; min-width:0; height:46px; padding:0 12px;
  background:var(--line); color:var(--ink); border:1px solid var(--line-strong); border-radius:6px;
  font:inherit; font-size:15px;
}
.kmp-field .kmp-input{ flex:1 1 auto; width:auto; }
.kmp-input::placeholder{ color:var(--muted); opacity:.8; }
.kmp-input:focus{ outline:2px solid #ffffff; outline-offset:1px; }
.kmp-input[aria-invalid="true"]{ border-color:var(--kml-err); }
.kmp-select{ color-scheme:dark; text-overflow:ellipsis; }
.kmp-find{
  flex:0 0 auto; min-width:78px; height:46px; padding:0 20px;
  background:var(--btn-bg); color:var(--btn-ink); border:none; border-radius:6px;
  font:inherit; font-size:14.5px; font-weight:700; cursor:pointer; white-space:nowrap;
}
.kmp-find:hover{ background:var(--btn-bg-hover); color:var(--btn-ink);}
.kmp-find:disabled{ background:var(--line-strong); color:var(--muted); cursor:progress; }
.kmp-note{ margin:6px 0 0; font-size:12px; color:var(--muted); }

/* What the search is doing / found. Empty means nothing to say, so it takes no room. */
.kmp-status{ margin:10px 0 0; font-size:13px; line-height:1.45; color:var(--muted); }
.kmp-status:empty{ display:none; }
/* "Address search is taking a while": the status line plus a button for typing the address by hand, right beneath it. */
.kmp-notice{ margin-top:2px; }
.kmp-status.is-busy::before{
  content:''; display:inline-block; width:11px; height:11px; margin-right:8px; vertical-align:-1px;
  border:2px solid var(--line-strong); border-top-color:#ffffff; border-radius:50%;
  animation:kmpSpin .7s linear infinite;
}
@keyframes kmpSpin{ to{ transform:rotate(360deg); } }

/* The verified matches: radio cards, one per address. The real radio stays (arrow keys, Space, screen readers). */
.kmp-matches{ display:grid; gap:8px; margin-top:10px; }
/* The text was edited after this list came back: dimmed and locked until the new answer replaces it (location.js). */
.kmp-matches.is-stale{ opacity:.45; pointer-events:none; }
.kmp-matches.is-stale .kmp-match, .kmp-matches.is-stale .kmp-radio{ cursor:progress; }
.kmp-match{
  display:flex; align-items:flex-start; gap:12px; padding:11px 14px;
  background:var(--bg); border:1px solid var(--line-strong); border-radius:8px; cursor:pointer;
}
.kmp-match:hover{ border-color:var(--muted); }
.kmp-match.is-sel{ border-color:#ffffff; background:rgba(255,255,255,0.064); }
.kmp-match.is-off{ opacity:.7; cursor:not-allowed; }
.kmp-match.is-off:hover{ border-color:var(--line-strong); }
.kmp-radio{ flex:0 0 auto; width:18px; height:18px; margin:1px 0 0; accent-color:#ffffff; cursor:pointer; }
.kmp-match.is-off .kmp-radio{ cursor:not-allowed; }
.kmp-match-body{ display:flex; flex-direction:column; min-width:0; overflow-wrap:anywhere; }
.kmp-match-street{ font-weight:700; }
.kmp-match-city{ font-size:13px; color:var(--muted); }
.kmp-match-why{ margin-top:3px; font-size:12.5px; font-weight:600; color:var(--kml-err); }
.kmp-match:focus-within{ outline:2px solid #fff; outline-offset:2px; }
@supports selector(:has(*)){
  .kmp-match:focus-within{ outline:none; }
  .kmp-match:has(:focus-visible){ outline:2px solid #fff; outline-offset:2px; }
}

.kmp-unit-row, .kmp-row + .kmp-row, .kmp-row + .kmp-row2, .kmp-row2 + .kmp-row{ margin-top:12px; }
.kmp-unit-row{ margin-top:14px; }
.kmp-row2{ display:grid; grid-template-columns:minmax(0,1.25fr) minmax(0,1fr); gap:10px; margin-top:12px; }
.kmp-row2 > .kmp-row + .kmp-row{ margin-top:0; }

.kmp-toggle-row{ margin-top:8px; }
.kmp-link{
  padding:8px 0; background:none; border:none; color:var(--ink); cursor:pointer;
  font:inherit; font-size:13.5px; font-weight:600; text-decoration:underline; text-underline-offset:2px;
}
.kmp-link:hover{ color:var(--brand-gold-light); }
.kmp-err{ margin:6px 0 0; font-size:13px; font-weight:600; color:var(--kml-err); }
.kmp-err:empty{ display:none; }

@media (max-width:700px), (pointer:coarse){
  .kmp-input{ font-size:16px; }
}
@media (prefers-reduced-motion:reduce){
  .kmp-status.is-busy::before{ animation:none; }
}

/* ================= DELIVERY LINES (KMLocation.etaHTML) ================= */
/* Sized in em so the page that hosts the line (product card, cart row, checkout) sets the scale; only colour and
   weight are decided here. Compact is one inline phrase; the full version adds the "To Miami, FL 33101 · Change" line. */
[data-km-eta]{ display:flex; flex-direction:column; gap:2px; line-height:1.4; }
[data-km-eta][data-compact]{ display:inline; }
.kml-eta-main{ color:var(--ink); }
.kml-eta-method{ font-weight:700; }
.kml-m-free-2-day{ color:var(--kml-ok); }
.kml-eta-when b{ font-weight:700; }
.kml-eta-sub, .kml-eta-note{ font-size:.92em; color:var(--muted); }
.kml-eta-link{
  display:inline-flex; align-items:center; gap:.4em; margin:0; padding:0;
  background:none; border:none; color:var(--ink); cursor:pointer;
  font:inherit; text-decoration:underline; text-underline-offset:2px;
}
.kml-eta-link:hover{ color:var(--brand-gold-light); }
.kml-eta-link svg{ flex:0 0 auto; color:#ffffff; }
.kml-eta-link:focus-visible{ outline:2px solid var(--brand-gold-light); outline-offset:2px; border-radius:2px; }
[data-km-eta]:focus{ outline:none; }

/* ================= ACCOUNT MENU ROW (phones) ================= */
/* The header widget disappears at 860px (see styles.css), so the same dialog is reachable from the account menu.
   Hidden above that width. The ".acct-menu " prefix is needed to out-rank ".acct-menu button" in styles.css. */
.acct-menu .kml-acct-item, .acct-menu .kml-acct-sep{ display:none; }
@media (max-width:860px){
  .acct-menu .kml-acct-item{ display:flex; align-items:center; gap:8px; max-width:min(280px, calc(100vw - 48px)); white-space:nowrap; }
  .acct-menu .kml-acct-item svg{ flex:0 0 auto; color:#ffffff; }
  .acct-menu .kml-acct-label{ flex:0 0 auto; }
  .acct-menu .kml-acct-city{ min-width:0; overflow:hidden; text-overflow:ellipsis; font-weight:800; }
  .acct-menu .kml-acct-sep{ display:block; height:1px; margin:6px 4px; background:var(--line); }
}
