:root {
  color-scheme: light dark;
  --ink: #1d2a27;
  --muted: #5c6b67;
  --paper: #faf7f2;
  --surface: #ffffff;
  --line: #e2ddd3;
  --brand: #1f4d45;
  --brand-soft: #e6efec;
  --accent: #c2553a;
  --accent-ink: #ffffff;
  --warn: #9a3b1f;
  --warn-soft: #fbece6;
  --radius: 6px;
  --gutter: 16px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ece9;
    --muted: #a3b0ac;
    --paper: #151b1a;
    --surface: #1d2523;
    --line: #2f3a37;
    --brand: #8cc4b6;
    --brand-soft: #1f2f2b;
    --accent: #e0775b;
    --accent-ink: #151b1a;
    --warn: #f0a084;
    --warn-soft: #3a241c;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); }

/* Side padding respects the notch when a phone is held sideways. */
.wrap {
  max-width: 1040px; margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
.narrow { max-width: 640px; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.error { color: var(--warn); min-height: 1.5em; margin: 0.5em 0 0; font-size: 0.95rem; }
.error a { color: inherit; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); padding-top: env(safe-area-inset-top); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.wordmark {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: var(--brand); text-decoration: none;
}
.wordmark img { display: block; height: 30px; width: auto; }
.header-link { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 calc(28px + env(safe-area-inset-bottom)); margin-top: 64px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-underline-offset: 2px; }
.footer-links a:hover { color: var(--ink); }
/* Social links: a row of its own under the footer text. Each link is a 44px
   target; the negative margin lines the first icon up with the text above. */
.footer-social { display: flex; flex-wrap: wrap; flex-basis: 100%; margin-left: -12px; }
.footer-social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--muted); border-radius: var(--radius); }
.footer-social a:hover { color: var(--ink); }
.footer-social svg { display: block; }

/* Buttons */
.button {
  display: inline-block; font: 600 1rem/1 var(--sans); padding: 15px 22px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(0.94); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.ghost:hover { border-color: var(--muted); }
.button:disabled { opacity: 0.6; cursor: wait; }
.small-button { padding: 0 14px; min-height: 44px; font-size: 0.9rem; }
.link-button {
  background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 500;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

/* A message from the app, e.g. a plan link that wouldn't open */
.notice { background: var(--warn-soft); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 0; }

/* Estate agent who introduced the mover */
.agent-line { color: var(--muted); margin: 0; }
.hero .agent-line { margin-top: 4px; }

/* Landing */
.hero { padding-top: 64px; padding-bottom: 48px; }
.hero-inner { max-width: 760px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 36em; }
.hero .button { margin: 8px 0 12px; }
.landing-body { display: grid; gap: 40px; padding-top: 32px; padding-bottom: 48px; border-top: 1px solid var(--line); }
@media (min-width: 760px) { .landing-body { grid-template-columns: 1fr 1fr; gap: 64px; } }
.steps { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 0.8em; }
.plain-list { margin: 0; padding-left: 1.1em; }
.plain-list li { margin-bottom: 0.5em; }
.dfy-band { background: var(--brand-soft); border-radius: var(--radius); padding: 28px; }
.dfy-band p { margin: 0; max-width: 40em; }
@media (max-width: 480px) {
  .hero { padding-top: 40px; padding-bottom: 36px; }
  .lede { font-size: 1.1rem; }
  .hero .button { width: 100%; text-align: center; }
  .dfy-band { padding: 22px 20px; }
}

/* Questionnaire */
#view-quiz, #view-preview, #view-plan, #view-loading { padding: 32px 0; }
.loading { padding: 48px 0; }
.quiz-progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.quiz-progress span { display: block; height: 100%; background: var(--brand); transition: width 0.2s; }
.q-title { font-size: clamp(1.6rem, 4.5vw, 2.2rem); margin-top: 8px; }
label { display: block; font-weight: 600; margin: 18px 0 6px; }
input[type="date"], input[type="email"], input[type="tel"], input:not([type]) {
  width: 100%; min-height: 50px; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
input:disabled { opacity: 0.5; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.options { display: grid; gap: 10px; margin-top: 20px; }
.option {
  text-align: left; font: 500 1.05rem/1.3 var(--sans); padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.option:hover { border-color: var(--brand); }
.option[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 28px; gap: 12px; }

/* Preview and gate */
.h-page { font-size: clamp(1.7rem, 4.5vw, 2.4rem); }
.summary-list { list-style: none; padding: 0; margin: 0 0 24px; border-top: 1px solid var(--line); }
.summary-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.preview-task { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.preview-task p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.preview-locked { position: relative; filter: blur(3px); opacity: 0.6; user-select: none; pointer-events: none; }
.gate { background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: 24px; margin-top: -40px; position: relative; }
.gate .button { margin-top: 12px; width: 100%; }
@media (max-width: 480px) { .gate { padding: 20px 18px; } }

/* Plan: the countdown and progress */
#view-plan { padding-top: 24px; }
.plan-head { margin-bottom: 20px; }
.countdown { font-size: clamp(2.1rem, 9vw, 3rem); margin-bottom: 0.15em; }
.plan-subtitle { margin: 0; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 16px 0 6px; }
.progress span { display: block; height: 100%; background: var(--brand); transition: width 0.2s; }
.progress-text { margin: 0; font-weight: 500; }
.plan-head .agent-line { margin-top: 6px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* Plan: filter by kind of task. Stays in reach while the list scrolls. */
.filters {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1) 8px; padding: 0 var(--gutter);
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; min-height: 46px; padding: 0 12px; background: none; border: 0; border-bottom: 3px solid transparent;
  font: 600 0.95rem/1 var(--sans); color: var(--muted); cursor: pointer;
}
.filter:first-child { padding-left: 0; }
.filter:hover { color: var(--ink); }
.filter[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.filter:focus-visible { outline-offset: -3px; }

/* Plan: phases. What's due now is open; later phases are folded away. */
.phase { margin-bottom: 8px; }
.phase[open] { margin-bottom: 28px; }
.phase > summary {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0;
  list-style: none; cursor: pointer; border-bottom: 1px solid var(--line);
}
.phase > summary::-webkit-details-marker { display: none; }
.phase > summary::after {
  content: ''; flex: none; width: 9px; height: 9px; margin: 0 4px 4px 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.phase[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.phase[open] > summary { border-bottom: 2px solid var(--ink); }
.phase > summary h2 { flex: 1; margin: 0; font-size: 1.25rem; }
.phase-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 0.85rem; line-height: 1.3; color: var(--muted); white-space: nowrap; }
.phase.overdue[open] > summary { border-color: var(--warn); }
.phase.overdue .phase-date { color: var(--warn); font-weight: 600; }
.phase.current[open] > summary { border-color: var(--brand); }
.phase.current .phase-date { color: var(--brand); font-weight: 600; }
.phase.complete > summary h2 { color: var(--muted); }

/* Plan: tasks */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; border-bottom: 1px solid var(--line); }
.tick {
  flex: none; display: flex; justify-content: center; align-items: flex-start;
  width: 44px; min-height: 48px; margin: 0 2px 0 -11px; padding-top: 14px; cursor: pointer;
}
.tick input { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.task-body { flex: 1; min-width: 0; padding: 12px 0; }
.task-title { margin: 0; font-weight: 600; cursor: pointer; }
.task-body p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.task-body .task-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 0 0 -10px; }
.task-links:empty { display: none; }
.task-links a, .task-links .link-button { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 2px; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task.done .task-body p { display: none; }

.dfy-card { background: var(--brand-soft); border-radius: var(--radius); padding: 24px; margin: 0 0 28px; }
.dfy-card h2 { font-size: 1.25rem; }
@media (max-width: 480px) { .dfy-card { padding: 20px 18px; } }

/* Plan: add to home screen */
.install { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 32px; }
.install p { margin: 0 0 12px; font-size: 0.95rem; }
.install-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.install-actions .link-button { display: inline-flex; align-items: center; min-height: 44px; }
.plan-foot { margin-top: 32px; }

/* Dialogs */
dialog {
  border: 0; border-radius: var(--radius); padding: 24px; max-width: 480px; width: calc(100% - 32px);
  max-height: calc(100dvh - 32px); overflow-y: auto;
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 20, 18, 0.55); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 480px) {
  dialog { padding: 20px 18px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; text-align: center; }
}

/* Long-form pages (privacy, terms, for estate agents): <main><div class="wrap narrow prose"> */
.prose { padding-top: 40px; padding-bottom: 24px; }
.prose h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin-bottom: 0.4em; }
.prose h2 { font-size: 1.4rem; margin: 2em 0 0.5em; }
.prose h3 { font: 600 1.05rem/1.35 var(--sans); margin: 1.6em 0 0.4em; }
.prose p, .prose li { max-width: 38em; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; }
.prose a { text-underline-offset: 2px; overflow-wrap: anywhere; }
.prose address { font-style: normal; margin: 0 0 1em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose table { display: block; overflow-x: auto; width: 100%; border-collapse: collapse; margin: 0 0 1.5em; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 600; }
.prose .lede { font-size: 1.15rem; }

/* Spam trap: off-screen field people never see or fill in. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Estate agent partner page (site/agents.html) */
.agent-page { padding-top: 48px; padding-bottom: 56px; }
.agent-page h1 { margin-bottom: 0.4em; }
.agent-page section { margin-top: 40px; }
.agent-cols { display: grid; gap: 32px; }
@media (min-width: 760px) { .agent-cols { grid-template-columns: 1fr 1fr; gap: 64px; } }
.faq dt { font-weight: 600; margin-top: 20px; }
.faq dd { margin: 4px 0 0; max-width: 40em; }
.agent-form { background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius); padding: 24px; max-width: 560px; }
.agent-form .button { margin-top: 16px; }
.agent-form .hint { margin: 4px 0 0; }
.agent-form input[type="text"] { width: 100%; min-height: 50px; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.agent-thanks { background: var(--brand-soft); border-radius: var(--radius); padding: 24px; max-width: 560px; }
@media (max-width: 480px) { .agent-form, .agent-thanks { padding: 20px 18px; } .agent-page { padding-top: 32px; } }

.footer-links .link-button { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
