:root {
  color-scheme: light dark;
  --bg: #f7f7fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --fg: #1a1a24;
  --muted: #6b6b7b;
  --border: #e3e0ef;
  --accent: #6d5efc;
  --accent-fg: #ffffff;
  --chip: #f0effb;
  --header-bg: rgba(247, 247, 251, 0.88);
  --card-glow: rgba(109, 94, 252, 0.14);
  --shadow: 0 2px 6px rgba(20, 20, 40, 0.05), 0 16px 40px rgba(45, 35, 120, 0.09);
  --shadow-hover: 0 4px 10px rgba(20, 20, 40, 0.06), 0 22px 52px rgba(109, 94, 252, 0.2);
  --featured-start: #382047;
  --featured-end: #201d43;
  --featured-border: rgba(236, 130, 190, 0.58);
  --featured-muted: rgba(255, 255, 255, 0.76);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f16;
    --panel: rgba(23, 23, 31, 0.92);
    --panel-solid: #17171f;
    --fg: #ececf2;
    --muted: #9797a8;
    --border: #2b2937;
    --accent: #8b7dff;
    --accent-fg: #ffffff;
    --chip: #1d1d28;
    --header-bg: rgba(15, 15, 22, 0.88);
    --card-glow: rgba(139, 125, 255, 0.2);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.34), 0 16px 42px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.4), 0 24px 58px rgba(92, 72, 210, 0.24);
    --featured-start: #3d214b;
    --featured-end: #1d1a3c;
    --featured-border: rgba(236, 130, 190, 0.5);
    --featured-muted: rgba(255, 255, 255, 0.7);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: transparent;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Yu Gothic UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

img { max-width: 100%; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.logo-accent {
  background: linear-gradient(100deg, #8b7dff, #e26fae);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--fg);
  background: var(--chip);
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 52px 0 48px;
  text-align: center;
}

.hero .brand {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  background: linear-gradient(100deg, #8b7dff 0%, #e26fae 28%, #ffffff 42%, #f2b705 56%, #8b7dff 84%);
  background-size: 250% 100%;
  background-clip: text;
  color: transparent;
  font-size: clamp(2.8rem, 9vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .tagline {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== Sections ===== */
.section { margin-top: 46px; }

.section h2 {
  margin: 0 0 4px;
  font-size: 1.38rem;
  letter-spacing: -0.02em;
}

.section .lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ===== Bento product grid ===== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(168px, auto);
  gap: 14px;
  perspective: 1000px;
}

.web-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px);
  gap: 14px;
  perspective: 1000px;
}

.app-card {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 168px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 42px 18px 18px;
  border: 1px solid transparent;
  border-radius: 20px;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(140deg, rgba(139, 125, 255, 0.5), rgba(226, 111, 174, 0.3)) border-box;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out, box-shadow 0.22s ease, background 0.22s ease;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: auto -30% -58% 18%;
  z-index: -1;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-glow), transparent 68%);
  pointer-events: none;
}

a.app-card::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: 16px;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

a.app-card:hover::after {
  opacity: 0.72;
  transform: translateY(-50%);
}

.app-card:hover {
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(140deg, rgba(139, 125, 255, 0.98), rgba(226, 111, 174, 0.68)) border-box;
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.app-card:focus-visible,
.btn:focus-visible,
.site-nav a:focus-visible,
.logo:focus-visible {
  outline: 3px solid var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 3px;
}

.app-card-wide {
  grid-column: span 2;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding-right: 48px;
}

.app-card-featured {
  grid-row: span 2;
  min-height: 350px;
  padding: 24px;
  border-color: transparent;
  background:
    linear-gradient(145deg, var(--featured-start), var(--featured-end)) padding-box,
    linear-gradient(140deg, rgba(139, 125, 255, 0.9), var(--featured-border)) border-box;
  color: #ffffff;
  box-shadow: 0 22px 64px rgba(50, 29, 105, 0.25);
}

.app-card-featured::before {
  inset: -18% -30% auto 16%;
  height: 78%;
  background: radial-gradient(circle, rgba(236, 99, 174, 0.28), transparent 68%);
}

.app-card-featured:hover {
  background:
    linear-gradient(145deg, var(--featured-start), var(--featured-end)) padding-box,
    linear-gradient(140deg, rgba(139, 125, 255, 1), rgba(236, 130, 190, 0.9)) border-box;
}

.featured-label {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-card .icon {
  flex: 0 0 auto;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: transform;
}

.product-icon {
  width: 60px;
  height: 60px;
  overflow: hidden;
  display: block;
  border-radius: 16px;
  background: var(--chip);
  box-shadow: 0 8px 20px rgba(20, 20, 40, 0.2);
}

.product-icon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.product-icon-featured {
  width: 92px;
  height: 92px;
  border-radius: 23px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.tool-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  box-shadow: 0 8px 20px rgba(20, 20, 40, 0.18);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-card .meta { min-width: 0; }

.app-card .name {
  display: block;
  margin: 0 0 3px;
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.app-card .desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.app-card-featured .meta { margin-top: auto; }

.app-card-featured .name {
  font-size: clamp(1.65rem, 4vw, 2.2rem);
  letter-spacing: -0.035em;
}

.app-card-featured .desc {
  max-width: 25rem;
  color: var(--featured-muted);
  font-size: 0.96rem;
}

.featured-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.app-card-featured .btn {
  padding: 9px 13px;
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-size: 0.78rem;
}

.app-card-featured .btn.primary {
  background: #8b7dff;
  border-color: transparent;
}

.app-card.soon {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.badge-soon {
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.68rem;
  vertical-align: middle;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.btn:hover { border-color: var(--accent); }

.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-fg);
}

/* ===== Shared app detail pages ===== */
.breadcrumb {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.app-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 8px;
}

.app-hero .icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--chip);
  box-shadow: 0 10px 26px rgba(20, 20, 40, 0.16);
  font-size: 2.6rem;
  object-fit: cover;
}

.app-hero h1 {
  margin: 0 0 2px;
  font-size: 1.7rem;
}

.app-hero .sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 8px;
}

.app-showcase {
  display: grid;
  gap: 28px;
  margin-top: 8px;
}

.shot-frame {
  width: min(280px, 82%);
  margin: 10px auto 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 44px;
  background: #14141c;
  box-shadow: 0 2px 6px rgba(20, 20, 40, 0.08), 0 20px 48px rgba(45, 35, 120, 0.16);
}

.shot-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 34px;
}

/* ===== Tributary conversion page ===== */
.tributary-hero {
  display: grid;
  gap: 34px;
  align-items: start;
  padding: 12px 0 28px;
}

.tributary-copy {
  align-self: center;
}

.tributary-copy .app-hero {
  align-items: flex-start;
  margin-bottom: 22px;
}

.product-kicker {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tributary-copy .app-hero h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: -0.04em;
}

.tributary-promise {
  max-width: 35rem;
  margin: 0;
  font-size: clamp(1.08rem, 2.5vw, 1.32rem);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.65;
}

.tributary-copy .app-links { margin-top: 24px; }

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.feature-chips li {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.78rem;
}

.tributary-shot {
  width: min(300px, 78vw);
  margin-top: 0;
}

.tributary-about {
  max-width: 700px;
  margin-top: 22px;
}

.conversion-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 30px 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--chip);
}

.conversion-panel p {
  margin: 0;
  font-weight: 650;
}

/* ===== Prose ===== */
.content h2 {
  margin: 30px 0 10px;
  font-size: 1.2rem;
}

.content h3 {
  margin: 20px 0 6px;
  font-size: 1.02rem;
}

.content p,
.content li { font-size: 0.95rem; }

.content ul { padding-left: 1.2em; }

.updated {
  color: var(--muted);
  font-size: 0.82rem;
}

.note {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--chip);
  color: var(--fg);
  font-size: 0.9rem;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.footer-nav { margin-bottom: 8px; }

.footer-nav a {
  margin: 0 10px;
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--fg);
  text-decoration: underline;
}

/* ===== Motion and ambient background ===== */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.34;
  will-change: transform;
}

.blob.b1 {
  top: -8vmax;
  left: -6vmax;
  width: 40vmax;
  max-width: 440px;
  height: 40vmax;
  max-height: 440px;
  background: #8b7dff;
  animation: drift1 20s ease-in-out infinite;
}

.blob.b2 {
  top: 22%;
  right: -8vmax;
  width: 34vmax;
  max-width: 380px;
  height: 34vmax;
  max-height: 380px;
  background: #e26fae;
  animation: drift2 24s ease-in-out infinite;
}

.blob.b3 {
  bottom: -10vmax;
  left: 26%;
  width: 32vmax;
  max-width: 360px;
  height: 32vmax;
  max-height: 360px;
  background: #f2b705;
  animation: drift3 28s ease-in-out infinite;
}

@media (prefers-color-scheme: dark) {
  .blob { opacity: 0.22; }
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vmax, 6vmax) scale(1.1); }
}

@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vmax, 4vmax) scale(1.08); }
}

@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3vmax, -4vmax) scale(1.12); }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .brand { animation: shimmer 6.5s linear infinite; }
}

@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -130% 0; }
}

.tw-caret::after {
  content: "|";
  margin-left: 1px;
  color: var(--accent);
  font-weight: 400;
  animation: caretBlink 1s step-end infinite;
}

@keyframes caretBlink { 50% { opacity: 0; } }

/* Motion is enabled by site.js only after a reveal failsafe is scheduled. */
.motion-ready .app-card,
.motion-ready .app-hero,
.motion-ready .app-links,
.motion-ready .content > h2,
.motion-ready .reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal-failsafe 0s linear 2.2s forwards;
}

.motion-ready .app-card.in,
.motion-ready .app-hero.in,
.motion-ready .app-links.in,
.motion-ready .content > h2.in,
.motion-ready .reveal.in {
  opacity: 1;
  transform: none;
  animation: none;
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes reveal-failsafe {
  to {
    opacity: 1;
    transform: none;
  }
}

.card-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.5), transparent 55%);
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.app-card:hover .icon { transform: scale(1.08) rotate(-3deg); }

@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.32s; }

.app-hero .icon { view-transition-name: vt-hero-icon; }
.app-hero h1 { view-transition-name: vt-hero-title; }

.cursor-spot {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: radial-gradient(240px circle at var(--cx, -200px) var(--cy, -200px), rgba(139, 125, 255, 0.16), transparent 62%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.btn,
.site-nav a,
.logo { transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* ===== Responsive layout ===== */
@media (min-width: 760px) {
  .app-showcase {
    grid-template-columns: 1fr 280px;
    column-gap: 44px;
    align-items: start;
  }

  .tributary-hero {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 54px;
  }
}

@media (max-width: 759px) {
  .bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .app-card-featured {
    grid-column: span 2;
    grid-row: auto;
    min-height: 290px;
  }

  .app-card-wide { grid-column: span 2; }

  .tributary-shot { order: 2; }
}

@media (max-width: 519px) {
  .header-inner { padding: 10px 14px; }

  .site-nav { gap: 2px; }

  .site-nav a {
    padding: 6px 7px;
    font-size: 0.82rem;
  }

  .wrap { padding: 28px 18px 64px; }

  .hero { padding: 38px 0 42px; }

  .bento-grid { grid-template-columns: minmax(0, 1fr); }

  .app-card-featured,
  .app-card-wide {
    grid-column: auto;
    grid-row: auto;
  }

  .app-card-featured { min-height: 330px; }

  .app-card-wide {
    flex-direction: column;
    align-items: flex-start;
  }

  .web-grid { grid-template-columns: minmax(0, 1fr); }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .blob,
  .hero .brand,
  .tw-caret::after { animation: none; }

  .hero-particles,
  .cursor-spot { display: none; }

  .motion-ready .app-card,
  .motion-ready .app-hero,
  .motion-ready .app-links,
  .motion-ready .content > h2,
  .motion-ready .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .app-card,
  .app-card:hover,
  .app-card .icon,
  .app-card:hover .icon,
  .btn,
  .site-nav a,
  .logo {
    transform: none !important;
    transition: none;
  }

  .app-hero .icon,
  .app-hero h1 { view-transition-name: none; }

  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
