/* ============================================================
   Synergy Backend Lab — landing page
   Light, Apple-inspired aesthetic
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --accent: #0066cc;
  --accent-strong: #0077ed;
  --green: #1a7f37;
  --green-dot: #30b455;
  --border: #d2d2d7;
  --hairline: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  --card-shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.09);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono",
    Menlo, Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(0, 102, 204, 0.16); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

img, svg { display: block; }

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

section { scroll-margin-top: 76px; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.85s var(--ease-out) var(--d, 0ms),
    transform 0.85s var(--ease-out) var(--d, 0ms);
}
.reveal.in-view { opacity: 1; transform: none; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 52px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.nav.scrolled {
  border-bottom-color: var(--hairline);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04);
}

.nav-inner {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark { width: 24px; height: 24px; }
.brand-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
}
.nav-links a {
  position: relative;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
  transition: color 0.25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a[data-spy]::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -7px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%) scale(0);
  transition: transform 0.3s var(--ease-out);
}
.nav-links a.active { color: var(--text); font-weight: 500; }
.nav-links a.active::after { transform: translateX(-50%) scale(1); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px !important;
  border-radius: 999px;
  background: rgba(0, 102, 204, 0.08);
  color: var(--accent) !important;
  font-size: 13px;
  font-weight: 500 !important;
  transition: background 0.25s ease, transform 0.25s var(--ease-out);
}
.nav-cta:hover { background: rgba(0, 102, 204, 0.14); transform: translateY(-1px); }
.nav-cta::after { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out);
}
.nav.open .nav-toggle span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav.open .nav-toggle span:last-child  { transform: translateY(-3.25px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 168px 0 104px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 540px at 50% -8%, rgba(0, 102, 204, 0.07), transparent 62%),
    linear-gradient(to right, rgba(29, 29, 31, 0.038) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(29, 29, 31, 0.038) 1px, transparent 1px);
  background-size: auto, 54px 54px, 54px 54px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 92%);
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green-dot);
  animation: ripple 2.2s ease-out infinite;
}

@keyframes ripple {
  0%   { box-shadow: 0 0 0 0 rgba(48, 180, 85, 0.45); }
  100% { box-shadow: 0 0 0 9px rgba(48, 180, 85, 0); }
}

.hero h1 {
  margin-top: 28px;
  font-size: clamp(2.9rem, 7vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.04;
}

.hero-sub {
  margin-top: 20px;
  max-width: 640px;
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.35;
}

.hero-copy {
  margin-top: 18px;
  max-width: 620px;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-2);
}

.hero-actions {
  margin-top: 34px;
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons & links */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 999px;
  padding: 12px 26px;
  transition: background 0.25s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 102, 204, 0.28);
}
.btn-primary:active { transform: translateY(0); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.25s ease;
}
.link-arrow svg { transition: transform 0.3s var(--ease-out); }
.link-arrow:hover { color: var(--accent-strong); }
.link-arrow:hover svg { transform: translate(2px, -2px); }

/* ---------- Relay preview card ---------- */
.relay-card {
  margin-top: 64px;
  width: 100%;
  max-width: 780px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  text-align: left;
}

.relay-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  background: #fbfbfd;
}
.relay-url {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.relay-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--green);
  white-space: nowrap;
}

.status-dot {
  position: relative;
  width: 8px; height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green-dot);
  animation: ripple 2.2s ease-out infinite;
}
.status-dot.small { width: 7px; height: 7px; }

.relay-feed {
  min-height: 172px;
  padding: 8px 20px;
}

.feed-item {
  display: grid;
  grid-template-columns: 92px 78px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-family: var(--font-mono);
  font-size: 12px;
  animation: feedIn 0.55s var(--ease-out);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item.leaving { opacity: 0; transform: translateY(8px); }

@keyframes feedIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

.feed-time { color: var(--text-3); }
.feed-dir { font-weight: 600; letter-spacing: 0.04em; color: var(--accent); }
.feed-dir.ack { color: var(--green); }
.feed-payload {
  color: #424245;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--text-3);
  background: #fbfbfd;
}

/* ============================================================
   Sections — shared
   ============================================================ */
.section { padding: 112px 0; }
.section-gray { background: var(--bg-alt); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-head { margin-bottom: 56px; }
.section-head h2 { margin-top: 14px; }
.section-sub {
  margin-top: 14px;
  max-width: 560px;
  font-size: 1.0625rem;
  color: var(--text-2);
}

h2 {
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
}

/* ============================================================
   Overview
   ============================================================ */
.overview .lead {
  margin-top: 22px;
  max-width: 860px;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.42;
}

.overview-cols {
  margin-top: 44px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 56px;
  max-width: 900px;
}
.overview-cols p {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text-2);
  border-top: 1px solid var(--hairline);
  padding-top: 22px;
}

/* ============================================================
   Capabilities — bento grid
   ============================================================ */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

.card {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  padding: 30px 28px 26px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--card-shadow);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.card-wide { grid-column: span 3; }

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 14px;
  margin-bottom: 22px;
}
.icon-chip svg { width: 23px; height: 23px; }

.chip-blue   { background: linear-gradient(135deg, #e9f2fe, #d6e7fc); color: #0066cc; }
.chip-teal   { background: linear-gradient(135deg, #e2f6f3, #ccefe9); color: #0c8577; }
.chip-orange { background: linear-gradient(135deg, #fdf1e4, #fbe3cb); color: #b9500e; }
.chip-purple { background: linear-gradient(135deg, #f1ecfd, #e3d9fa); color: #6633c2; }
.chip-green  { background: linear-gradient(135deg, #e8f6ec, #d5eedd); color: #1a7f37; }

.card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  margin-bottom: 10px;
}
.card p {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text-2);
}

.card-chip {
  margin-top: 22px;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-alt);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-2);
  transition: background 0.3s ease, color 0.3s ease;
}
.card:hover .card-chip { background: #e9f2fe; color: var(--accent); }

/* ============================================================
   Endpoints
   ============================================================ */
.endpoint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.endpoint {
  display: flex;
  flex-direction: column;
  padding: 30px 28px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--card-shadow);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}
.endpoint:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.endpoint-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.endpoint h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.014em;
}
.endpoint > p {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text-2);
  margin-bottom: 20px;
}

.proto-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.badge-https { background: #e9f2fe; color: #0066cc; }
.badge-wss   { background: #e5f5ea; color: #1a7f37; }

.url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  margin-bottom: 18px;
}
.url {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s var(--ease-out);
}
.copy-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1); }
.copy-btn.is-copied { background: #e5f5ea; color: var(--green); }

.endpoint-hint {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--text-3);
}
.endpoint .link-arrow { margin-top: auto; align-self: flex-start; }

/* ---------- Payload code block ---------- */
.payload-block {
  margin-top: 20px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fbfbfd;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 18px;
  border-bottom: 1px solid var(--hairline);
  background: #f2f3f5;
}
.code-file {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.code-body {
  padding: 22px 24px;
  overflow-x: auto;
}
.code-body code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
}
.k { color: #0550ae; }
.s { color: #116329; }
.p { color: #57606a; }

/* ---------- Notes row ---------- */
.endpoint-notes {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 20px;
  margin-top: 20px;
}

.note {
  display: flex;
  gap: 14px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
}
.note-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 2px;
  color: var(--accent);
}
.note strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.note p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-2);
}

.note-map { flex-direction: column; gap: 12px; }
.note-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tree {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.85;
  color: var(--text-2);
  overflow-x: auto;
}
.map-active {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text-2);
}
.map-active code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1px 7px;
}

/* ============================================================
   Principles
   ============================================================ */
.principles { list-style: none; }

.principles li {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 24px;
  align-items: start;
  padding: 30px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.09);
}
.principles li:last-child { border-bottom: 1px solid rgba(0, 0, 0, 0.09); }

.p-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 6px;
  position: relative;
}
.p-num::after {
  content: "";
  position: absolute;
  left: 0; top: 26px;
  width: 22px; height: 1px;
  background: rgba(0, 102, 204, 0.35);
}

.principles h3 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.016em;
  margin-bottom: 8px;
  transition: color 0.3s ease;
}
.principles li:hover h3 { color: var(--accent); }
.principles p {
  max-width: 640px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-2);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--hairline);
  padding: 52px 0 40px;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.footer-brand .brand-name { font-size: 13.5px; }

.footer-links {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 12.5px;
  color: var(--text-2);
  transition: color 0.25s ease;
}
.footer-links a:hover { color: var(--text); }

.footer-disclaimer {
  max-width: 720px;
  padding: 26px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.footer-disclaimer p {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 10px;
}
.footer-disclaimer p:last-child { margin-bottom: 0; }
.footer-disclaimer strong { color: var(--text); font-weight: 600; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 24px;
  font-size: 12px;
  color: var(--text-3);
}
.footer-bottom .map-active { font-size: 12px; color: var(--text-2); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .card, .card-wide { grid-column: span 3; }
  .endpoint-notes { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 52px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 24px 22px;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hairline);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s var(--ease-out), visibility 0.3s;
  }
  .nav.open .nav-links {
    opacity: 1;
    transform: none;
    visibility: visible;
  }
  .nav-links a {
    width: 100%;
    font-size: 15px;
    padding: 10px 0;
  }
  .nav-links a[data-spy]::after { display: none; }
  .nav-cta { margin-top: 8px; width: auto !important; }
}

@media (max-width: 640px) {
  .section { padding: 76px 0; }
  .hero { padding: 132px 0 72px; }

  .card, .card-wide { grid-column: span 6; }
  .endpoint-grid { grid-template-columns: 1fr; }
  .overview-cols { grid-template-columns: 1fr; gap: 0; }
  .overview-cols p + p { margin-top: 22px; }

  .principles li { grid-template-columns: 1fr; gap: 10px; }
  .p-num::after { display: none; }

  .feed-item { grid-template-columns: 84px 1fr; }
  .feed-payload { grid-column: 1 / -1; }

  .hero-actions { gap: 18px; }
  .footer-top, .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .feed-item { animation: none; }
  .status-dot, .chip-dot { animation: none; }
  .card, .endpoint, .btn, .link-arrow svg { transition: none; }
}
