/* =====================================================================
   Sermo — public website design system
   Warm editorial system derived from the redesigned Sermo app.
   Palette + type pulled from app-ui-reference (constants.ts / styles.ts).
   Plain CSS, no build step, Cloudflare Pages friendly.
   ===================================================================== */

/* ---- Fonts ----------------------------------------------------------
   Instrument Serif  -> brand wordmark + editorial display "moments"
   Space Grotesk     -> workhorse sans (headlines, body, UI)
   Space Mono        -> small uppercase utility labels only
   Swap to self-hosted /fonts later if you want to drop the CDN.       */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  /* Surfaces / paper */
  --paper: #f3eee3;        /* primary warm background */
  --paper-deep: #ece5d6;   /* alternating section background */
  --surface: #fcfaf3;      /* cards, panels, app screens */
  --surface-sunk: #ede5d4; /* inset fields, code, chips */

  /* Ink */
  --ink: #211c14;
  --ink-muted: #6e665a;
  --ink-faint: #a89e8c;

  /* Lines */
  --hairline: #e4dbc8;
  --hairline-strong: #d8ceba;
  --row-line: #e8e1d0;

  /* Brand */
  --green: #0c4a38;        /* pine — primary accent */
  --green-deep: #093528;   /* deep pine for dark bands */
  --green-soft: #e2ebe4;   /* pale pine wash */
  --clay: #c25a36;         /* terracotta accent */
  --amber: #b07a1e;        /* amber accent */
  --danger: #a83a22;
  --on-green: #f3eee3;     /* cream on green */

  --shadow-sm: 0 1px 0 rgba(33, 28, 20, 0.04);
  --shadow-md: 0 18px 44px -24px rgba(33, 28, 20, 0.45);
  --shadow-lg: 0 36px 70px -34px rgba(9, 53, 40, 0.55);

  --maxw: 1140px;
  --radius: 18px;
  --radius-sm: 12px;

  --font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }

/* ---- Brand wordmark -------------------------------------------------- */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0;
}
.wordmark .sermo {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  color: var(--green);
  letter-spacing: 0;
}
.wordmark .for { color: var(--ink); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--green);
  color: var(--on-green);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1;
}

/* ---- Utility label (mono) ------------------------------------------- */
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
}
.label.muted { color: var(--ink-muted); }
.label.amber { color: var(--amber); }
.label.on-dark { color: rgba(243, 238, 227, 0.66); }

/* ---- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--green);
  color: var(--on-green);
  box-shadow: 0 14px 30px -14px rgba(9, 53, 40, 0.7);
}
.btn-primary:hover { background: var(--green-deep); box-shadow: 0 18px 36px -14px rgba(9, 53, 40, 0.78); }
.btn-outline {
  background: transparent;
  border-color: var(--hairline-strong);
  color: var(--ink);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-cream {
  background: var(--on-green);
  color: var(--green);
  border-color: rgba(9, 53, 40, 0.12);
}
.btn-cream:hover { background: #fff; }
.btn-ghost { background: transparent; color: var(--green); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; font-size: 15px; padding: 0 18px; }

/* price tag inside a CTA */
.btn .tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.75;
  border-left: 1px solid currentColor;
  padding-left: 8px;
  margin-left: 2px;
}

/* ---- Header --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 238, 227, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--green); }
.nav-cta { display: flex; align-items: center; gap: 12px; }

/* ---- Layout primitives --------------------------------------------- */
.section { padding: 96px 24px; }
.section-sm { padding: 64px 24px; }
.inner { max-width: var(--maxw); margin: 0 auto; }
.inner-narrow { max-width: 820px; margin: 0 auto; }

.section.alt { background: var(--paper-deep); }
.band-green {
  background: var(--green);
  color: var(--on-green);
  position: relative;
  overflow: hidden;
}
.band-green h2, .band-green h3 { color: var(--on-green); }

.kicker { margin-bottom: 18px; }

/* Headings */
h1, .h1 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
  color: var(--ink);
}
h2, .h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--ink);
}
h3, .h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: 0;
}
.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}
em.serif, .h1 .serif, h1 .serif, h2 .serif { color: var(--green); }
.band-green .serif { color: #e8c98a; }

.lede {
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink-muted);
}
.section-head { max-width: 720px; }
.section-head.center { margin: 0 auto; text-align: center; }
.section-head h2 { margin-bottom: 16px; }

/* ---- Cards ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}
.card p { color: var(--ink-muted); }

/* ---- Footer --------------------------------------------------------- */
.site-footer {
  background: var(--green-deep);
  color: rgba(243, 238, 227, 0.7);
  padding: 56px 24px 40px;
}
.footer-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 36px 64px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand .wordmark .sermo { color: #e8c98a; }
.footer-brand .wordmark .for { color: var(--on-green); }
.footer-tag { margin-top: 14px; max-width: 320px; font-size: 14px; line-height: 1.55; color: rgba(243, 238, 227, 0.6); }
.footer-cols { display: flex; flex-wrap: wrap; gap: 44px; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 238, 227, 0.5);
  margin-bottom: 14px;
}
.footer-col a {
  display: block;
  font-size: 15px;
  color: rgba(243, 238, 227, 0.82);
  padding: 5px 0;
  transition: color 0.15s ease;
}
.footer-col a:hover { color: #fff; }
.footer-base {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding-top: 22px;
  border-top: 1px solid rgba(243, 238, 227, 0.14);
  font-size: 13px;
  color: rgba(243, 238, 227, 0.55);
}

/* =====================================================================
   App vignette primitives — used to render believable in-product scenes
   ===================================================================== */
.device {
  background: #11160f;
  border-radius: 46px;
  padding: 11px;
  box-shadow: var(--shadow-lg);
}
.device-screen {
  position: relative;
  background: var(--paper);
  border-radius: 36px;
  overflow: hidden;
  height: 100%;
}
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.statusbar .dot-notch {
  position: absolute;
  top: 9px; left: 50%; transform: translateX(-50%);
  width: 84px; height: 22px;
  background: #11160f; border-radius: 999px;
}
.statusbar .glyphs { display: flex; gap: 6px; align-items: center; font-family: var(--font-mono); font-size: 11px; }

.app-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 12px;
  border-bottom: 1px solid var(--hairline);
}
.app-topbar .menu-btn {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--green); color: var(--on-green);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.app-topbar .title {
  flex: 1;
  font-size: 14.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: baseline; gap: 5px; min-width: 0; line-height: 1.15;
}
.app-topbar .title .sermo {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  font-size: 22px; color: var(--green);
}
.app-topbar .icons { display: flex; align-items: center; gap: 12px; color: var(--green); }
.badge-count {
  position: relative;
}
.badge-count .b {
  position: absolute; top: -6px; right: -8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--clay); color: var(--on-green);
  border-radius: 999px; border: 1.5px solid var(--paper);
  font-family: var(--font-mono); font-weight: 700; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}

/* avatar (rounded square, app style) */
.av {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 17px; flex: none;
}
.av-green { background: var(--green); color: var(--on-green); }
.av-1 { background: #eadfc8; color: #4a4030; }
.av-2 { background: #efd9d2; color: #6b3f33; }
.av-3 { background: #dee6d6; color: #44523a; }
.av-4 { background: #d8e2e6; color: #3a4c52; }
.av-5 { background: #e7dce6; color: #57415a; }

/* conversation row */
.convo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--row-line);
}
.convo .meta { flex: 1; min-width: 0; }
.convo .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.convo .name { font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.convo .time { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.convo .prev { font-size: 13.5px; color: #7c7363; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo.unread .name { color: var(--green); font-weight: 700; }
.convo.unread .prev { color: var(--ink); font-weight: 500; }
.convo .unread-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green); flex: none; }
.pin { color: var(--amber); }

/* chat bubbles */
.bubbles { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
}
.bubble.recv {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid #e6dfce;
  border-bottom-left-radius: 5px;
  color: var(--ink);
}
.bubble.sent {
  align-self: flex-end;
  background: var(--green);
  color: #f1ecdf;
  border-bottom-right-radius: 5px;
}
.bubble .sender {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 3px;
}

/* compose pill */
.compose-pill {
  position: absolute;
  right: 16px; bottom: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green); color: var(--on-green);
  border: 2px solid rgba(243, 238, 227, 0.8);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 22px -8px rgba(9, 53, 40, 0.6);
}

/* watermark for empty app areas / dark bands */
.watermark {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.watermark span {
  position: absolute;
  font-family: var(--font-serif); font-style: italic;
  font-size: 46px; color: var(--ink);
  opacity: 0.05; transform: rotate(-15deg); white-space: nowrap;
}
.band-green .watermark span { color: #fff; opacity: 0.05; }

/* floating annotation cards over a device */
.float-card {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 13px 15px;
  width: 220px;
}
.float-card .fc-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px;
}
.float-card .fc-text { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.float-card .fc-text.green { color: var(--green); }

/* chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 15px; font-weight: 500;
  color: var(--ink);
}
.chip .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--green); }

/* status chip (check-in style) */
.kv-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(176, 122, 30, 0.14);
  color: #6f4d11;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
}

/* =====================================================================
   Forms (setup / unsubscribe) + documents (privacy / support)
   ===================================================================== */
.form-field { display: grid; gap: 8px; margin-bottom: 18px; }
.form-field label {
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.form-field input {
  appearance: none;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: 13px;
  font: inherit; font-size: 17px; color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(12, 74, 56, 0.12);
}
.form-hint { font-size: 13px; color: var(--ink-muted); line-height: 1.4; }

.status {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 13px;
  font-size: 15px;
  line-height: 1.45;
}
.status.show { display: block; }
.status.success { background: var(--green-soft); color: var(--green-deep); border: 1px solid rgba(12, 74, 56, 0.18); }
.status.error { background: #f7e7e2; color: var(--danger); border: 1px solid rgba(168, 58, 34, 0.2); }

.note-amber {
  background: rgba(176, 122, 30, 0.12);
  border: 1px solid rgba(176, 122, 30, 0.24);
  border-radius: 13px;
  padding: 14px 16px;
  color: #5f4310;
  font-size: 15px;
  line-height: 1.5;
}

/* document pages */
.doc { max-width: 760px; margin: 0 auto; padding: 72px 24px 96px; }
.doc h1 { font-size: clamp(36px, 5vw, 52px); margin-bottom: 10px; }
.doc .doc-meta { font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); margin-bottom: 28px; }
.doc h2 { font-size: 22px; margin-top: 38px; margin-bottom: 10px; color: var(--green); }
.doc p { color: var(--ink); margin-bottom: 14px; }
.doc a { color: var(--green); font-weight: 600; border-bottom: 1px solid rgba(12, 74, 56, 0.3); }
.doc a:hover { border-bottom-color: var(--green); }
.doc ul { color: var(--ink); padding-left: 20px; margin: 0 0 16px; }
.doc li { margin-bottom: 7px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .section { padding: 72px 22px; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .nav { padding: 12px 18px; }
  .nav-cta .btn-tagged-hide { display: none; }
  .section { padding: 56px 18px; }
  .footer-grid { flex-direction: column; gap: 32px; }
}
