/* The Cookie Club: the two things a browser would otherwise draw for us, in our own look.
     .dp      the calendar that opens from a date box (static/assets/js/date-picker.js)
     .ui-ask  a question with two answers, in place of the browser's own "OK / Cancel" box
              (static/assets/js/ask.js; the admin has its own, in admin.css)
   Used on the shop's pages and in the admin alike, so it carries its own colours (Kate's Sand palette)
   and asks nothing of the page it's on but its fonts. Loaded by the scripts that need it.

   A calendar sits inside whatever form its date box was in, and that form has rules of its own for the
   buttons, labels and paragraphs in it ("every button in this form spans the row"). None of them may
   bend the calendar, so what its shape depends on is marked !important here, and only here. */

.dp, .ui-ask {
  --ui-paper: #fff;
  --ui-soft: #f7eae2;
  --ui-sand: #f2decc;
  --ui-line: #d5c3b2;
  --ui-brown: #876345;
  --ui-ink: #5b412b;
  --ui-muted: #76573d;
  --ui-on: #fff9f3;
  --ui-shade: 104, 75, 50;
  --ui-display: var(--font-display, 'Bagel Fat One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif);
  --ui-body: var(--font-body, 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif);
  --ui-ease: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ============================== the calendar ============================== */
/* The page's own date box stays where it is, holding the date as it always did (so everything that reads
   it carries on working). It's taken out of sight, and this stands in its place. */
.dp-src { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: -1px !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; overflow: hidden !important; clip-path: inset(50%) !important; pointer-events: none !important; }
.dp { position: relative; display: block; min-width: 0; font-family: var(--ui-body); text-align: left; }
.dp, .dp * { box-sizing: border-box !important; float: none !important; text-transform: none !important; letter-spacing: 0 !important; text-indent: 0 !important; text-shadow: none !important; }

/* What's pressed to open it. It wears the size, edge and colours of the box it replaced (set by the
   script), so it sits in each form as that form's other boxes do. */
.dp-field { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 10px; width: 100% !important; min-width: 0 !important; max-width: none !important; min-height: 48px; margin: 0 !important; padding: 0 12px 0 16px; border: 2px solid #a08a76; border-radius: 16px; background: #fff; color: var(--ui-ink); font: 700 1rem/1.2 var(--ui-body); text-align: left !important; white-space: nowrap !important; cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
.dp-field:focus-visible { outline: 3px solid var(--ui-brown) !important; outline-offset: 2px; }
.dp-field[disabled] { opacity: 0.55; cursor: not-allowed; }
.dp-field.is-bad { border-color: #b4432f !important; }
.dp-value { display: block !important; flex: 1 1 auto !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: inherit; color: inherit; }
.dp-value.is-empty { color: var(--ui-muted); font-weight: 600; }
.dp-ico { display: block !important; flex: none !important; width: 22px !important; height: 22px !important; margin: 0 !important; color: var(--ui-brown); }
/* A narrow box (two side by side in a row of the admin) gives the day what room it has. */
.dp-field.is-tight { gap: 6px; padding-right: 9px; }
.dp-field.is-tight .dp-ico { width: 18px !important; height: 18px !important; }
.dp-msg { display: block; margin: 6px 0 0 !important; padding: 0 !important; font: 800 0.9rem/1.35 var(--ui-body) !important; color: #8a2c1c !important; }
.dp-msg[hidden] { display: none !important; }
.dp-name { display: none !important; }

/* A day and a time together: the calendar's box, and a small box for the time beside it. */
.dp-dt { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; min-width: 0; margin: 0; }
.dp-dt-day { display: block; min-width: 0; }
.dp-dt-day > input, .dp-dt-day > .dp { margin-top: 0 !important; margin-bottom: 0 !important; }
.dp-dt-time { width: 8.4rem !important; min-width: 0 !important; margin: 0 !important; font-variant-numeric: tabular-nums; }
.dp-dt-time:disabled { opacity: 0.55; }
/* Until a day is chosen there's no time to set, so the day has the row to itself. */
.dp-dt-time[hidden] { display: none !important; }
.dp-dt:has(> .dp-dt-time[hidden]) { grid-template-columns: minmax(0, 1fr); }

/* The calendar itself: a white card that opens under the box. */
.dp-pop { display: block !important; position: fixed !important; z-index: 90; left: 0; top: 0; width: 332px !important; min-width: 0 !important; max-width: calc(100vw - 16px) !important; height: auto !important; margin: 0 !important; padding: 16px 16px 14px !important; border: 0 !important; border-radius: 26px !important; background: var(--ui-paper) !important; color: var(--ui-ink) !important; box-shadow: 0 30px 70px -26px rgba(var(--ui-shade), 0.62), 0 4px 16px rgba(91, 65, 43, 0.1) !important; font: 700 1rem/1.2 var(--ui-body) !important; text-align: left !important; white-space: normal !important; cursor: default; transform-origin: 24px 0; animation: dp-in 0.16s var(--ui-ease); }
.dp-pop[hidden] { display: none !important; }
.dp-pop.is-above { transform-origin: 24px 100%; }
@keyframes dp-in { from { opacity: 0; transform: scale(0.96); } }

.dp-head { display: flex !important; align-items: center !important; gap: 8px !important; width: auto !important; margin: 0 0 10px !important; padding: 0 2px 0 8px !important; }
.dp-month { display: block !important; flex: 1 1 auto !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; font: 400 1.45rem/1.1 var(--ui-display) !important; color: var(--ui-brown) !important; text-align: left !important; }
.dp-nav { display: grid !important; place-items: center !important; flex: none !important; width: 40px !important; height: 40px !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: var(--ui-soft) !important; color: var(--ui-ink) !important; box-shadow: none !important; cursor: pointer; transition: background-color 0.15s ease; -webkit-tap-highlight-color: transparent; }
.dp-nav svg { display: block !important; width: 18px !important; height: 18px !important; margin: 0 !important; }
.dp-nav[disabled] { opacity: 0.35 !important; cursor: default; }
.dp-nav:focus-visible, .dp-day:focus-visible, .dp-clear:focus-visible { outline: 3px solid var(--ui-brown) !important; outline-offset: 2px !important; }

.dp-grid { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; grid-auto-flow: row !important; gap: 2px 0 !important; width: auto !important; margin: 0 !important; padding: 0 !important; }
.dp-grid > * { grid-column: auto !important; grid-row: auto !important; min-width: 0 !important; min-height: 0 !important; margin: 0 !important; }
.dp-dow { display: grid !important; place-items: center !important; height: 30px !important; padding: 0 !important; font: 800 0.8rem/1 var(--ui-body) !important; color: var(--ui-muted) !important; }
.dp-day { position: relative !important; justify-self: center !important; align-self: center !important; display: grid !important; place-items: center !important; width: 40px !important; height: 40px !important; max-width: none !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: none !important; color: var(--ui-ink) !important; box-shadow: none !important; font: 800 1rem/1 var(--ui-body) !important; font-variant-numeric: tabular-nums; text-align: center !important; cursor: pointer; transition: background-color 0.12s ease; -webkit-tap-highlight-color: transparent; }
.dp-day.is-today { box-shadow: inset 0 0 0 2px var(--ui-line) !important; }
.dp-day[disabled] { color: rgba(91, 65, 43, 0.3) !important; box-shadow: none !important; opacity: 1 !important; cursor: default; }
/* The day that's chosen is the biscuit: brown, with a bite out of it. */
.dp-day.is-on { background: var(--ui-brown) !important; color: var(--ui-on) !important; box-shadow: none !important; -webkit-mask: radial-gradient(circle at 90% 10%, transparent 6.5px, #000 7px); mask: radial-gradient(circle at 90% 10%, transparent 6.5px, #000 7px); }
@media (hover: hover) and (pointer: fine) {
  .dp-day:not([disabled]):not(.is-on):hover { background: var(--ui-sand) !important; }
  .dp-nav:not([disabled]):hover { background: var(--ui-sand) !important; }
}
.dp-foot { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 12px !important; min-height: 0 !important; margin: 10px 0 0 !important; padding: 10px 8px 0 !important; border: 0 !important; border-top: 2px dashed var(--ui-sand) !important; font: 700 0.9rem/1.35 var(--ui-body) !important; color: var(--ui-muted) !important; }
.dp-foot:empty { display: none !important; }
.dp-clear { display: inline-block !important; width: auto !important; min-width: 0 !important; min-height: 0 !important; margin: 0 0 0 auto !important; padding: 6px 2px !important; border: 0 !important; border-radius: 6px !important; background: none !important; color: var(--ui-ink) !important; box-shadow: none !important; font: 800 0.92rem/1.2 var(--ui-body) !important; text-decoration: underline !important; text-underline-offset: 3px; cursor: pointer; }

/* On a phone it comes up from the bottom of the screen, with room for a thumb. */
.dp-scrim { display: block !important; position: fixed !important; inset: 0 !important; z-index: 89; width: auto !important; height: auto !important; margin: 0 !important; background: rgba(91, 65, 43, 0.45) !important; animation: dp-dim 0.2s ease; }
.dp-scrim[hidden] { display: none !important; }
@keyframes dp-dim { from { opacity: 0; } }
.dp-pop.is-sheet { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-width: none !important; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)) !important; border-radius: 30px 30px 0 0 !important; transform-origin: 50% 100%; animation: dp-up 0.24s var(--ui-ease); }
@keyframes dp-up { from { transform: translateY(100%); } }
.dp-pop.is-sheet .dp-grid { gap: 4px 0 !important; max-width: 420px; margin-inline: auto !important; }
.dp-pop.is-sheet .dp-head, .dp-pop.is-sheet .dp-foot { max-width: 420px; margin-inline: auto !important; }
.dp-pop.is-sheet .dp-day { width: 44px !important; height: 44px !important; font-size: 1.05rem !important; }
.dp-pop.is-sheet .dp-nav { width: 44px !important; height: 44px !important; }
@media (prefers-reduced-motion: reduce) { .dp-pop, .dp-pop.is-sheet, .dp-scrim { animation: none; } .dp-day, .dp-nav { transition: none; } }

/* ============================== a question, and its two answers ============================== */
.ui-ask { box-sizing: border-box; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 28px 28px 24px; border: 0; border-radius: 32px; background: var(--ui-paper); color: var(--ui-ink); box-shadow: 0 30px 70px -24px rgba(var(--ui-shade), 0.7); font: 600 1.02rem/1.5 var(--ui-body); overflow: auto; animation: ui-ask-in 0.18s var(--ui-ease); }
.ui-ask::backdrop { background: rgba(91, 65, 43, 0.5); animation: dp-dim 0.18s ease; }
@keyframes ui-ask-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.ui-ask h2 { margin: 0 0 12px; font: 400 clamp(1.5rem, 4.6vw, 1.85rem)/1.05 var(--ui-display); letter-spacing: 0; color: var(--ui-brown); text-wrap: balance; }
.ui-ask h2:focus { outline: none; }
.ui-ask p { margin: 0 0 10px; max-width: 46ch; text-wrap: pretty; }
/* Side by side where each fits on one line, one above the other (the safe answer underneath) where not. */
.ui-ask-btns { display: flex; flex-wrap: wrap-reverse; gap: 12px; margin-top: 22px; }
.ui-ask-btns button { flex: 1 1 auto; min-width: 0; min-height: 52px; padding: 8px 20px; border: 0; border-radius: 999px; font: 900 1.02rem/1.15 var(--ui-body); text-wrap: balance; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 0.12s ease; }
.ui-ask-btns button:active { transform: translateY(3px); }
.ui-ask-no { background: var(--ui-soft); color: var(--ui-ink); box-shadow: 0 5px 0 var(--ui-line); }
.ui-ask-yes { background: var(--ui-brown); color: var(--ui-on); box-shadow: 0 5px 0 #694b32; }
.ui-ask-yes.is-danger { background: #a13a28; box-shadow: 0 5px 0 #7c2a1b; }
.ui-ask-no:active { box-shadow: 0 2px 0 var(--ui-line); }
.ui-ask-yes:active { box-shadow: 0 2px 0 #694b32; }
.ui-ask-yes.is-danger:active { box-shadow: 0 2px 0 #7c2a1b; }
.ui-ask-btns button:focus-visible { outline: 3px solid var(--ui-brown); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .ui-ask, .ui-ask::backdrop { animation: none; } .ui-ask-btns button { transition: none; } }
