/* DaviesDigital site v3 features (2 Nov 2026): preview builder, price calculator, website check,
   quick answers, 404. Uses the tokens from offer.css. */

/* Shared form controls */
.field { display: grid; gap: 6px; font-weight: 700; font-size: .93rem; }
.field input[type="text"], .field select { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid #7A818A; font: inherit; font-size: 1rem; font-weight: 400; background: #fff; color: var(--ink); }
.field select { -webkit-appearance: none; appearance: none; padding-right: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2312151A' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 16px center; }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid #4F46E5; outline-offset: 1px; border-color: #4F46E5; }
.panel { border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-2); padding: clamp(20px, 4vw, 32px); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: .93rem; margin-bottom: 8px; padding: 0; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px #7A818A; cursor: pointer; font-weight: 600; transition: box-shadow 150ms ease-out, background-color 150ms ease-out; }
.opt:has(input:checked) { box-shadow: inset 0 0 0 2px var(--violet); background: rgb(109 40 217 / .05); }
.opt input { width: 20px; height: 20px; accent-color: var(--violet); flex: none; margin: 0; }
.opt small { display: block; font-weight: 400; color: var(--muted); }
.opt .opt-price { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack { display: grid; gap: 10px; }

/* 1. Live preview builder */
.pv-grid { display: grid; gap: 32px; align-items: start; }
@media (min-width: 960px) { .pv-grid { grid-template-columns: .85fr 1.15fr; } }
.pv-form { display: grid; gap: 16px; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px 6px 6px; border-radius: 999px; box-shadow: inset 0 0 0 1px #7A818A; font-weight: 600; font-size: .9rem; cursor: pointer; }
.swatch span i { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1); }
.swatch input:checked + span { box-shadow: inset 0 0 0 2px var(--violet); background: rgb(109 40 217 / .05); }
.swatch input:focus-visible + span { outline: 3px solid #4F46E5; outline-offset: 2px; }
.pv-site { --pv-brand: #1F3A5F; --pv-accent: #F2A541; --pv-accent-text: #F2A541; }
.pv-window { border-radius: 18px; overflow: hidden; background: #fff; box-shadow: 0 40px 80px -30px rgb(18 21 26 / .45), 0 0 0 1px rgb(18 21 26 / .06); }
.pv-chrome { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: #F3F4F7; border-bottom: 1px solid var(--line); }
.pv-chrome i { width: 10px; height: 10px; border-radius: 50%; background: #D5D9DF; flex: none; }
.pv-url { margin-left: 10px; flex: 1; min-width: 0; background: #fff; border-radius: 999px; padding: 5px 14px; font-size: .8rem; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.pv-brand { font-weight: 800; margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pv-nav { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
@media (max-width: 520px) { .pv-nav { display: none; } }
.pv-hero { background: var(--pv-brand); color: #fff; padding: clamp(22px, 5vw, 40px); transition: background-color 400ms var(--ease-out); }
.pv-eyebrow { color: var(--pv-accent-text); font-size: .74rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 10px; transition: color 400ms ease-out; }
.pv-head { font-size: clamp(1.4rem, 3.4vw, 2.1rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 18px; max-width: 20ch; overflow-wrap: anywhere; }
.pv-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pv-btns span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: .82rem; font-weight: 800; }
.pv-btns .a { background: var(--pv-accent); color: #1D2125; transition: background-color 400ms ease-out; }
.pv-btns .b { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .7); }
.pv-body { padding: 18px clamp(18px, 4vw, 28px) 22px; display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.pv-chip { padding: 14px 12px; border-radius: 10px; border: 1px solid var(--line); border-top: 4px solid var(--pv-brand); font-size: .85rem; font-weight: 700; transition: border-color 400ms ease-out; overflow-wrap: anywhere; }
.pv-call { margin: 0 clamp(18px, 4vw, 28px) 20px; display: flex; justify-content: center; align-items: center; min-height: 42px; border-radius: 999px; background: var(--pv-accent); color: #1D2125; font-weight: 800; font-size: .85rem; transition: background-color 400ms ease-out; }
.pv-site.pulse .pv-head, .pv-site.pulse .pv-brand { animation: pv-pulse 380ms var(--ease-out); }
@keyframes pv-pulse { from { opacity: .35; transform: translateY(3px); } }
.pv-note { font-size: .85rem; color: var(--muted); margin: 0; }

/* 2. Price calculator */
.pc-grid { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) { .pc-grid { grid-template-columns: 1.1fr .9fr; } }
.pc-form { display: grid; gap: 22px; }
.range-row { display: grid; gap: 8px; }
.range-row input { width: 100%; accent-color: var(--violet); min-height: 28px; }
.range-row output { font-weight: 800; font-variant-numeric: tabular-nums; }
.pc-sum { background: var(--night); color: var(--on-night); box-shadow: 0 30px 60px -28px rgb(11 14 20 / .8); }
@media (min-width: 900px) { .pc-sum { position: sticky; top: 92px; } }
.pc-sum h3 { color: #fff; }
.pc-line { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid rgb(255 255 255 / .1); color: var(--on-night-muted); }
.pc-line b { color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.pc-total { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 18px 0 6px; flex-wrap: wrap; }
.pc-total .pc-year { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; background: var(--grad-light); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pc-notes { margin: 8px 0 18px; padding-left: 1.1em; font-size: .88rem; color: var(--on-night-muted); display: grid; gap: 4px; }
.pc-sum .btn { width: 100%; }

/* 3. Website check */
.ck { max-width: 680px; margin: 0 auto; }
.ck-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-bottom: 26px; }
.ck-bar i { display: block; height: 100%; background: var(--grad-deep); transform-origin: left; transform: scaleX(0); transition: transform 400ms var(--ease-out); }
.ck-num { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.ck-q { font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 26px; text-wrap: balance; }
.ck-q:focus, .ck-title:focus { outline: none; }
.ck-card.slide { animation: ck-in 420ms var(--ease-back); }
@keyframes ck-in { from { opacity: 0; transform: translateX(18px); } }
.ck-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.ck-btns .btn { min-width: 130px; }
.ck-back, .ck-again { background: none; border: 0; font: inherit; font-weight: 700; color: #4338CA; cursor: pointer; min-height: 44px; padding: 0 4px; }
.ck-back { margin-top: 18px; }
.ck-result { text-align: center; }
.ck-ring { width: 170px; height: 170px; margin: 0 auto 18px; position: relative; }
.ck-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ck-ring circle { fill: none; stroke-width: 12; }
.ck-ring-bg { stroke: var(--line); }
.ck-ring-fg { stroke: url(#ck-grad); stroke-linecap: round; transition: stroke-dashoffset 1100ms var(--ease-out); }
.ck-ring-num { position: absolute; inset: 0; display: grid; place-content: center; font-size: 2.8rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.ck-ring-num small { font-size: .9rem; color: var(--muted); font-weight: 700; display: block; margin-top: 4px; }
.ck-tips { text-align: left; list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 12px; }
.ck-tips li { padding: 16px 18px; border-radius: var(--radius); background: var(--soft); color: var(--muted); }
.ck-tips strong { color: var(--ink); display: block; margin-bottom: 2px; }

/* 4. Quick answers */
.qa { position: fixed; right: 18px; bottom: 18px; z-index: 30; }
.qa-open { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--grad-deep); color: #fff; font: inherit; font-weight: 700; box-shadow: var(--glow), 0 10px 30px -10px rgb(0 0 0 / .4);
  transition: transform 150ms var(--ease-out); }
.qa-open svg { width: 22px; height: 22px; }
.qa-open:active { transform: scale(.97); }
.qa.open .qa-open { display: none; }
.qa-panel { width: min(380px, calc(100vw - 36px)); max-height: min(600px, calc(100vh - 36px)); display: flex; flex-direction: column; border-radius: 20px; background: #fff; overflow: hidden;
  box-shadow: 0 0 0 1px rgb(18 21 26 / .06), 0 30px 70px -20px rgb(11 14 20 / .55); transform-origin: bottom right; }
.qa-panel[hidden] { display: none; }
.qa-panel:not([hidden]) { animation: qa-in 280ms var(--ease-back); }
@keyframes qa-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.qa-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--night); color: #fff; }
.qa-head div { margin-right: auto; display: grid; line-height: 1.3; }
.qa-head div span { font-size: .8rem; color: var(--on-night-muted); }
.qa-dot { width: 36px; height: 36px; border-radius: 10px; background: var(--grad-deep); display: grid; place-items: center; font-size: .72rem; font-weight: 800; flex: none; }
.qa-close { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgb(255 255 255 / .08); color: #fff; display: grid; place-items: center; cursor: pointer; }
.qa-close svg { width: 20px; height: 20px; }
.qa-log { padding: 16px; display: grid; gap: 10px; overflow-y: auto; flex: 1; align-content: start; min-height: 120px; }
.qa-msg { margin: 0; padding: 11px 14px; border-radius: 16px; font-size: .93rem; line-height: 1.5; max-width: 88%; }
.qa-msg.bot { background: var(--soft); border-bottom-left-radius: 6px; justify-self: start; }
.qa-msg.you { background: var(--violet); color: #fff; border-bottom-right-radius: 6px; justify-self: end; }
.qa-msg.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.qa-msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: #9AA1AB; animation: qa-dot 900ms ease-in-out infinite; }
.qa-msg.typing i:nth-child(2) { animation-delay: 150ms; }
.qa-msg.typing i:nth-child(3) { animation-delay: 300ms; }
@keyframes qa-dot { 50% { transform: translateY(-4px); opacity: .5; } }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--line); max-height: 128px; overflow-y: auto; }
.qa-chip { border: 0; border-radius: 999px; padding: 8px 12px; min-height: 36px; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; color: var(--violet); box-shadow: inset 0 0 0 1.5px #8B5CF6; background: #fff; }
.qa-chip:hover { background: rgb(109 40 217 / .06); }
.qa-mail { display: flex; align-items: center; justify-content: center; min-height: 48px; font-weight: 700; font-size: .9rem; border-top: 1px solid var(--line); text-decoration: none; }
.qa-mail:hover { text-decoration: underline; }
@media print { .qa { display: none; } }

/* 404 */
.nf { min-height: 72vh; display: grid; place-items: center; text-align: center; }
.nf-num { font-size: clamp(6rem, 22vw, 12rem); font-weight: 800; letter-spacing: -.06em; line-height: 1; margin: 0 0 12px; background: var(--grad-light); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .pv-site.pulse .pv-head, .pv-site.pulse .pv-brand, .ck-card.slide, .qa-panel:not([hidden]) { animation: none; }
}
.foot { padding-bottom: 96px; }
