/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-4));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, dl, dd {
  margin: 0;
}

ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

svg {
  display: block;
}

/* Keep the hidden attribute working even on elements we give a display value. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-3);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
}

.btn-primary:hover {
  background: var(--ink-soft);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink);
}

/* Quiet outline button for the nav */
.btn-quiet {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-quiet:hover {
  border-color: var(--ink);
}

.btn-sm {
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

/* ---------- Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark-dot {
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav-link {
  display: none;
  font-size: var(--text-sm);
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--ink);
}

/* ---------- Hero ---------- */
.hero {
  padding-top: var(--space-7);
  padding-bottom: var(--space-6);
}

.eyebrow {
  margin-bottom: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.hero-title {
  max-width: 25ch;
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 52ch;
  margin-top: var(--space-5);
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Sits directly under "See how it works" */
.hero-note {
  flex-basis: 100%;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Phones: the buttons stack, so move the note up between them */
@media (max-width: 719px) {
  .hero-note {
    order: 1;
    margin-top: calc(var(--space-1) * -1);
  }

  .hero-actions .btn-secondary {
    order: 2;
  }
}

/* ---------- Demo panel ---------- */
.demo {
  padding-bottom: var(--section-space);
}

.demo-panel {
  background: var(--panel);
  color: var(--panel-text);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
}

.demo-panel :focus-visible {
  outline-color: var(--accent-on-dark);
}

.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--panel-line);
}

.demo-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-on-dark);
}

.demo-title {
  margin-top: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.demo-disclaimer {
  max-width: 36ch;
  font-size: var(--text-sm);
  color: var(--panel-muted);
}

/* Phones: one compact row of buttons; Restart sits next to the step count. */
.demo-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border-bottom: 1px solid var(--panel-line);
}

.demo-controls[hidden] {
  display: none;
}

.ctl {
  min-height: 48px;
  padding: 0 var(--space-2);
  white-space: nowrap;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  color: var(--panel-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.ctl:hover:not(:disabled) {
  border-color: var(--panel-muted);
}

.ctl-primary {
  background: var(--panel-text);
  border-color: var(--panel-text);
  color: var(--ink);
}

.ctl-primary:hover:not(:disabled) {
  background: #FFFFFF;
}

.ctl-ghost {
  background: transparent;
}

.ctl[data-action="restart"] {
  grid-column: 3;
  grid-row: 2;
  min-height: 44px;
}

.ctl:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  color: var(--panel-muted);
}

.step-count {
  grid-column: 1 / 3;
  grid-row: 2;
  align-self: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--panel-muted);
}

.demo-grid {
  display: grid;
  /* minmax(0, 1fr) lets the column shrink to the screen instead of growing to fit its content. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4);
}

/* ---------- Timeline (what happens) ---------- */
.timeline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  transition: opacity 150ms ease, border-color 150ms ease;
}

/* Steps not reached yet: quieter, but still readable. */
.timeline-item.is-pending {
  border-style: dashed;
}

.timeline-item.is-pending .timeline-title {
  color: var(--panel-muted);
  font-weight: 400;
}

.timeline-item.is-pending .timeline-icon {
  border-style: dashed;
  background: transparent;
  color: var(--panel-muted);
}

.timeline-item.is-current {
  border-color: var(--panel-muted);
}

.timeline-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  color: var(--panel-text);
}

.timeline-icon svg,
.msg-system svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.timeline-icon--missed {
  color: var(--accent-on-dark);
}

.timeline-title {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.35;
}

.timeline-time {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--panel-muted);
}

.timeline-footnote {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--panel-muted);
}

/* ---------- Caller's phone ---------- */
.phone {
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
  border: 1px solid var(--panel-line);
  border-radius: 28px;
  background: #08090A;
  overflow: hidden;
}

.phone-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--panel-line);
  background: var(--panel-raised);
}

.phone-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2A2E33;
  font-size: var(--text-xs);
  font-weight: 600;
}

.phone-name {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.phone-sub {
  font-size: var(--text-xs);
  color: var(--panel-muted);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 360px;
  padding: var(--space-5) var(--space-4);
}

.msg {
  max-width: 85%;
  font-size: var(--text-base);
  line-height: 1.45;
}

.msg p {
  padding: 10px 14px;
  border-radius: 18px;
}

.msg-out {
  align-self: flex-start;
}

.msg-out p {
  background: #24282D;
  color: var(--panel-text);
  border-bottom-left-radius: 6px;
}

.msg-in {
  align-self: flex-end;
}

.msg-in p {
  background: var(--panel-text);
  color: var(--ink);
  border-bottom-right-radius: 6px;
}

.msg-staff p {
  background: var(--panel-raised);
  border: 1px solid var(--accent-on-dark);
}

.msg-from {
  display: block;
  margin: 0 0 var(--space-1) var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--panel-muted);
}

.msg-system {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  align-self: center;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--panel-muted);
  text-align: center;
}

.msg-system--missed {
  color: var(--accent-on-dark);
}

.msg-system--takeover {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  color: var(--panel-text);
}

/* New messages fade in, only to show order. */
.is-entering {
  animation: enter 150ms ease-out;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ---------- Work order ---------- */
.ticket {
  position: relative;
  padding: var(--space-5);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
}

/* Perforated top edge, like a tear-off service slip. */
.ticket::before {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--space-4);
  right: var(--space-4);
  border-top: 2px dashed var(--panel-line);
}

.ticket-head {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--paper-line);
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}

.ticket-kicker {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.ticket-title {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.stamp {
  flex: none;
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stamp.is-neutral {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--muted);
}

.ticket-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-4);
}

.field {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--paper-line);
}

.field--wide {
  grid-column: 1 / -1;
}

.field dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.field dd {
  margin-top: 2px;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.45;
}

.field dd.is-pending {
  color: var(--muted);
  font-weight: 400;
}

/* The one place that states what the product doesn't do */
.demo-note {
  max-width: 72ch;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ---------- Section heading (shared by later sections) ---------- */
.section-head {
  display: grid;
  gap: var(--space-4);
}

.section-label {
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.section-title {
  max-width: 18ch;
  font-size: clamp(1.875rem, 1.4rem + 1.9vw, 2.75rem); /* 30px to 44px */
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.section-intro {
  max-width: 48ch;
  font-size: var(--text-lg);
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- How it works ---------- */
.steps-section {
  padding-bottom: var(--section-space);
}

.steps {
  display: grid;
  margin-top: var(--space-7);
  border-top: 1px solid var(--line-strong);
}

.step {
  padding: var(--space-5) 0 var(--space-6);
  border-bottom: 1px solid var(--line);
}

.step-number {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
}

.step-title {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.step-text {
  margin-top: var(--space-2);
  max-width: 40ch;
  color: var(--ink-soft);
}

.step-detail {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--line-strong);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}

.step-detail-note {
  display: block;
  margin-top: var(--space-2);
  font-family: var(--font-sans);
}

/* ---------- Pricing ---------- */
.pricing-section {
  padding-bottom: var(--section-space);
}

.price {
  display: grid;
  margin-top: var(--space-7);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.price-figures {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.price-figure {
  padding: var(--space-5) 0;
}

.price-figure + .price-figure {
  padding-left: var(--space-5);
  border-left: 1px solid var(--line);
}

.price-figure dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.price-figure dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  margin-top: var(--space-2);
}

.price-amount {
  font-size: clamp(2.25rem, 1.8rem + 1.8vw, 3.25rem); /* 36px to 52px */
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.price-unit {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}

.price-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) 0 var(--space-6);
  border-top: 1px solid var(--line);
}

.price-usage {
  max-width: 44ch;
  color: var(--ink-soft);
}

/* ---------- Short request summary (phones) ---------- */
.brief {
  padding: var(--space-4);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
}

.brief-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.brief-title {
  font-size: var(--text-sm);
  font-weight: 600;
}

.brief-fields {
  margin-top: var(--space-3);
}

.brief-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--paper-line);
}

.brief-field dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}

.brief-field dd {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
}

.brief-field dd.is-pending {
  color: var(--muted);
  font-weight: 400;
}

.brief-toggle {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-2);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}

.brief-toggle:hover {
  border-color: var(--ink);
}

.brief-toggle:focus-visible {
  outline-color: var(--accent);
}

/* ---------- Phone-only demo layout (under 720px) ---------- */
@media (max-width: 719px) {
  /* Order: short summary, (optional) full work order, then the conversation */
  .timeline-wrap {
    display: none;
  }

  .brief {
    order: 1;
  }

  .ticket {
    order: 2;
  }

  .phone {
    order: 3;
  }

  /* Collapsed until "View request details" is pressed (only when JavaScript runs) */
  .demo.is-enhanced .ticket:not(.is-open) {
    display: none;
  }

  /* No decorative phone frame: the messages get the full width */
  .phone {
    max-width: none;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .phone-header {
    padding: 0 0 var(--space-3);
    background: transparent;
  }

  /* The conversation scrolls inside its own box, so the page never jumps */
  .thread {
    min-height: 240px;
    max-height: min(62vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-4) 0;
  }

  .msg {
    max-width: 88%;
  }
}

/* ---------- Tablet (720px+) ---------- */
@media (min-width: 720px) {
  .hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-7);
  }

  /* Controls stay reachable while the conversation grows (sticky under the nav). */
  .demo-controls {
    position: sticky;
    top: var(--nav-height);
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: var(--space-3) var(--space-5);
  }

  .ctl[data-action="restart"] {
    min-height: 48px;
  }

  .demo-grid {
    gap: var(--space-6);
    padding: var(--space-5);
  }

  /* The short summary is only for phones; wider screens show the full work order. */
  .brief {
    display: none;
  }

  .ctl {
    padding: 0 var(--space-4);
  }

  .ctl-primary {
    min-width: 160px;
  }

  .step-count {
    margin-left: auto;
  }

  .demo-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .timeline-wrap {
    grid-column: 1 / -1;
  }

  .timeline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .timeline-item[data-stage="takeover"] {
    grid-column: 1 / -1;
  }

  .nav-link {
    display: inline;
  }
}

/* ---------- Desktop (1024px+) ---------- */
@media (min-width: 1024px) {
  .hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-7);
  }

  .demo-bar {
    padding: var(--space-5) var(--space-6);
  }

  .demo-disclaimer {
    text-align: right;
  }

  .demo-controls {
    padding: var(--space-3) var(--space-6);
  }

  /* The conversation gets the widest column */
  .demo-grid {
    grid-template-columns: 180px minmax(0, 1fr) 340px;
    gap: var(--space-6);
    padding: var(--space-6);
  }

  .timeline-wrap {
    grid-column: auto;
  }

  /* Vertical event log with a connecting line */
  .timeline {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .timeline-item,
  .timeline-item[data-stage="takeover"] {
    position: relative;
    grid-column: auto;
    padding: 0 0 var(--space-5);
    border: 0;
  }

  .timeline-item:not(:last-child):not(:has(+ [hidden]))::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 32px;
    bottom: 4px;
    width: 1px;
    background: var(--panel-line);
  }

  .timeline-item.is-current .timeline-icon {
    border-color: var(--panel-muted);
  }

  .thread {
    min-height: 440px;
  }

  /* Heading on the left, intro on the right */
  .section-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: var(--space-7);
  }

  /* Three columns separated by thin vertical lines */
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .step {
    padding: var(--space-6) var(--space-6) var(--space-6) 0;
    border-bottom: 0;
  }

  .step + .step {
    padding-left: var(--space-6);
    border-left: 1px solid var(--line);
  }

  /* Prices on the left, usage note and button on the right */
  .price {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .price-figure {
    padding: var(--space-6) 0;
  }

  .price-figure + .price-figure {
    padding-left: var(--space-6);
  }

  .price-side {
    justify-content: center;
    padding: var(--space-6) 0 var(--space-6) var(--space-6);
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
