/* ============================================================
   Tillbird marketing site — design tokens
   Concept: a quiet, capable assistant at the shop counter.
   Palette and type are deliberately not the generic "AI SaaS"
   cream+terracotta or near-black+neon look — this is closer to
   British shopfront signage and stationery: deep bottle green,
   warm paper, a little brass, a postmark red used once or twice.
   ============================================================ */

:root {
  --paper: #f6f3ec;
  --paper-alt: #eee7d8;
  --paper-line: #e1d8c4;
  --ink: #23281f;
  --ink-soft: #55594c;
  --ink-faint: #8a8c7c;
  --green: #2f4d3a;
  --green-deep: #1f3527;
  --green-tint: #e4ebe2;
  --brass: #9c7226;
  --brass-bright: #b8863b;
  --stamp: #a8402c;
  --white: #fffdf8;

  --shadow-card: 0 1px 2px rgba(35, 40, 31, 0.06), 0 8px 24px -12px rgba(35, 40, 31, 0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --focus-ring: 0 0 0 3px rgba(47, 77, 58, 0.35);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --content-width: 1120px;
  --measure: 62ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1e18;
    --paper-alt: #23271f;
    --paper-line: #33372c;
    --ink: #ece7d9;
    --ink-soft: #bcb8a6;
    --ink-faint: #85826f;
    --green: #6f9a7f;
    --green-deep: #a9c9b4;
    --green-tint: #212b23;
    --brass: #d7ab5f;
    --brass-bright: #e4bd7c;
    --stamp: #d97a63;
    --white: #14160f;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --paper: #1b1e18;
  --paper-alt: #23271f;
  --paper-line: #33372c;
  --ink: #ece7d9;
  --ink-soft: #bcb8a6;
  --ink-faint: #85826f;
  --green: #6f9a7f;
  --green-deep: #a9c9b4;
  --green-tint: #212b23;
  --brass: #d7ab5f;
  --brass-bright: #e4bd7c;
  --stamp: #d97a63;
  --white: #14160f;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
}
:root[data-theme="light"] {
  --paper: #f6f3ec;
  --paper-alt: #eee7d8;
  --paper-line: #e1d8c4;
  --ink: #23281f;
  --ink-soft: #55594c;
  --ink-faint: #8a8c7c;
  --green: #2f4d3a;
  --green-deep: #1f3527;
  --green-tint: #e4ebe2;
  --brass: #9c7226;
  --brass-bright: #b8863b;
  --stamp: #a8402c;
  --white: #fffdf8;
  --shadow-card: 0 1px 2px rgba(35, 40, 31, 0.06), 0 8px 24px -12px rgba(35, 40, 31, 0.18);
}

/* ---------- reset & base ---------- */
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--green);
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.06;
  text-wrap: balance;
  margin: 0 0 0.3em;
  color: var(--ink);
}
h1 {
  font-size: clamp(1.7rem, 1.35rem + 1.5vw, 2.35rem);
  font-weight: 500;
}
h2 {
  font-size: clamp(1.45rem, 1.25rem + 0.85vw, 1.95rem);
}
h3 {
  font-size: 1.15rem;
  font-weight: 600;
}
p {
  margin: 0 0 0.8em;
  max-width: var(--measure);
}
.lede {
  font-size: 1.08rem;
  color: var(--ink-soft);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brass);
  display: inline-block;
  margin-bottom: 0.9em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--green);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

/* ---------- layout helpers ---------- */
.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}
section {
  padding: 52px 0;
}
section.tight {
  padding: 38px 0;
}
.band-alt {
  background: var(--paper-alt);
  border-top: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--green);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--green-deep);
}
.btn-ghost {
  background: transparent;
  border-color: var(--paper-line);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--paper-line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wordmark .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--stamp);
  display: inline-block;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.site-nav a:not(.btn) {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:not(.btn):hover {
  color: var(--ink);
}
.nav-links {
  display: flex;
  gap: 24px;
}
@media (max-width: 780px) {
  .nav-links {
    display: none;
  }
}

/* ---------- hero ---------- */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 500px);
  gap: 40px;
  align-items: start;
  padding-top: 36px;
  padding-bottom: 24px;
}
@media (max-width: 1080px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }
}
.hero-copy,
.demo-copy {
  /* Grid items default to min-width:auto (their content's intrinsic
     minimum), which can force this column — and the whole grid — wider
     than a narrow viewport regardless of the track's own minmax(0, …).
     This lets it actually shrink to fit. */
  min-width: 0;
}
.hero-copy .lede {
  margin-bottom: 1.2em;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1.3em;
}
.hero-ctas .btn {
  /* Flex items default to min-width:auto (their unwrapped text width),
     which can overflow a narrow viewport (e.g. 320px) before flex-wrap
     ever gets a chance to help — this lets the button itself shrink and
     its label wrap instead. */
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  text-align: center;
}
.hero-trust {
  font-size: 0.88rem;
  color: var(--ink-faint);
}

.demo-card {
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.demo-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px dashed var(--paper-line);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.demo-card-label .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--stamp);
  flex-shrink: 0;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.demo-card-note {
  padding: 10px 18px 16px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* Simplified, stylised mock storefront behind the live demo chat — CSS/SVG
   only, no real brand. The point is to show the widget the way it'd
   actually sit on a shop's page, not float in blank space. */
.storefront-mock {
  position: relative;
  background: var(--paper-alt);
  padding: 18px 18px 20px;
}
.storefront-mock-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--paper-line);
}
.storefront-mock-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.storefront-mock-cart {
  width: 18px;
  height: 18px;
  color: var(--ink-faint);
}
.storefront-mock-products {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mock-product {
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mock-product-img {
  aspect-ratio: 1;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--green-tint), var(--paper-line));
}
.mock-product-img.alt-1 {
  background: linear-gradient(135deg, #e9ddc3, var(--paper-line));
}
@media (prefers-color-scheme: dark) {
  .mock-product-img.alt-1 {
    background: linear-gradient(135deg, #3a3524, var(--paper-line));
  }
}
:root[data-theme="dark"] .mock-product-img.alt-1 {
  background: linear-gradient(135deg, #3a3524, var(--paper-line));
}
.mock-product-img.alt-2 {
  background: linear-gradient(135deg, var(--paper-line), var(--green-tint));
}
.mock-product-title {
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mock-product-price {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink);
  margin: 0;
}
.mock-add-to-cart {
  font-size: 0.62rem;
  border: 1px solid var(--paper-line);
  background: transparent;
  color: var(--ink-faint);
  border-radius: 999px;
  padding: 3px 6px;
  font-family: inherit;
}
.mock-add-to-cart:disabled {
  cursor: default;
}

.demo-widget-target {
  width: 100%;
  height: 460px;
  margin-top: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
@media (min-width: 720px) {
  .storefront-mock {
    /* Tall enough that the absolutely-positioned widget (bottom:18px,
       height:400px below) can't ride up past the top of this box and
       overlap the demo-card-label sibling above it — it's fine for the
       widget to cover part of the mock's own product grid (that's the
       point: it's meant to look like it's really sitting on the page),
       but it must never escape its own container. */
    min-height: 440px;
  }
  .demo-widget-target {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 280px;
    height: 400px;
    margin-top: 0;
  }
}

/* ---------- how it works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 48px;
}
@media (max-width: 780px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}
.step-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  color: var(--green);
  flex-shrink: 0;
}
.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}
.step .step-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--brass);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step p {
  color: var(--ink-soft);
}

/* ---------- what it handles ---------- */
.handles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--paper-line);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 48px;
}
@media (max-width: 700px) {
  .handles-grid {
    grid-template-columns: 1fr;
  }
}
.handles-grid > div {
  background: var(--paper);
  padding: 28px;
}
.handles-grid .icon {
  margin-bottom: 14px;
}
.handles-grid h3 {
  margin-bottom: 0.35em;
}
.handles-grid p {
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- while you sleep ---------- */
.sleep-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
@media (max-width: 860px) {
  .sleep-layout {
    grid-template-columns: 1fr;
  }
}
.sleep-intro p.lede {
  margin-bottom: 0;
}
.sleep-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 640px) {
  .sleep-list {
    grid-template-columns: 1fr;
  }
}
.sleep-item {
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sleep-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--brass);
}
.sleep-q {
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink);
}
.sleep-a {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- safety ---------- */
.safety-list {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
}
@media (max-width: 700px) {
  .safety-list {
    grid-template-columns: 1fr;
  }
}
.safety-list li {
  padding-left: 26px;
  position: relative;
  color: var(--ink-soft);
}
.safety-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 2px;
  background: var(--brass-bright);
}
.safety-list strong {
  color: var(--ink);
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 0.2em;
}

/* ---------- pricing ---------- */
.pricing-card {
  max-width: 560px;
  margin: 48px auto 0;
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 40px 40px 32px;
  position: relative;
  text-align: center;
}
.pricing-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 0;
  border-top: 2px dashed var(--paper-line);
}
.pricing-card .eyebrow {
  margin-bottom: 0.5em;
}
.price-figure {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 0.4em 0 1.3em;
}
.price-amount {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--ink);
  line-height: 1;
}
.price-period {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink-faint);
}
.price-standard {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: -0.8em 0 1.4em;
}
.price-standard s {
  color: var(--stamp);
  text-decoration-thickness: 1.5px;
}
.price-terms {
  list-style: none;
  margin: 0 0 1.8em;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.price-terms li {
  color: var(--ink-soft);
  padding-left: 22px;
  position: relative;
}
.price-terms li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 12px;
  height: 2px;
  background: var(--brass-bright);
}
.pricing-card p {
  max-width: none;
  color: var(--ink-soft);
}
.pricing-card .btn {
  margin-top: 4px;
}
.pricing-card .btn-text {
  display: block;
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--ink-faint);
  text-decoration: underline;
}
.pricing-card .btn-text:hover {
  color: var(--green);
}

/* ---------- about ---------- */
.about .wrap {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 700px) {
  .about .wrap {
    grid-template-columns: 1fr;
  }
}
.about-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--paper-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.82rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
/* Only the empty placeholder state (plain text, no <img> child) gets the
   dashed border and padding — once a real photo is in place it should read
   as a normal photo frame, not an unfilled slot. */
.about-photo:not(:has(img)) {
  border: 2px dashed var(--paper-line);
  padding: 16px;
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}
.about h2 {
  margin-bottom: 0.5em;
}
.about p {
  color: var(--ink-soft);
}
.about .signoff {
  font-family: var(--font-display);
  color: var(--ink);
  font-style: italic;
  margin-top: 1.4em;
}

/* ---------- FAQ ---------- */
.faq-list {
  margin-top: 40px;
  border-top: 1px solid var(--paper-line);
}
.faq-item {
  border-bottom: 1px solid var(--paper-line);
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary .plus {
  font-family: var(--font-mono);
  color: var(--brass);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.faq-item[open] summary .plus {
  transform: rotate(45deg);
}
.faq-item .faq-answer {
  padding: 0 4px 22px;
  color: var(--ink-soft);
  max-width: var(--measure);
}

/* ---------- lead form ---------- */
.lead-form-card {
  max-width: 480px;
  margin: 44px auto 0;
  background: var(--white);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px 32px 28px;
}
.form-row {
  margin-bottom: 16px;
}
.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-row input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
.form-row input:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--focus-ring);
}
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.lead-form-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.form-status {
  margin-top: 14px;
  font-size: 0.92rem;
  text-align: center;
}
.form-status[data-state="success"] {
  color: var(--green);
}
.form-status[data-state="error"] {
  color: var(--stamp);
}

/* ---------- CTA band ---------- */
.cta-band {
  text-align: center;
}
.cta-band h2 {
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--paper-line);
  padding: 40px 0;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--ink-faint);
}
.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--green);
}
.footer-links {
  display: flex;
  gap: 20px;
}

/* ---------- legal pages ---------- */
.legal .wrap {
  max-width: 760px;
  padding-top: 56px;
  padding-bottom: 56px;
}
.legal h1 {
  font-size: clamp(1.8rem, 1.5rem + 1vw, 2.4rem);
}
.legal .updated {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin-bottom: 2em;
}
.legal h2 {
  font-size: 1.3rem;
  margin-top: 1.6em;
}
.legal p,
.legal li {
  color: var(--ink-soft);
}
.legal .draft-notice {
  background: var(--green-tint);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 2em;
}
.legal .draft-notice strong {
  color: var(--stamp);
}

/* section text width constraint for readability on wide sections */
.section-intro {
  max-width: 640px;
}
