/* Trusted Web Studio demo kit — shared parts for concept-build mini-sites.
   Each demo sets: --d-bg, --d-surface, --d-ink, --d-muted, --d-line, --d-accent, --d-on-accent, --d-soft, --d-display, --d-body */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--d-bg); color: var(--d-ink); font-family: var(--d-body); line-height: 1.55; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--d-accent); outline-offset: 3px; border-radius: 4px; }
.d-wrap { max-width: 1120px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
@media (min-width: 720px) { .d-wrap { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }

/* Concept-build bar (Trusted Web Studio colours, same on every demo) */
.tws-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 60; background: #0a2340; color: #e8f1fa; font: 500 .82rem/1.3 "Nunito Sans", system-ui, sans-serif; border-bottom: 3px solid #ffaa33; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 61; background: #0a2340; }
.tws-bar .d-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-block: 9px; }
.tws-bar a { color: #e8f1fa; text-decoration: none; font-weight: 700; }
.tws-bar a:hover { color: #ffaa33; }
.tws-bar .tag { display: inline-flex; align-items: center; gap: 8px; }
.tws-bar .tag b { background: #ffaa33; color: #0c2238; border-radius: 999px; padding: 2px 9px; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.tws-bar .links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Buttons */
.d-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: var(--d-radius, 10px); border: 1.5px solid transparent; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.d-btn:hover { transform: translateY(-1px); }
.d-btn-primary { background: var(--d-accent); color: var(--d-on-accent); }
.d-btn-ghost { background: transparent; color: var(--d-ink); border-color: var(--d-line); }
.d-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Panels and fields */
.d-panel { background: var(--d-surface); border: 1px solid var(--d-line); border-radius: calc(var(--d-radius, 10px) + 6px); padding: clamp(18px, 3vw, 28px); }
.d-label { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--d-muted); margin-bottom: 8px; }
.d-input { width: 100%; padding: 11px 12px; border: 1px solid var(--d-line); border-radius: var(--d-radius, 10px); background: var(--d-bg); }
.d-step { display: grid; gap: 10px; }
.d-steps { display: grid; gap: 22px; }

/* Choice pills (party size, area, practitioner, filters) */
.d-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.d-pill { padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--d-line); background: var(--d-surface); cursor: pointer; font-weight: 600; font-size: .92rem; }
.d-pill[aria-pressed="true"] { background: var(--d-accent); border-color: var(--d-accent); color: var(--d-on-accent); }

/* Day strip and time slots */
.d-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(64px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.d-day { display: grid; gap: 2px; justify-items: center; padding: 10px 6px; border-radius: var(--d-radius, 10px); border: 1.5px solid var(--d-line); background: var(--d-surface); cursor: pointer; }
.d-day small { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--d-muted); }
.d-day strong { font-size: 1.15rem; }
.d-day[aria-pressed="true"] { border-color: var(--d-accent); background: var(--d-soft); }
.d-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.d-slot { padding: 10px 6px; border-radius: var(--d-radius, 10px); border: 1.5px solid var(--d-line); background: var(--d-surface); cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums; }
.d-slot[aria-pressed="true"] { background: var(--d-accent); border-color: var(--d-accent); color: var(--d-on-accent); }
.d-slot:disabled { text-decoration: line-through; opacity: .4; cursor: not-allowed; }

/* Confirmation */
.d-confirm { display: grid; gap: 10px; text-align: center; justify-items: center; padding: 10px 0; }
.d-confirm .tick { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--d-soft); color: var(--d-accent); animation: d-pop .5s cubic-bezier(.2,.7,.2,1) both; }
.d-confirm .tick svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.d-confirm dl { display: grid; grid-template-columns: auto auto; gap: 4px 16px; margin: 6px 0 0; text-align: left; }
.d-confirm dt { color: var(--d-muted); }
.d-confirm dd { margin: 0; font-weight: 700; }
@keyframes d-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.d-demo-note { font-size: .8rem; color: var(--d-muted); }

/* Toast (for "this is a demo" moments, e.g. WhatsApp) */
.d-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80; background: #0a2340; color: #e8f1fa; padding: 12px 16px; border-radius: 12px; font: 600 .9rem "Nunito Sans", system-ui, sans-serif; max-width: calc(100vw - 32px); box-shadow: 0 20px 40px -20px rgba(0,0,0,.5); animation: d-pop .3s ease both; }

/* Chat widget */
.d-chat-launch { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 70; display: inline-flex; align-items: center; gap: 10px; padding: 13px 18px; border: 0; border-radius: 999px; background: var(--d-accent); color: var(--d-on-accent); font-weight: 700; cursor: pointer; box-shadow: 0 16px 34px -14px rgba(0,0,0,.45); }
.d-chat-launch .live { width: 9px; height: 9px; border-radius: 50%; background: #4fcf8a; box-shadow: 0 0 0 3px rgba(79,207,138,.3); }
.d-chat { position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(82px + env(safe-area-inset-bottom, 0px)); z-index: 71; width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--d-surface); color: var(--d-ink); border: 1px solid var(--d-line); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 70px -25px rgba(0,0,0,.5); animation: d-pop .25s ease both; }
.d-chat header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--d-accent); color: var(--d-on-accent); }
.d-chat header .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); font-weight: 800; flex: none; }
.d-chat header strong { display: block; font-size: .95rem; }
.d-chat header div span { font-size: .75rem; opacity: .85; }
.d-chat header button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px; }
.d-log { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; background: var(--d-bg); }
.d-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: .93rem; line-height: 1.45; white-space: pre-line; }
.d-msg.bot { background: var(--d-surface); border: 1px solid var(--d-line); border-bottom-left-radius: 4px; }
.d-msg.me { background: var(--d-accent); color: var(--d-on-accent); justify-self: end; border-bottom-right-radius: 4px; }
.d-msg.note { justify-self: center; max-width: 100%; font-size: .75rem; color: var(--d-muted); background: none; padding: 2px; text-align: center; }
.d-typing { display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--d-surface); border: 1px solid var(--d-line); border-radius: 14px; width: fit-content; }
.d-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--d-muted); animation: d-dot .9s ease-in-out infinite; }
.d-typing i:nth-child(2) { animation-delay: .12s; } .d-typing i:nth-child(3) { animation-delay: .24s; }
@keyframes d-dot { 0%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-3px); opacity: 1; } }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--d-surface); }
.d-chips button { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--d-line); background: var(--d-bg); font-size: .8rem; font-weight: 600; cursor: pointer; }
.d-chips button:hover { border-color: var(--d-accent); }
.d-chat form { display: flex; gap: 8px; padding: 10px 12px 12px; background: var(--d-surface); }
.d-chat form input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 999px; border: 1px solid var(--d-line); background: var(--d-bg); }
.d-chat form button { border: 0; border-radius: 999px; padding: 0 16px; background: var(--d-accent); color: var(--d-on-accent); font-weight: 700; cursor: pointer; }
.d-chat .disclaim { font-size: .7rem; color: var(--d-muted); text-align: center; padding: 0 12px 10px; background: var(--d-surface); margin: 0; }
.d-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
