:root {
  --bg: #fffcfa;
  --bg-accent: #fffcfa;
  --ink: rgba(27, 27, 27, 0.72);
  --ink-strong: rgba(27, 27, 27, 0.82);
  --muted: rgba(27, 27, 27, 0.55);
  --accent: #c3522b;
  --card: rgba(255, 255, 255, 0.4);
  --border: rgba(27, 27, 27, 0.08);
  --shadow: rgba(27, 27, 27, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

#v3-ambient-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 48px 20px 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.top-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(0, 0, 0, 0.5);
}

.top-nav a {
  color: rgba(0, 0, 0, 0.5);
  font-weight: 700;
}

.brand {
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 14px 0 12px;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink-strong);
}

.hero-subtitle {
  margin: 0;
  font-size: 18px;
  color: var(--muted);
  max-width: 800px;
}

.hero-subtitle a {
  color: var(--accent);
  font-weight: 800;
}

.hero-top {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #fff;
}

.hero-meta {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.hero-meta span {
  background: rgba(27, 27, 27, 0.06);
  padding: 6px 10px;
  border-radius: 999px;
}

/* Sections */
.section {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 36px;
}

.section-title {
  font-size: 26px;
  margin: 0 0 10px;
  color: var(--ink-strong);
}

.section-text {
  margin: 0 0 12px;
  color: var(--muted);
  max-width: 900px;
}

/* Category Tokens */
.category-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.category-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  white-space: nowrap;
}

.category-token:hover {
  background: rgba(27, 27, 27, 0.06);
  border-color: rgba(27, 27, 27, 0.15);
  transform: translateY(-1px);
}

.category-token.active {
  background: #1b1b1b;
  color: #fff;
  border-color: #1b1b1b;
}

.category-token-count {
  font-size: 11px;
  font-weight: 800;
  background: rgba(27, 27, 27, 0.08);
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--muted);
}

.category-token.active .category-token-count {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

/* Search */
.search-bar {
  margin: 16px 0 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 15px;
  background: #fff;
  font-family: inherit;
}

.search-count {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
}

/* Flow Category Groups (index page) */
.flow-category {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.flow-category-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 16px;
  color: var(--ink-strong);
}

/* Flow Card Grid */
.flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.flow-card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 26px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flow-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(27, 27, 27, 0.12);
}

/* Multi-phone preview for flow cards */
.flow-card-phones {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(165deg, #f5f0eb 0%, #ece4db 60%, #e0d5c9 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  position: relative;
  padding: 16px 8px 0;
}

.flow-phone {
  flex-shrink: 0;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(27, 27, 27, 0.1);
  border-bottom: none;
  box-shadow: 0 -2px 12px rgba(27, 27, 27, 0.08);
  position: relative;
}

.flow-phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* 3 phones layout */
.flow-phone-left {
  width: 72px;
  height: 120px;
  z-index: 1;
  transform: translateX(10px) rotate(-3deg);
  transform-origin: bottom center;
}

.flow-phone-center {
  width: 84px;
  height: 140px;
  z-index: 3;
  position: relative;
}

.flow-phone-right {
  width: 72px;
  height: 120px;
  z-index: 1;
  transform: translateX(-10px) rotate(3deg);
  transform-origin: bottom center;
}

/* 2 phones layout */
.phones-two {
  gap: 6px;
}
.phones-two .flow-phone-left,
.phones-two .flow-phone-right {
  width: 80px;
  height: 130px;
  transform: none;
}

/* 1 phone layout */
.phones-one {
  justify-content: center;
}
.flow-phone-solo {
  width: 90px;
  height: 148px;
  border-radius: 8px 8px 0 0;
}

/* Empty placeholder */
.phones-empty {
  background: linear-gradient(165deg, #f5f0eb 0%, #ece4db 60%, #e0d5c9 100%);
}

.flow-card-thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(27, 27, 27, 0.06);
  background: #f5f0eb;
}

.flow-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flow-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-card-company {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.flow-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-strong);
  line-height: 1.3;
}

.flow-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.flow-card-steps {
  background: rgba(27, 27, 27, 0.06);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
}

/* Flow Steps (detail page) */
.flow-steps-strip {
  position: relative;
  overflow-x: auto;
  padding: 10px 0 16px;
  -webkit-overflow-scrolling: touch;
}

.flow-steps-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  align-items: flex-start;
  padding: 4px 8px;
}

.flow-step {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 160px;
}

.flow-step-screen {
  width: 160px;
  height: 284px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 24px var(--shadow);
}

.flow-step-screen img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fffcfa;
}

.flow-step-number {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(27, 27, 27, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.flow-step-arrow {
  position: absolute;
  top: 50%;
  right: -14px;
  transform: translateY(-50%);
  color: rgba(27, 27, 27, 0.2);
  font-size: 18px;
  z-index: 3;
  pointer-events: none;
}

.flow-step-desc {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
  max-width: 160px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Locked step CTA */
.screen-locked {
  width: 160px;
  height: 284px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(27, 27, 27, 0.08);
  background: linear-gradient(165deg, #f5f0eb 0%, #ece4db 40%, #e0d5c9 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.screen-locked:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(27, 27, 27, 0.12);
}

.screen-locked-text {
  font-size: 12px;
  font-weight: 700;
  color: rgba(27, 27, 27, 0.55);
  text-align: center;
  line-height: 1.4;
}

.screen-locked-btn {
  background: #1b1b1b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Related flows grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Sticky download */
.sticky-download {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1b1b1b;
  color: #fff;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sticky-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.sticky-download svg {
  flex-shrink: 0;
}

/* CTA */
.cta {
  margin: 50px auto 70px;
  max-width: 900px;
  padding: 28px 28px 32px;
  border-radius: 20px;
  background: #1b1b1b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cta h3 {
  margin: 0;
  font-size: 24px;
}

.cta p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.7);
}

.cta a {
  background: #fff;
  color: #1b1b1b;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 800;
}

/* Footer */
.footer {
  padding: 30px 20px 50px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Meta list (detail page) */
.meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: rgba(27, 27, 27, 0.6);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(27, 27, 27, 0.06);
  border-radius: 16px;
  padding: 14px 18px;
}

.meta-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  column-gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(27, 27, 27, 0.05);
  justify-items: start;
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-row span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: rgba(27, 27, 27, 0.45);
  background: rgba(27, 27, 27, 0.08);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  justify-self: start;
}

.meta-row strong {
  text-align: left;
  font-weight: 600;
  color: rgba(27, 27, 27, 0.7);
  word-break: break-word;
  justify-self: start;
}

/* Responsive */
@media (max-width: 720px) {
  .hero-title {
    font-size: 32px;
  }

  .hero-top {
    align-items: flex-start;
  }

  .cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .flow-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .flow-card-phones {
    height: 140px;
    padding: 12px 6px 0;
  }

  .flow-phone-left,
  .flow-phone-right {
    width: 56px;
    height: 96px;
  }

  .flow-phone-center {
    width: 66px;
    height: 110px;
  }

  .category-tokens {
    gap: 6px;
  }

  .category-token {
    padding: 6px 10px;
    font-size: 12px;
  }

  .flow-step {
    width: 130px;
  }

  .flow-step-screen,
  .screen-locked {
    width: 130px;
    height: 230px;
  }
}
