/* Automations page: click-through demos (automations-demo.js). Styled with the v2 tokens (tokens.css).
   Reuses tokens and pieces from styles.css (.btn, .phone, .screen, .notch, .chat-head,
   .chat-av, .auto-tag, .sample-tag, .eyebrow, @keyframes ring). Linked only from automations.html. */

/* Gallery: the "Try the demo" button sits on the card's thumbnail. It is a sibling of the
   card <button> (buttons can't nest), stacked in the same grid cell. */
.ad-cell { display: grid; min-width: 0; }
.ad-cell > * { grid-area: 1 / 1; }
.ad-try { position: relative; z-index: 2; align-self: start; justify-self: start; margin: 32px 0 0 32px; transition: transform 0.25s, box-shadow 0.2s; }
.ad-try[hidden] { display: none; }
.ad-try svg { width: 12px; height: 12px; }
.ad-cell:has(.ph-card:hover) .ad-try { transform: translateY(-4px); }

/* Dialog */
.ad-dialog {
  width: min(960px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--lp-line-2); border-radius: var(--lp-r-xl); color: var(--lp-text);
  background: radial-gradient(80% 50% at 50% 0%, rgb(255 255 255 / 0.05), transparent 70%), var(--lp-surface-1);
  box-shadow: var(--lp-elev-3);
  overflow: auto; overscroll-behavior: contain;
}
.ad-dialog[open] { animation: ad-in var(--lp-t-3) var(--lp-ease); }
.ad-dialog::backdrop { background: rgb(4 5 6 / 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ad-dialog:focus { outline: none; }
.ad-inner { container: ad / inline-size; display: grid; gap: 18px; padding: clamp(16px, 3vw, 30px); }
.ad-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ad-heading { display: grid; gap: 6px; min-width: 0; }
.ad-title { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.1; letter-spacing: -0.03em; color: var(--lp-text); }
.ad-status-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; min-height: 4.6em; padding: 12px 16px; border-radius: var(--lp-r-md); border: 1px solid var(--lp-line); background: var(--lp-surface-2); box-shadow: inset 0 1px 0 var(--lp-highlight); }
.ad-count { flex: none; font: 500 var(--lp-fs-xs)/1.2 var(--lp-font-mono); color: var(--lp-accent-hi); font-variant-numeric: tabular-nums; }
.ad-caption { flex: 1 1 16em; min-width: 0; font-size: 0.9375rem; line-height: 1.5; color: var(--lp-text-2); }
.ad-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.ad-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Stage and panes. Wide: panes side by side, the one in play is lit.
   Narrow: only the pane in play shows. */
.ad-stage { display: flex; justify-content: center; align-items: flex-start; gap: clamp(16px, 4vw, 48px); min-width: 0; }
.ad-pane { flex: 0 1 270px; min-width: 0; display: grid; justify-items: center; gap: 10px; opacity: 0.4; filter: saturate(0.6); transition: opacity var(--lp-t-3) var(--lp-ease), filter var(--lp-t-3) var(--lp-ease); scroll-margin-top: 16px; }
.ad-pane.is-active { opacity: 1; filter: none; }
.ad-pane.ad-wide { flex: 1 1 0; max-width: 380px; justify-items: stretch; }
.ad-pane-label { font: 500 var(--lp-fs-xs)/1.3 var(--lp-font); color: var(--lp-text-3); text-align: center; }
.ad-pane.is-active .ad-pane-label { color: var(--lp-text); }
@container ad (max-width: 600px) {
  .ad-pane, .ad-pane.ad-wide { flex: 1 1 100%; max-width: none; }
  .ad-pane:not(.is-active) { display: none; }
}

/* Phone */
.phone.ad-phone { width: min(260px, 100%); height: clamp(400px, 56vh, 480px); aspect-ratio: auto; padding: 9px; border-radius: 38px; }
.ad-phone .screen { border-radius: 30px; }
.ad-phone .notch { top: 8px; height: 20px; }
.ad-layer { position: absolute; inset: 0; display: grid; animation: ad-fade 0.35s ease-out; }
.ad-layer[hidden] { display: none; }

/* Chat */
.ad-chat { grid-template-rows: auto minmax(0, 1fr) auto; padding-top: 34px; text-align: left; }
.ad-chat .chat-head { border-bottom-color: var(--rule); }
.ad-thread { display: flex; flex-direction: column; gap: 8px; min-height: 0; margin: 0; padding: 10px; list-style: none; overflow-y: auto; scrollbar-width: none; }
.ad-thread::-webkit-scrollbar { display: none; }
.ad-thread > :first-child { margin-top: auto; }
.ad-sys { align-self: center; font: 500 0.625rem/1.3 var(--lp-font); color: var(--night-muted); text-align: center; }
.ad-msg { max-width: 86%; padding: 8px 11px; font-size: 0.75rem; line-height: 1.4; overflow-wrap: anywhere; animation: ad-pop 0.35s cubic-bezier(.2, .9, .3, 1.2) both; }
.ad-msg small { display: block; margin-top: 4px; font: 500 0.5625rem/1.3 var(--mono); color: var(--night-muted); }
.ad-msg.in { align-self: flex-start; border-radius: 16px 16px 16px 4px; background: var(--lp-surface-3); border: 1px solid var(--lp-line); }
.ad-msg.in.auto { background: var(--lp-accent-soft); border: 1px solid var(--lp-accent-line); }
.ad-msg.out { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: #2B5BD7; border: 1px solid rgb(255 255 255 / 0.08); color: #fff; }
.ad-msg.out > span[aria-hidden] { color: #FBBF24; font-size: 0.95rem; letter-spacing: 1px; }
.ad-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 10px 12px; border-radius: 16px 16px 16px 4px; background: var(--lp-surface-3); }
.ad-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--night-muted); animation: ad-dot 1s ease-in-out infinite; }
.ad-typing i:nth-child(2) { animation-delay: 0.15s; }
.ad-typing i:nth-child(3) { animation-delay: 0.3s; }

/* Tap targets */
.ad-replies { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding: 8px 10px 14px; border-top: 1px solid var(--rule); }
.ad-replies[hidden] { display: none; }
.ad-chip { min-height: 36px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--lp-line-3); background: var(--lp-surface-3); color: var(--lp-text); font: 500 0.8125rem/1.2 var(--lp-font); cursor: pointer; animation: ad-pop 0.35s cubic-bezier(.2, .9, .3, 1.2) both, ad-nudge 1.8s ease-out 0.6s infinite; transition: background 0.2s; }
.ad-chip:hover { background: #26272D; border-color: rgb(255 255 255 / 0.3); }
.ad-chip.primary { border-color: rgb(255 255 255 / 0.12); background: var(--lp-accent); color: var(--lp-accent-ink); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35); }
.ad-chip.primary:hover { background: var(--lp-accent-hi); }
.ad-replies.ad-stars { justify-content: center; gap: 0; }
.ad-star { min-width: 40px; min-height: 44px; padding: 0; border: 0; border-radius: 8px; background: none; color: rgb(255 255 255 / 0.32); font-size: 1.6rem; line-height: 1; cursor: pointer; transition: color 0.15s, transform 0.15s; }
.ad-stars:hover .ad-star, .ad-stars:not(:hover):has(.ad-star:focus-visible) .ad-star { color: #FBBF24; }
.ad-stars .ad-star:hover ~ .ad-star, .ad-stars:not(:hover) .ad-star:focus-visible ~ .ad-star { color: rgb(255 255 255 / 0.32); }
.ad-star:hover { transform: scale(1.15); }

/* Incoming call */
.ad-call { align-content: center; justify-items: center; gap: 6px; padding: 40px 16px 24px; text-align: center; }
.ad-call-sub { font: 500 0.6875rem/1.2 var(--lp-font); color: var(--night-muted); }
.ad-call-name { font: 600 1.25rem/1.1 var(--lp-font); letter-spacing: -0.02em; }
.ad-call-num { font: 500 0.75rem var(--mono); color: var(--night-muted); }
.ad-ring { position: relative; display: grid; place-items: center; width: 72px; height: 72px; margin: 22px 0 14px; border-radius: 50%; background: var(--carbon); color: var(--on-accent); transition: background 0.3s; }
.ad-ring svg { position: relative; width: 28px; height: 28px; }
.ad-ring span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--carbon); animation: ring 1.4s ease-out infinite; }
.ad-ring span + span { animation-delay: 0.7s; }
.ad-ring.off { background: var(--lp-bad); color: #fff; transform: rotate(135deg); }
.ad-ring.off span { display: none; }
.ad-call-status { font-size: 0.8125rem; color: var(--night-text); }
.ad-call-status.missed { color: var(--lp-bad); font-weight: 600; }

/* Owner's lock screen */
.ad-lock { align-content: start; gap: 8px; padding: 50px 12px 16px; }
.ad-lock-time { text-align: center; font: 500 2.75rem/1 var(--lp-font); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ad-lock-date { margin-bottom: 10px; text-align: center; font-size: 0.75rem; color: var(--night-muted); }
.ad-notes { display: grid; gap: 8px; }
.ad-note { padding: 10px 12px; border-radius: 16px; border: 1px solid var(--lp-line-2); background: rgb(40 41 46 / 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 0.75rem; line-height: 1.4; animation: ad-drop 0.45s cubic-bezier(.2, .9, .3, 1.2) both; }
.ad-note small { display: block; margin-bottom: 3px; font: 500 0.625rem/1.3 var(--lp-font); color: var(--night-muted); }
.ad-note b { display: block; font-size: 0.8125rem; }
.ad-note.lead { border-color: var(--lp-accent-line); background: linear-gradient(180deg, rgb(245 165 36 / 0.18), rgb(245 165 36 / 0.08)), rgb(30 28 24 / 0.95); box-shadow: 0 12px 30px -14px rgb(245 165 36 / 0.5); }
.ad-note-act { display: block; width: fit-content; margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: var(--carbon); color: var(--on-accent); font-weight: 600; font-size: 0.6875rem; }
.ad-empty { text-align: center; font-size: 0.75rem; color: var(--night-muted); }

/* Owner's calendar */
.ad-cal { align-content: start; gap: 8px; padding: 40px 12px 16px; }
.ad-cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 2px 8px; border-bottom: 1px solid var(--lp-line); }
.ad-cal-head b { font: 600 1.125rem var(--lp-font); letter-spacing: -0.02em; }
.ad-cal-head span { font: 500 0.6875rem var(--mono); color: var(--night-muted); }
.ad-ev { display: grid; gap: 3px; padding: 9px 10px 9px 12px; border-radius: 12px; border-left: 2px solid var(--lp-data-2); background: var(--lp-surface-3); font-size: 0.72rem; line-height: 1.35; transition: background 0.5s, border-color 0.5s; }
.ad-ev b { font-size: 0.78rem; }
.ad-ev > span:not(.ad-pill) { color: var(--night-muted); }
.ad-ev .ad-ev-time { font: 600 0.625rem/1.2 var(--mono); color: var(--night-text); }
.ad-ev.is-ok { border-left-color: var(--lp-ok); }
.ad-ev.ad-hot { background: var(--lp-accent-soft); }
.ad-pill { justify-self: start; margin-top: 2px; padding: 3px 8px; border-radius: 999px; font: 500 0.625rem/1.2 var(--lp-font); }
.ad-pill.wait { background: var(--lp-info-soft); color: var(--lp-data-2); }
.ad-pill.ok { background: var(--lp-ok-soft); color: var(--lp-ok); }

/* Review screen (mock, no real brand) */
.ad-review { align-content: start; gap: 12px; padding: 42px 14px 16px; text-align: left; }
.ad-review-tag { justify-self: center; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--lp-line-3); font: 500 0.625rem/1.2 var(--lp-font); color: var(--night-muted); }
.ad-biz { display: flex; align-items: center; gap: 10px; }
.ad-biz b { display: block; font-size: 0.8125rem; }
.ad-biz small { display: block; font-size: 0.6875rem; color: var(--night-muted); }
.ad-rstars { color: #FBBF24; font-size: 1.5rem; letter-spacing: 3px; line-height: 1; }
.ad-box { min-height: 92px; padding: 10px; border-radius: 12px; border: 1px solid var(--lp-line-2); background: var(--lp-surface-2); font-size: 0.75rem; line-height: 1.45; }
.ad-box:empty::before { content: attr(data-placeholder); color: var(--night-muted); }
.ad-box.is-typing { border-color: var(--lp-accent); box-shadow: var(--lp-ring); }
.ad-replies.ad-post, .ad-replies.ad-send { padding: 0; border-top: 0; }
.ad-replies.ad-post .ad-chip, .ad-replies.ad-send .ad-chip { flex: 1; min-height: 40px; }
.ad-done { display: grid; justify-items: center; align-content: center; gap: 10px; height: 100%; padding: 20px 16px; text-align: center; font-size: 0.8125rem; color: var(--night-muted); }
.ad-done b { font-size: 1rem; color: var(--lp-text); }
.ad-check { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--lp-ok); color: #04140B; box-shadow: 0 0 0 6px var(--lp-ok-soft); animation: ad-pop 0.4s cubic-bezier(.2, .9, .3, 1.3) both; }
.ad-check svg { width: 28px; height: 28px; }

/* Booking form (mock website) */
.ad-web { display: grid; min-width: 0; overflow: hidden; border-radius: var(--lp-r-lg); border: 1px solid var(--lp-line-2); background: var(--lp-surface-2); box-shadow: var(--lp-elev-2); text-align: left; }
.ad-web-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--lp-line); background: var(--lp-surface-3); }
.ad-web-bar i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: rgb(255 255 255 / 0.18); }
.ad-web-bar span { flex: 1; min-width: 0; margin-left: 6px; padding: 3px 10px; border-radius: 999px; background: rgb(0 0 0 / 0.25); font: 500 0.6875rem var(--mono); color: var(--night-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-form { display: grid; gap: 10px; padding: 16px; }
.ad-form h3 { font-size: 1.125rem; color: var(--lp-text); letter-spacing: -0.02em; }
.ad-field { display: grid; gap: 4px; }
.ad-field > span { font: 500 0.6875rem/1.2 var(--lp-font); color: var(--night-muted); }
.ad-input { min-height: 34px; padding: 7px 10px; border-radius: var(--lp-r-sm); border: 1px solid var(--lp-line-2); background: var(--lp-surface-1); font-size: 0.8125rem; overflow-wrap: anywhere; transition: border-color 0.2s, box-shadow 0.2s; }
.ad-input.is-typing { border-color: var(--lp-accent); box-shadow: var(--lp-ring); }
.ad-sent { font-size: 0.875rem; font-weight: 600; color: var(--carbon-deep); }

/* Owner's tools */
.ad-tools { display: grid; gap: 12px; }
.ad-tool { display: grid; gap: 8px; min-width: 0; padding: 12px 14px; border-radius: var(--lp-r-md); border: 1px solid var(--lp-line-2); background: var(--lp-surface-2); text-align: left; transition: border-color 0.4s, box-shadow 0.4s; }
.ad-tool.is-hit { border-color: var(--lp-accent-line); box-shadow: 0 0 0 4px var(--lp-accent-soft); }
.ad-tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-tool-head svg { flex: none; width: 18px; height: 18px; color: var(--carbon-deep); }
.ad-tool-head b { font-size: 0.875rem; }
.ad-tool-head .auto-tag { margin-left: auto; font: 500 0.6875rem/1.2 var(--lp-font); }
.ad-tool-head .auto-tag[hidden] { display: none; }
.ad-tool .ad-empty { text-align: left; }
.ad-rows { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ad-row { display: flex; justify-content: space-between; gap: 10px; min-width: 0; padding: 7px 10px; border-radius: var(--lp-r-sm); background: var(--lp-surface-3); font-size: 0.75rem; }
.ad-row span:first-child { min-width: 0; overflow-wrap: anywhere; }
.ad-row span:last-child { flex: none; font: 500 0.6875rem var(--lp-font-mono); color: var(--night-muted); }
.ad-inv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; padding: 8px 10px; border-radius: 10px; font-size: 0.75rem; }
.ad-inv dt { color: var(--night-muted); }
.ad-inv dd { margin: 0; overflow-wrap: anywhere; }
.ad-new { animation: ad-flash 1.6s ease-out; }

@keyframes ad-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes ad-fade { from { opacity: 0; } }
@keyframes ad-pop { from { opacity: 0; transform: translateY(8px) scale(0.94); } }
@keyframes ad-drop { from { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes ad-dot { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes ad-flash { from { background: rgb(245 165 36 / 0.28); } }
@keyframes ad-nudge { 0% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0.25); } 70%, 100% { box-shadow: 0 0 0 8px rgb(255 255 255 / 0); } }

@media (prefers-reduced-motion: reduce) {
  .ad-dialog[open], .ad-layer, .ad-msg, .ad-note, .ad-chip, .ad-check, .ad-new, .ad-typing i { animation: none !important; }
  .ad-ring span { display: none; }
  .ad-try, .ad-pane, .ad-ev, .ad-tool, .ad-ring, .ad-star, .ad-input { transition: none; }
  .ad-cell:has(.ph-card:hover) .ad-try, .ad-star:hover { transform: none; }
}

/* Card photos (AI-generated sample media) */
.ph-card .ad-card-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--lp-r-md); margin-bottom: 14px; display: block; opacity: .92; box-shadow: 0 0 0 1px var(--lp-line); transition: opacity var(--lp-t-3) var(--lp-ease); }
.ph-card:hover .ad-card-img { opacity: 1; }
.ph-card:has(.ad-card-img) > .ph { display: none; }
