/* MessageGateBot site styles. Gold tone, light/dark, system fonts only. */
:root {
  --bg: #FBF9F4; --surface: #FFFFFF; --fill: #F3EFE6; --label: #1C1A16;
  --secondary: #6B655A; --hair: rgba(60,45,10,0.10); --nav: rgba(251,249,244,0.72);
  --code: #1C1A16; --link: #8A5A00; --gold-text: #8A5A00; --ok: #1B7A33; --warn: #A84300;
  --accent: #E8B634; --on-accent: #1C1A16;
  --shadow: 0 1px 2px rgba(60,45,10,0.05), 0 12px 40px rgba(60,45,10,0.10);
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0C0B09; --surface: #1A1814; --fill: #24211B; --label: #F5F1E8;
  --secondary: #A8A193; --hair: rgba(255,240,200,0.12); --nav: rgba(12,11,9,0.70);
  --code: #16140F; --link: #F2C14E; --gold-text: #F2C14E; --ok: #30D158; --warn: #FF9F0A;
  --shadow: 0 0 0 1px rgba(255,240,200,0.10);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0B09; --surface: #1A1814; --fill: #24211B; --label: #F5F1E8;
    --secondary: #A8A193; --hair: rgba(255,240,200,0.12); --nav: rgba(12,11,9,0.70);
    --code: #16140F; --link: #F2C14E; --gold-text: #F2C14E; --ok: #30D158; --warn: #FF9F0A;
    --shadow: 0 0 0 1px rgba(255,240,200,0.10);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px; line-height: 1.47; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1024px; margin: 0 auto; padding-left: 22px; padding-right: 22px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }

.press { transition: transform 100ms ease-out, opacity 100ms ease-out; }
.press:active { transform: scale(0.97); opacity: 0.86; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10; background: var(--nav);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 var(--hair);
}
.site-nav { min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--label); font-weight: 600; font-size: 16px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0 24px; flex: 1 1 auto; }
.nav-links a { color: var(--label); padding: 14px 0; opacity: 0.85; }
.nav-links a[aria-current="page"] { opacity: 1; font-weight: 600; }
.theme-toggle {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  color: var(--label); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); border-radius: 980px; font-weight: 500; }
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 17px; min-height: 44px; }

/* Type */
.eyebrow { font-size: 17px; font-weight: 600; color: var(--gold-text); letter-spacing: 0; }
.display { font-size: clamp(44px, 7vw, 80px); line-height: 1.04; letter-spacing: -0.035em; font-weight: 700; }
.display-sm { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; }
.headline { font-size: clamp(32px, 4.5vw, 48px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; }
.lede { font-size: 21px; line-height: 1.38; color: var(--secondary); letter-spacing: -0.015em; }
.muted { color: var(--secondary); }
.small { font-size: 14px; }
.title3 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }

/* Sections */
.band { background: var(--surface); padding: 96px 0; }
.section { padding-top: 96px; padding-bottom: 96px; }
.stack { display: flex; flex-direction: column; }
.center { text-align: center; align-items: center; }

.hero { padding-top: 96px; padding-bottom: 40px; gap: 20px; }
.hero .display { max-width: 880px; }
.hero .lede { max-width: 640px; }
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 28px; margin-top: 8px; }
.cta-row .link { font-size: 17px; padding: 12px 0; }

.showcase { padding-top: 32px; padding-bottom: 96px; display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }

/* Code card */
.code-card { background: var(--code); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.showcase .code-card { flex: 3 1 420px; }
.code-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
.code-meta { display: flex; align-items: center; gap: 12px; }
.code-file { color: #A1A1A6; font-size: 13px; font-family: var(--mono); }
.code-card pre {
  margin: 0; padding: 8px 24px 28px; color: #F5F5F7; font-size: 14px; line-height: 1.75;
  overflow-x: auto; flex: 1; tab-size: 4;
}
.code-card pre[hidden] { display: none; }
.examples .code-card pre { min-height: 300px; }
.copy-btn {
  background: rgba(255,255,255,0.1); color: #F5F5F7; border: 0; border-radius: 980px;
  padding: 7px 14px; font: 500 13px system-ui, -apple-system, sans-serif; cursor: pointer; min-height: 32px;
}
.hl-c { color: #8F887A; font-style: italic; }
.hl-s { color: #F2C14E; }
.hl-v { color: #7DD3FC; }
.hl-k { color: #FF8FB1; }
.hl-f { color: #FDBA74; }
.hl-n { color: #D8C47A; }

/* Segmented control */
.seg {
  --n: 2; --i: 0; position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  border-radius: 9px; padding: 2px; background: var(--fill);
}
.seg-ind {
  position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n));
  border-radius: 7px; background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px var(--hair);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
.seg button {
  position: relative; background: none; border: 0; color: var(--label); cursor: pointer;
  font: 500 14px system-ui, -apple-system, sans-serif; padding: 8px 10px; min-height: 36px;
}
.seg-dark { background: rgba(255,255,255,0.08); }
.seg-dark .seg-ind { background: rgba(255,255,255,0.18); box-shadow: none; }
.seg-dark button { color: #F5F5F7; font-size: 13px; padding: 7px 8px; min-height: 32px; }
.showcase .seg { min-width: 220px; }

/* Chat preview */
.chat { flex: 2 1 300px; min-width: 0; background: var(--fill); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.chat-label { font-size: 13px; font-weight: 600; color: var(--secondary); letter-spacing: 0.01em; padding: 0 4px 4px; }
.alert { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.alert:nth-of-type(2) { opacity: 0.82; transform: scale(0.98); }
.alert:nth-of-type(3) { opacity: 0.62; transform: scale(0.96); }
.alert-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); flex: none; display: flex; align-items: center; justify-content: center; }
.alert-body { min-width: 0; flex: 1; }
.alert-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--secondary); }
.alert-head strong { color: var(--label); font-weight: 600; }
.alert-body p { font-size: 15px; line-height: 1.35; margin-top: 2px; }

/* Features */
.grid { display: grid; gap: 20px; }
.features { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tile { background: var(--fill); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.tile code { font-size: 13px; color: var(--secondary); }
.tile h3 { margin-top: auto; }
.tile p { font-size: 15px; color: var(--secondary); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px; }
.steps li { display: flex; flex-direction: column; gap: 12px; }
.step-n { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--label); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; }

/* API */
.split { display: flex; flex-wrap: wrap; gap: 48px; }
.split > * { min-width: 0; }
.api-facts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; font-size: 15px; }
.list-label { font-size: 13px; color: var(--secondary); padding: 0 16px 8px; letter-spacing: 0.01em; text-transform: uppercase; }
.list { list-style: none; margin: 0; padding: 0; background: var(--fill); border-radius: 14px; overflow: hidden; }
.list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 13px 16px; box-shadow: inset 0 -0.5px 0 var(--hair); font-size: 15px; }
.list li:last-child { box-shadow: none; }
.code-num { font-family: var(--mono); font-size: 14px; font-weight: 600; min-width: 36px; color: var(--secondary); }
.code-num.ok { color: var(--ok); }
.code-num.warn { color: var(--warn); }

/* Tool cards */
.tools { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); padding-top: 96px; padding-bottom: 48px; }
.card { background: var(--surface); box-shadow: var(--shadow); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 8px; color: var(--label); }
.card:hover { text-decoration: none; }
.card p { font-size: 15px; color: var(--secondary); }
.card span { font-size: 15px; color: var(--link); margin-top: 6px; }

.closing { padding-top: 72px; padding-bottom: 120px; gap: 18px; }

/* Examples page */
.examples { padding-top: 80px; padding-bottom: 96px; gap: 32px; }
.examples .seg-kind { width: 100%; max-width: 420px; }
.examples .seg-lang { flex: 0 1 440px; min-width: 0; }
.fields-limits { display: flex; flex-wrap: wrap; gap: 32px; padding-top: 48px; }
.fields-limits h2 { font-size: 28px; letter-spacing: -0.025em; font-weight: 700; margin-bottom: 16px; }
.field-name { font-size: 14px; font-weight: 600; min-width: 96px; }
.field-notes { flex: 1 1 200px; }
.field-req { font-size: 13px; color: var(--secondary); }
.limits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.limit { background: var(--fill); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.limit strong { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.limit span { font-size: 13px; color: var(--secondary); line-height: 1.35; }

/* Legal pages */
.prose { max-width: 720px; padding-top: 80px; padding-bottom: 96px; }
.prose h1 { margin-bottom: 8px; }
.prose h2 { font-size: 24px; letter-spacing: -0.02em; font-weight: 700; margin: 40px 0 12px; }
.prose p, .prose li { color: var(--label); }
.prose p + p { margin-top: 12px; }
.prose ul { padding-left: 22px; margin: 12px 0 0; }
.prose li + li { margin-top: 6px; }
.prose code { font-size: 15px; background: var(--fill); padding: 1px 6px; border-radius: 6px; }

/* Footer */
.site-footer { background: var(--fill); font-size: 12px; color: var(--secondary); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
.site-footer .wrap > span { flex: 1 1 260px; }
.site-footer a { color: var(--label); }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 28px; }
p code { overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .brand { margin-right: auto; }
  .site-nav { gap: 0 12px; }
  .nav-links { order: 3; flex-basis: 100%; gap: 0 20px; }
  .nav-links a { padding: 6px 0 12px; }
  .examples .code-card pre { min-height: 0; }
  .hero, .examples, .prose { padding-top: 56px; }
  .band, .section { padding-top: 64px; padding-bottom: 64px; }
  .showcase { padding-bottom: 64px; }
  .code-card pre { padding-left: 18px; padding-right: 18px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .press, .seg-ind { transition: none; }
  .press:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
