/* =========================================================================
 * forms.css -- shared styles for contact.html and enterprise.html
 *
 * Mirrors the design tokens declared inline in index.html so the form
 * pages match the landing without forcing us to import the entire ~700-line
 * landing stylesheet. If you change a token in index.html, update it here.
 * ======================================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #F2EAD9;
  --paper-2: #ECE2CB;
  --paper-3: #E4D8BC;
  --linen: #FBF7EE;
  --ink: #1B1714;
  --ink-2: #2C251E;
  --muted: #6E6051;
  --muted-2: #8C7E6C;
  --rule: #1B17141A;
  --rule-strong: #1B171426;
  --clay: #A8451E;
  --clay-deep: #8A3815;
  --sand: #D9C49A;
  --olive: #4D4A33;
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'ss01', 'cv11', 'tnum';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--ink); color: var(--paper); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.serif { font-family: 'Fraunces', Georgia, serif; font-optical-sizing: auto; }
.small-caps {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 500; color: var(--muted);
}

/* ============ NAV (matches index.html) ============
 * Byte-for-byte port of the operator app's sticky mobile header
 * pattern in apps/web/src/shell/AppShell.tsx -- see the .nav block
 * in apps/marketing/index.html for the full rationale. Invariants:
 *   1. position: sticky (NOT fixed). Sticky stays in flow and avoids
 *      iOS Safari's fixed-element safe-area quirks.
 *   2. NO padding-top on the outer .nav. Padding lives on .nav-inner
 *      so the brand row clears the Dynamic Island while the sticky
 *      bg paints the entire row (including the safe-area strip).
 *   3. NO body { padding-top } reservation; sticky is in flow.
 *   4. Translucent rgba paper + backdrop-filter on every viewport.
 */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(242,234,217,0.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
  padding-top: env(safe-area-inset-top);
}
.brand {
  display: flex; align-items: baseline; gap: 8px;
  font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 1.15rem; letter-spacing: -0.015em;
}
.brand .mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--clay);
  transform: translateY(-1px);
}
/* Image wordmark variants for nav (light bg) and footer (dark bg).
 * The footer-logo uses brightness(0) + invert(1) to flatten the multi-color
 * wordmark into a clean white silhouette so it reads on the ink footer
 * without needing a separate inverted asset. */
.nav-logo,
.footer-logo {
  display: inline-flex; align-items: center;
  line-height: 0;
}
.nav-logo img {
  height: 36px; width: auto; display: block;
}
.footer-logo img {
  height: 38px; width: auto; display: block;
  filter: brightness(0) invert(1);
  opacity: 0.94;
}
@media (max-width: 900px) {
  .nav-logo img { height: 30px; }
  .footer-logo img { height: 32px; }
}
.nav-links { display: flex; gap: 36px; }
.nav-links a {
  font-size: 0.875rem; color: var(--ink-2); font-weight: 500;
  position: relative; padding: 6px 0;
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: 2px;
  height: 1px; background: var(--ink); transition: right .3s ease;
}
.nav-links a:hover::after { right: 0; }
.nav-right { display: flex; gap: 8px; align-items: center; }
.nav-right .signin { font-size: 0.875rem; color: var(--ink-2); padding: 8px 14px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer; transition: all .25s ease;
  line-height: 1; white-space: nowrap; text-decoration: none;
}
.btn-dark {
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
}
.btn-dark:hover { background: var(--ink-2); transform: translateY(-1px); }
.btn-dark:disabled { background: var(--muted-2); border-color: var(--muted-2); cursor: not-allowed; transform: none; }
.btn-outline {
  background: transparent; color: var(--ink);
  border-color: var(--rule-strong);
}
.btn-outline:hover { border-color: var(--ink); }
.btn-lg { padding: 15px 26px; font-size: 0.95rem; }
.btn .arrow { display: inline-block; transition: transform .3s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ============ Page header ============ */
.page-head {
  padding: 80px 0 56px;
}
.page-head .eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.page-head .eyebrow .bar { width: 22px; height: 1px; background: var(--ink); }
.page-head h1 {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  max-width: 720px;
}
.page-head h1 em {
  font-style: italic; font-weight: 350;
  color: var(--clay);
}
.page-head .lede {
  font-size: 1.08rem;
  color: var(--ink-2);
  line-height: 1.55;
  max-width: 600px;
}

/* ============ Form layout ============ */
.form-shell {
  padding: 0 0 120px;
  border-top: 1px solid var(--rule);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 80px;
  padding: 72px 0;
}
.form-aside { padding-top: 8px; }
.form-aside h2 {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: 1.7rem; letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.form-aside h2 em { font-style: italic; color: var(--clay); }
.form-aside p {
  font-size: 0.95rem; color: var(--ink-2); line-height: 1.55;
  margin-bottom: 18px;
}
.form-aside ul {
  list-style: none; margin-bottom: 0;
}
.form-aside ul li {
  font-size: 0.9rem; color: var(--ink-2); line-height: 1.55;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
  display: flex; align-items: flex-start; gap: 10px;
}
.form-aside ul li::before {
  content: '+'; color: var(--clay); font-weight: 500;
  font-family: 'Fraunces', serif; font-size: 1rem; line-height: 1.3;
}
.form-aside ul li:last-child { border-bottom: 0; }

.form-card {
  background: var(--linen);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  padding: 40px;
}

.form-section { margin-bottom: 28px; }
.form-section:last-of-type { margin-bottom: 0; }
.form-section .section-label {
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 500; color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row:last-child { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 0.82rem; color: var(--ink-2); font-weight: 500;
}
.field label .req { color: var(--clay); }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.field input,
.field select,
.field textarea {
  font: inherit; font-size: 0.95rem; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 11px 14px;
  width: 100%;
  outline: none;
  transition: border-color .15s, background .15s;
  font-family: inherit;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
  background: #FFFCF4;
}
.field textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%231B1714' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px;
  padding-right: 36px;
}
.field-checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
}
.field-checks label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; color: var(--ink-2); font-weight: 400;
  cursor: pointer;
}
.field-checks input[type="checkbox"] {
  width: auto;
  accent-color: var(--ink);
}

/* honeypot -- visually hidden but still part of the form */
.honeypot {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.form-actions {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.form-actions .legal {
  font-size: 0.78rem; color: var(--muted); max-width: 320px;
}
.form-actions .legal a { border-bottom: 1px solid var(--rule-strong); }

.form-error {
  background: rgba(168,69,30,0.08);
  border: 1px solid rgba(168,69,30,0.3);
  color: var(--clay-deep);
  padding: 12px 14px; border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}
.form-error.is-visible { display: block; }

/* ============ Success state ============ */
.success-card {
  background: var(--linen);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  padding: 56px 48px;
  text-align: center;
  display: none;
}
.success-card.is-visible { display: block; }
.success-card .sm-cap {
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px;
}
.success-card h2 {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: 2.2rem; letter-spacing: -0.02em; line-height: 1.05;
  margin-bottom: 16px;
}
.success-card h2 em { font-style: italic; color: var(--clay); }
.success-card p {
  font-size: 1rem; color: var(--ink-2); line-height: 1.55;
  max-width: 460px; margin: 0 auto 28px;
}
.success-card .btn { justify-content: center; }

/* ============ Footer ============ */
footer {
  background: var(--ink);
  color: var(--paper);
  padding: 80px 0 32px;
}
.foot-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 56px; margin-bottom: 80px;
}
.foot-brand .brand { color: var(--paper); }
.foot-brand .brand .mark { background: var(--sand); }
.foot-tag {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.02em;
  margin-top: 28px; max-width: 380px;
  color: var(--linen);
}
.foot-tag em { font-style: italic; color: var(--sand); }
.foot-col h5 {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--sand); margin-bottom: 20px; font-weight: 500;
}
.foot-col a {
  display: block; color: rgba(251,247,238,0.7);
  padding: 6px 0; font-size: 0.92rem; transition: color .2s;
}
.foot-col a:hover { color: var(--paper); }
.foot-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding-top: 28px; border-top: 1px solid rgba(251,247,238,0.12);
  font-size: 0.82rem; color: rgba(251,247,238,0.55);
}

/* ============ Mobile nav (hamburger + off-canvas drawer) ========
 * Mirror of the same primitive shipped inline in index.html so the
 * page-style HTMLs (contact, enterprise) share one mobile nav UX.
 * The toggle and drawer markup must be present on each page that
 * loads this stylesheet; the matching mobileNav() script lives in
 * /assets/forms.js. */
.nav-toggle {
  display: none;
  appearance: none; background: transparent; border: 0; cursor: pointer;
  padding: 10px; margin: -10px -8px -10px 0;
  color: var(--ink); line-height: 0;
}
.nav-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.nav-toggle svg { display: block; width: 22px; height: 22px; }
.nav-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(86vw, 320px);
  background: var(--paper);
  border-left: 1px solid var(--rule-strong);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 60; overflow-y: auto;
  padding: calc(22px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
  visibility: hidden;
}
.nav-drawer a {
  display: block; padding: 12px 0;
  font-size: 1rem; color: var(--ink); font-weight: 500;
  border-bottom: 1px solid var(--rule);
}
/* Drawer CTAs -- see apps/marketing/index.html for design rationale.
 * Sign in: full-width ghost pill (tertiary). Start trial: full-width
 * solid ink pill (primary). Separated from the link column above by a
 * rule so it reads as an "actions" group. */
.nav-drawer .nav-drawer-cta {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 12px;
}
.nav-drawer .nav-drawer-cta a { border-bottom: 0; padding: 0; }
.nav-drawer .nav-drawer-cta .nav-drawer-signin {
  display: block;
  width: 100%;
  padding: 14px 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  transition: color .2s ease, border-color .2s ease;
}
.nav-drawer .nav-drawer-cta .nav-drawer-signin:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.nav-drawer .nav-drawer-cta .btn {
  width: 100%;
  justify-content: center;
  padding: 16px 24px;
  font-size: 0.98rem;
  font-weight: 500;
}
/* `.nav-drawer a` sets color: var(--ink) on every anchor in the drawer
 * with specificity (0,2,0). Stronger than `.btn-dark` (0,1,0), so the
 * "Start 14-day trial" anchor would render ink-on-ink (invisible).
 * This rule restores paper-on-ink contrast at higher specificity. */
.nav-drawer .nav-drawer-cta .btn.btn-dark { color: var(--paper); }
.nav-drawer .nav-drawer-cta .btn.btn-dark:hover { color: var(--paper); }
.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}
.nav-drawer-head .small-caps { color: var(--muted); }
.nav-drawer-close {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  padding: 8px; margin: -8px;
  color: var(--ink); line-height: 0;
}
.nav-drawer-close svg { display: block; width: 20px; height: 20px; }
.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(27,23,20,0.35);
  backdrop-filter: blur(1px);
  opacity: 0; transition: opacity .25s ease;
  z-index: 55; pointer-events: none;
}
body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
body.nav-open .nav-drawer { transform: translateX(0); visibility: visible; }
body.nav-open { overflow: hidden; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .wrap { padding: 0 22px; }
  /* Mobile nav rebuild: position: fixed + opaque paper + safe-area padding
   * on the nav itself + body padding-top reservation. See the full
   * rationale block in apps/marketing/index.html -- in short, iOS Safari's
   * combination of position: sticky + translucent rgba + viewport-fit=cover
   * leaks hero text through the nav, and only a fixed/opaque/!important
   * stack eliminates every variant of the bug. */
  .nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--paper) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--rule);
  }
  .nav-inner {
    padding-top: 0;
    height: 60px;
  }
  body {
    padding-top: calc(60px + env(safe-area-inset-top));
  }
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-right .signin { display: none; }
  .page-head { padding: 56px 0 32px; }
  .form-grid { grid-template-columns: 1fr; gap: 32px; padding: 48px 0; }
  .form-aside { padding-top: 0; }
  .form-card { padding: 28px; }
  .field-row.cols-2 { grid-template-columns: 1fr; }
  .field-checks { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; align-items: flex-start; gap: 14px; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 56px; }
  .success-card { padding: 40px 24px; }
}
@media (max-width: 600px) {
  .nav-inner { height: 56px; }
  body { padding-top: calc(56px + env(safe-area-inset-top)); }
  .form-card { padding: 20px; border-radius: 12px; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .form-actions .legal { max-width: 100%; }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; margin-bottom: 40px; }
  .success-card { padding: 32px 18px; }
  .success-card h2 { font-size: 1.8rem; }
}
