/* =============================================================================
   Receipts — Handoff design system (Direction 3)
   Product-credibility, near-mono warm paper + deep green.
   Lifted from design_handoff_receipts/pages/index.html (canonical).
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,400&display=swap');

:root {
  /* Near-mono warm paper */
  --bg:           #f6f3ec;
  --bg-alt:       #efece3;
  --paper:        #fbfaf6;
  --surface:      #ffffff;
  --ink:          #0e1412;
  --ink-2:        #2b3230;
  --ink-3:        #565d5a;
  --ink-4:        #8a908c;
  --line:         #ddd8ca;
  --line-2:       #e8e3d5;
  --line-3:       #f0ecdf;

  /* Brand green (deep, sober, calm) */
  --green:        #2a4d3e;
  --green-2:      #3e6b56;
  --green-3:      #a5bcaf;
  --green-wash:   #eaf0ec;
  --green-ink:    #1b3429;

  /* Accents — clay + amber, never red */
  --clay:         #a8613a;
  --clay-2:       #c2764a;
  --amber:        #c98b4a;
  --amber-wash:   #f7ecd9;

  /* Severity (neutral-ish, never alarming) */
  --sev-low:      #6b8a76;
  --sev-med:      #b88644;
  --sev-high:     #a85a3f;

  /* Type */
  --display:      'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans:         'Geist', -apple-system, system-ui, 'Segoe UI', sans-serif;
  --mono:         'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Rhythm */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --max-w: 1240px;
  --page-pad: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
  font-size: 16px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
img, svg { display: block; max-width: 100%; }

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.01em; }
p { text-wrap: pretty; }

/* Containers */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--page-pad); }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 var(--page-pad); }

/* Type scale */
.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.eyebrow-muted { color: var(--ink-3); }
.display-xl { font-family: var(--sans); font-weight: 500; font-size: clamp(44px, 6vw, 84px); line-height: 1.02; letter-spacing: -0.028em; }
.display-lg { font-family: var(--sans); font-weight: 500; font-size: clamp(36px, 4.6vw, 60px); line-height: 1.04; letter-spacing: -0.024em; }
.display-md { font-family: var(--sans); font-weight: 500; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -0.02em; }
.serif-accent { font-family: var(--display); font-weight: 400; font-style: italic; letter-spacing: -0.02em; }
.body-lg { font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.body-md { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }
.caption { font-size: 13px; color: var(--ink-3); }

/* Nav */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.topnav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  max-width: var(--max-w); margin: 0 auto; padding: 0 var(--page-pad);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-wm { height: 22px; width: auto; }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 14px; color: var(--ink-2); font-weight: 500;
  transition: color 120ms ease;
}
.nav-links a:hover { color: var(--green); }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* Mobile menu toggle (hamburger) — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 0;
  color: var(--ink); cursor: pointer;
  border-radius: 8px;
}
.nav-toggle:hover { background: var(--green-wash); }
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .nav-toggle-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-close { display: block; }

/* Mobile drawer */
.nav-drawer {
  display: none;
  position: fixed; inset: 64px 0 0 0;
  background: var(--bg);
  z-index: 49;
  flex-direction: column;
  padding: 24px var(--page-pad) 32px;
  overflow-y: auto;
  border-top: 1px solid var(--line-2);
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  display: block;
  padding: 14px 0;
  font-size: 18px; font-weight: 500; color: var(--ink);
  border-bottom: 1px solid var(--line-2);
}
.nav-drawer a:hover { color: var(--green); }
.nav-drawer-actions {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 24px;
}
.nav-drawer-actions .btn { width: 100%; height: 48px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  font-family: var(--sans); font-size: 14.5px; font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-green { background: var(--green); color: #f3f7f3; }
.btn-green:hover { background: var(--green-ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-quiet { background: var(--green-wash); color: var(--green-ink); }
.btn-quiet:hover { background: #dfe8e1; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn-danger-ghost {
  background: rgba(168,97,58,.08); color: var(--clay); border-color: rgba(168,97,58,.2);
}

/* Cards & surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}
.card-paper { background: var(--paper); }
.card-dark { background: var(--green-ink); color: #e6ece8; border-color: #2a3d34; }
.divider { height: 1px; background: var(--line-2); }
.rule { border-top: 1px solid var(--line); }

/* Quick Exit FAB */
.qexit {
  position: fixed; top: 14px; right: 14px; z-index: 100;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: rgba(14, 20, 18, 0.88);
  color: #f3efe7;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.01em;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.qexit:hover { background: #000; }
.qexit .kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,.1);
  color: #d9d6cf;
}

/* Footer */
.footer {
  background: var(--green-ink);
  color: #cfd8d2;
  padding: 72px 0 44px;
  margin-top: 120px;
}
.footer a { color: #cfd8d2; }
.footer a:hover { color: #fff; }

/* v2 footer (matches the per-template overrides used across v2-*.html) */
.v2-footer { background: var(--green-ink); color: #cfd8d2; padding: 72px 0 44px; margin-top: 120px; }
.v2-footer a { color: #cfd8d2; }
.v2-footer a:hover { color: #fff; }
.v2-footer h4 {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: #8fa298; margin-bottom: 16px;
}
.v2-footer ul { display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; font-size: 14px; }
.v2-footer .footer-bottom { color: #8fa298; }
.v2-footer-tagline {
  margin-top: 20px; font-size: 14px; line-height: 1.6;
  color: #a6b4ac; max-width: 300px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.footer h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fa298;
  margin-bottom: 16px;
}
.footer ul { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  font-size: 13px; color: #8fa298;
}

/* Section rhythm */
.section { padding: 96px 0; }
.section-tight { padding: 64px 0; }
.section-xl { padding: 128px 0; }

/* Chat bubbles shared */
.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px; line-height: 1.4;
  max-width: 72%;
  box-shadow: 0 1px 1px rgba(0,0,0,0.02);
}
.bubble-other { background: #ece7dc; color: var(--ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble-self  { background: var(--green); color: #eff3ef; border-bottom-right-radius: 4px; align-self: flex-end; }

/* Figure captions */
.figcap {
  font-family: var(--mono);
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-4);
}

/* Severity dot */
.sev-dot { display:inline-block; width:8px; height:8px; border-radius:50%; }
.sev-low  { background: var(--sev-low); }
.sev-med  { background: var(--sev-med); }
.sev-high { background: var(--sev-high); }

/* Footer canary link (inherits .canary text styling, drops anchor decoration) */
a.canary-link { color: inherit; text-decoration: none; }
a.canary-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Inline country-aware helplines block */
.helplines-inline {
  font-size: 13.5px; line-height: 1.6; color: var(--ink-3);
  padding: 14px 16px; margin: 12px 0;
  background: var(--paper); border: 1px solid var(--line-2);
  border-radius: 10px;
}
.helplines-inline strong { color: var(--ink); margin-right: 4px; }
.helplines-inline a { color: var(--green-ink); border-bottom: 1px solid var(--line-2); }
.helplines-inline a:hover { color: var(--green); }

/* Focus */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* Animations */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-soft { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.rise { animation: rise 620ms cubic-bezier(.16,.84,.32,1) both; }
.pulse-soft { animation: pulse-soft 1.4s ease-in-out infinite; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .rise { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* Tables */
.plain-table { width: 100%; border-collapse: collapse; }
.plain-table th, .plain-table td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-2);
  font-size: 14.5px;
  vertical-align: top;
}
.plain-table th {
  font-weight: 500; color: var(--ink-3); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono);
}

/* Pill tag */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--green-wash); color: var(--green-ink);
  font-size: 12px; font-weight: 500;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.tag-amber { background: var(--amber-wash); color: #78501f; }
.tag-muted { background: var(--line-3); color: var(--ink-3); }

/* Hover lift */
.lift { transition: transform 180ms ease, box-shadow 180ms ease; }
.lift:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(14,20,18,0.06); }

/* Responsive */
@media (max-width: 900px) {
  :root { --page-pad: 20px; }
  .nav-links { display: none; }
  .nav-right .locale-selector,
  .nav-right > a:not(.btn),
  .nav-right .btn-ghost { display: none; }
  .nav-toggle { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .section { padding: 64px 0; }
  .section-xl { padding: 80px 0; }
}

@media (max-width: 900px) {
  /* Quick exit moves below the sticky topnav so it doesn't cover the CTA / hamburger.
     v2 pages use .quick-exit (inline override); v1 uses .qexit. Cover both. */
  .qexit, .quick-exit { top: 76px !important; right: 12px !important; height: 32px !important; padding: 0 10px !important; font-size: 12px !important; }
  .qexit .kbd { display: none; }
}

@media (max-width: 540px) {
  :root { --page-pad: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav-right > .btn { height: 38px; padding: 0 12px; font-size: 13px; }
}

/* Touch targets: ensure all interactive elements meet 44px minimum on mobile */
@media (max-width: 900px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
}

/* =============================================================================
   Mobile responsive pass — applies to all v2 templates
   ============================================================================= */

/* Tables: wrap in horizontal scroll on narrow viewports */
@media (max-width: 760px) {
  .plain-table,
  .comparison-table,
  .deploy-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .plain-table thead,
  .comparison-table thead,
  .deploy-table thead { display: table-header-group; }
  .plain-table tbody,
  .comparison-table tbody,
  .deploy-table tbody { display: table-row-group; }
  .plain-table tr,
  .comparison-table tr,
  .deploy-table tr { display: table-row; }
  .plain-table th, .plain-table td,
  .comparison-table th, .comparison-table td,
  .deploy-table th, .deploy-table td {
    display: table-cell;
    white-space: normal;
  }
}

/* Forms: full-width inputs and stacked action rows on mobile */
@media (max-width: 760px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* prevents iOS Safari zoom on focus */
  }
  textarea { min-height: 120px; }
  form .btn { width: 100%; }
}

/* Modal: full-bleed on small screens */
@media (max-width: 540px) {
  .v2-modal {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px !important;
  }
  .v2-modal form {
    flex-direction: column;
    gap: 10px;
  }
  .v2-modal form .btn { width: 100%; }
}

/* Headline and section compression at very small widths */
@media (max-width: 480px) {
  .display-xl { font-size: clamp(34px, 9vw, 44px); line-height: 1.05; }
  .display-lg { font-size: clamp(28px, 7.4vw, 36px); line-height: 1.08; }
  .display-md { font-size: clamp(22px, 6vw, 28px); line-height: 1.12; }
  .body-lg { font-size: 16.5px; }
  .section { padding: 48px 0; }
  .section-tight { padding: 40px 0; }
  .section-xl { padding: 56px 0; }
  .footer { padding: 56px 0 32px; margin-top: 72px; }
  .v2-footer { padding: 56px 0 32px; margin-top: 72px; }
}

/* Inline flex rows that look like card headers/stats: allow wrapping */
@media (max-width: 600px) {
  .pattern-tally-counts,
  .stat-grid,
  .v2-footer-tag-row {
    flex-wrap: wrap;
  }
}

/* Phone frames scale down on narrow screens */
@media (max-width: 600px) {
  .phone-frame {
    width: 100% !important;
    max-width: 280px;
  }
}

/* Card padding tightens on mobile to recover horizontal space */
@media (max-width: 540px) {
  .card { border-radius: 14px; }
}

/* Drawer: ensure links remain usable when many items */
@media (max-height: 600px) {
  .nav-drawer { padding-top: 16px; padding-bottom: 16px; }
  .nav-drawer a { padding: 11px 0; font-size: 16px; }
}

/* Prevent horizontal overflow from rogue inline content (preserve sticky topnav) */
@media (max-width: 760px) {
  body { overflow-x: clip; }
}
