/* ---------------------------------------------
   Flowstate Labs — design system
   --------------------------------------------- */

:root {
  color-scheme: light;
  --bg: #faf7f2;
  --surface: #fffdf9;
  --ink: #1c1917;
  --ink-2: #57534e;
  --ink-3: #a8a29e;
  --hairline: rgba(28, 25, 23, 0.1);
  --primary: #1c1917;
  --on-primary: #faf7f2;
  --accent: #c2410c;
  --gold: #ea580c;
  --nav-glass: rgba(250, 247, 242, 0.75);
  --pill-bg: rgba(28, 25, 23, 0.05);
  --stroke: rgba(28, 25, 23, 0.2);
  --stroke-dim: rgba(28, 25, 23, 0.1);
  --stroke-fill: rgba(28, 25, 23, 0.08);
  --panel-bg: #1c1917;
  --card-shadow: 0 20px 40px -18px rgba(28, 25, 23, 0.2);
  --icon-1: #ea580c;
  --icon-2: #57534e;
  --icon-3: #1c1917;
  --icon-4: #b45309;
  --canvas-line: 68, 60, 54;
  --canvas-accent: 234, 88, 12;
  --radius-card: 24px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151210;
  --surface: #1f1b18;
  --ink: #f3ede5;
  --ink-2: #b8aea3;
  --ink-3: #78706a;
  --hairline: rgba(255, 255, 255, 0.09);
  --primary: #f3ede5;
  --on-primary: #151210;
  --accent: #fb923c;
  --gold: #fb923c;
  --nav-glass: rgba(21, 18, 16, 0.72);
  --pill-bg: rgba(255, 255, 255, 0.06);
  --stroke: rgba(184, 174, 163, 0.28);
  --stroke-dim: rgba(184, 174, 163, 0.14);
  --stroke-fill: rgba(184, 174, 163, 0.12);
  --panel-bg: #1f1b18;
  --card-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.55);
  --canvas-line: 184, 174, 163;
  --canvas-accent: 251, 146, 60;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  transition: background 0.35s ease, color 0.35s ease;
}

::selection { background: rgba(37, 99, 235, 0.16); }

a { color: inherit; text-decoration: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Reveal-on-scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s var(--ease-spring),
    transform 0.9s var(--ease-spring);
}
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.nav.is-scrolled {
  background: var(--nav-glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--hairline);
}
.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wordmark-glyph { width: 22px; height: 22px; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13.5px;
}
.nav-links a { color: var(--ink-2); transition: color 0.2s ease; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  color: var(--ink) !important;
  border: 1px solid var(--hairline);
  background: var(--surface);
  padding: 7px 15px;
  border-radius: 980px;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}
.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), color 0.2s ease;
}
.theme-toggle:hover { color: var(--ink); transform: rotate(15deg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 150px 24px 60px;
  overflow: hidden;
}
/* Particle field canvas (drawn in script.js) */
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 72% 45%, #000 35%, transparent 95%);
  mask-image: radial-gradient(ellipse 80% 90% at 72% 45%, #000 35%, transparent 95%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 48px;
}
.hero-copy { text-align: left; }
.hero-title { max-width: 640px; }
.hero-actions { justify-content: flex-start; }

/* ---------- Hero illustration (Open Doodles, CC0) ---------- */

.hero-art { display: flex; justify-content: center; }
.hero-art svg {
  width: min(500px, 100%);
  height: auto;
  animation: doodle-drift 7s ease-in-out infinite alternate;
}
.doodle-ink { fill: var(--ink); }
.doodle-accent { fill: var(--gold); }
/* In dark mode the light ink lines sit on top of the accent blob,
   so it must go deep rather than bright to keep the figure legible */
html[data-theme="dark"] .doodle-accent { fill: #9a3412; }

@keyframes doodle-drift {
  from { transform: translateY(-8px); }
  to   { transform: translateY(8px); }
}

@media (max-width: 900px) {
  .hero { padding-top: 120px; }
  .hero-inner { grid-template-columns: 1fr; gap: 56px; }
  .hero-copy { text-align: center; }
  .hero-title { margin-inline: auto; }
  .hero-sub { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-art svg { width: min(320px, 82vw); }
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(42px, 5.6vw, 74px);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.hero-title .accent { color: var(--gold); }

/* Staggered word-by-word entrance */
.hero-title .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em);
  animation: word-rise 1s var(--ease-spring) forwards;
}
.hero-title .w:nth-child(1) { animation-delay: 0.05s; }
.hero-title .w:nth-child(2) { animation-delay: 0.13s; }
.hero-title .w:nth-child(3) { animation-delay: 0.21s; }
.hero-title .w:nth-child(5) { animation-delay: 0.33s; }
.hero-title .w:nth-child(6) { animation-delay: 0.41s; }
.hero-title .w:nth-child(7) { animation-delay: 0.49s; }
.hero-title .w:nth-child(8) { animation-delay: 0.57s; }
@keyframes word-rise {
  to { opacity: 1; transform: none; }
}

/* Delayed rise for the rest of the hero */
.hero-rise {
  opacity: 0;
  transform: translateY(24px);
  animation: word-rise 1s var(--ease-spring) forwards;
}
.hero-rise[data-delay="2"] { animation-delay: 0.7s; }
.hero-rise[data-delay="3"] { animation-delay: 0.85s; }

.hero-sub {
  margin: 28px 0 0;
  max-width: 520px;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .hero-title .w, .hero-rise {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .hero-art svg { animation: none; }
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  padding: 76px 0 8px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  gap: 56px;
  width: max-content;
  animation: marquee 36s linear infinite;
}
.marquee-track span,
.marquee-track i {
  font-style: normal;
  font-size: clamp(56px, 9vw, 110px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--stroke);
  white-space: nowrap;
  transition: color 0.4s ease;
}
.marquee-track i { -webkit-text-stroke-color: var(--stroke-dim); }
.marquee:hover .marquee-track span { color: var(--stroke-fill); }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 980px;
  padding: 13px 26px;
  cursor: pointer;
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s ease, background 0.2s ease;
}
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}
.btn-ghost { color: var(--accent); padding: 13px 6px; }
.btn-ghost .chev { transition: transform 0.3s var(--ease-spring); display: inline-block; }
.btn-ghost:hover .chev { transform: translateX(3px); }

/* ---------- Sections shared ---------- */

.section-head {
  max-width: 1040px;
  margin: 0 auto 64px;
  text-align: left;
  padding: 0 24px;
}
.section-head .section-sub { max-width: 560px; }
.section-head h2,
.updates h2 {
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.muted { color: var(--ink-3); }
.section-sub {
  margin-top: 18px;
  font-size: 17px;
  color: var(--ink-2);
}

/* ---------- Apps directory ---------- */

.apps { padding: 90px 0 60px; }

/* Bento grid: alternating 3/5 + 2/5 spans */
.app-grid {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}
.app-card { grid-column: span 2; }
.app-card.card-wide { grid-column: span 3; }
@media (max-width: 760px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-card, .app-card.card-wide { grid-column: auto; }
}

.app-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 34px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  border: 1px solid var(--hairline);
  transition: transform 0.5s var(--ease-spring), box-shadow 0.5s ease;
}
.app-card:hover {
  transform: scale(1.02);
  box-shadow: var(--card-shadow);
  border-color: var(--stroke);
}

.app-card .app-icon {
  transition: transform 0.5s var(--ease-spring);
}
.app-card:hover .app-icon {
  transform: scale(1.07) rotate(-4deg);
}

/* Squircle-ish app icons — flat, single-hue */
.app-icon {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 22.5%;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -8px rgba(15, 23, 42, 0.35);
}
.app-icon svg { width: 40px; height: 40px; }
.icon-pactone { background: var(--icon-1); }
.icon-goyolo  { background: var(--icon-2); }
.icon-tether  { background: var(--icon-3); }
.icon-pane    { background: var(--icon-4); }

.app-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.app-meta h3 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.app-meta p {
  font-size: 15.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--pill-bg);
  border: 1px solid var(--hairline);
  padding: 4px 10px;
  border-radius: 980px;
  white-space: nowrap;
}

/* ---------- Approach ---------- */

.approach { padding: 130px 24px; }
.approach-inner { max-width: 1040px; margin: 0 auto; }

.approach-statement {
  font-size: clamp(30px, 4.2vw, 50px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 780px;
  margin-bottom: 90px;
}
.approach-statement .dim { color: var(--ink-3); }

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}
@media (max-width: 760px) {
  .principles { grid-template-columns: 1fr; gap: 40px; }
}
.principle-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  display: block;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}
.principle h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.principle p {
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* ---------- Updates ---------- */

.updates { padding: 40px 24px 150px; }
.updates-inner {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--panel-bg);
  color: #f5f5f7;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: clamp(48px, 7vw, 88px);
  text-align: center;
}
.updates p {
  margin-top: 16px;
  font-size: 17px;
  color: rgba(245, 245, 247, 0.65);
}
.signup {
  margin: 36px auto 0;
  display: flex;
  gap: 12px;
  max-width: 460px;
}
@media (max-width: 520px) { .signup { flex-direction: column; } }
.signup input {
  flex: 1;
  font: inherit;
  font-size: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 980px;
  padding: 13px 22px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.signup input::placeholder { color: rgba(245, 245, 247, 0.4); }
.signup input:focus {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.13);
}
.updates .btn-primary { background: #fff; color: #0f172a; }
.updates .btn-primary:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }

.signup-confirm {
  display: none;
  margin-top: 24px !important;
  color: #7ee2a8 !important;
  font-weight: 500;
}
.updates-inner.is-signed-up .signup { display: none; }
.updates-inner.is-signed-up .signup-confirm { display: block; }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--hairline); }
.footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-3);
}
.footer nav { display: flex; gap: 24px; }
.footer a { transition: color 0.2s ease; }
.footer a:hover { color: var(--ink); }

/* ---------- Legal pages (privacy, etc.) ---------- */

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 120px 24px 100px;
}
.legal-head { margin-bottom: 48px; }
.legal-head h1 {
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.legal-meta {
  margin-top: 16px;
  font-size: 15px;
  color: var(--ink-3);
  line-height: 1.5;
}
.legal-body {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink-2);
}
.legal-body h2 {
  margin: 40px 0 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.legal-body p + p { margin-top: 14px; }
.legal-body ul {
  margin: 12px 0 0;
  padding-left: 1.25em;
}
.legal-body li + li { margin-top: 8px; }
.legal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--pill-bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--ink);
}
