/* ==========================================================================
   FunTech Factory — styles
   Palette sampled from the logo:
     cyan #16E9FF · sky #0CAFFE · blue #015EFB / #024BFD
     indigo #4B3CFC · violet #B24FFD · spark yellow #FDBA0D · navy #0C1939
   ========================================================================== */

:root {
  --cyan: #16e9ff;
  --sky: #0caffe;
  --blue: #015efb;
  --blue-deep: #024bfd;
  --indigo: #4b3cfc;
  --violet: #b24ffd;
  --yellow: #fdba0d;
  --navy: #0c1939;

  --grad-brand: linear-gradient(135deg, var(--cyan) 0%, var(--sky) 40%, var(--blue-deep) 100%);
  --grad-factory: linear-gradient(135deg, var(--indigo) 0%, var(--violet) 100%);
  --grad-line: linear-gradient(90deg, #2288fe 0%, #b235fc 100%);
  --grad-text: linear-gradient(90deg, var(--blue) 0%, var(--sky) 100%);

  --bg: #fefcfb;
  --bg-soft: #f3f6ff;
  --surface: #ffffff;
  --text: #0c1939;
  --muted: #4a5577;
  --border: rgba(12, 25, 57, 0.1);
  --shadow: 0 1px 2px rgba(12, 25, 57, 0.06), 0 8px 24px rgba(12, 25, 57, 0.08);
  --shadow-lg: 0 20px 50px rgba(2, 75, 253, 0.18);
  --focus: #015efb;
  --code-bg: #0c1939;
  --code-text: #eaf1ff;

  --radius: 18px;
  --radius-sm: 12px;
  --max: 1160px;
  --font-display: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070d22;
    --bg-soft: #0b1430;
    --surface: #0f1936;
    --text: #eaf1ff;
    --muted: #9aa7c7;
    --border: rgba(234, 241, 255, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(12, 175, 254, 0.18);
    --focus: #16e9ff;
    --code-bg: #050a1a;
    --grad-text: linear-gradient(90deg, var(--sky) 0%, var(--cyan) 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070d22;
  --bg-soft: #0b1430;
  --surface: #0f1936;
  --text: #eaf1ff;
  --muted: #9aa7c7;
  --border: rgba(234, 241, 255, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(12, 175, 254, 0.18);
  --focus: #16e9ff;
  --code-bg: #050a1a;
  --grad-text: linear-gradient(90deg, var(--sky) 0%, var(--cyan) 100%);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:where(:root[data-theme="dark"]) a { color: var(--sky); }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) a { color: var(--sky); } }
a:hover { text-decoration-color: var(--violet); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 900; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }

.text-gradient {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.brand img { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 900; font-size: 1.35rem; letter-spacing: -0.01em; }
.brand-name .tech { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { display: flex; align-items: center; gap: 6px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.42em; margin-top: 4px; color: var(--text); }
.brand-sub::before, .brand-sub::after { content: ""; width: 12px; height: 3px; border-radius: 3px; background: var(--grad-line); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.97rem;
  padding: 8px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--bg-soft); }
.nav a[aria-current="page"] { background: var(--grad-brand); color: #fff; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--sky); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 16px 18px; background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow); display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px 14px; border-radius: 12px; }
}

/* ---------- Buttons / chips / badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  padding: 14px 22px; border-radius: 999px; border: 2px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad-brand); color: #fff !important; box-shadow: 0 8px 20px rgba(2, 75, 253, .28); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(2, 75, 253, .36); }
.btn-secondary { background: var(--grad-factory); color: #fff !important; box-shadow: 0 8px 20px rgba(75, 60, 252, .25); }
.btn-ghost { background: var(--surface); color: var(--text) !important; border-color: var(--border); }
.btn-ghost:hover { border-color: var(--sky); }
.btn-sm { padding: 9px 14px; font-size: 0.9rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 0.9rem/1 var(--font-body); cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--sky); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--grad-factory); color: #fff; border-color: transparent; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: .02em; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--border);
}
.badge-cat { background: color-mix(in srgb, var(--sky) 14%, transparent); color: var(--blue); border-color: transparent; text-decoration: none; }
.badge-released { background: color-mix(in srgb, #16c784 16%, transparent); color: #0b8a5a; border-color: transparent; }
.badge-beta { background: color-mix(in srgb, var(--yellow) 22%, transparent); color: #9a6a00; border-color: transparent; }
.badge-dev { background: color-mix(in srgb, var(--violet) 16%, transparent); color: #7b2fd0; border-color: transparent; }
.badge-sample { background: transparent; border-style: dashed; }
:root[data-theme="dark"] .badge-cat { color: var(--sky); }
:root[data-theme="dark"] .badge-released { color: #4be3a6; }
:root[data-theme="dark"] .badge-beta { color: var(--yellow); }
:root[data-theme="dark"] .badge-dev { color: #d49bff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-cat { color: var(--sky); }
  :root:not([data-theme="light"]) .badge-released { color: #4be3a6; }
  :root:not([data-theme="light"]) .badge-beta { color: var(--yellow); }
  :root:not([data-theme="light"]) .badge-dev { color: #d49bff; }
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.section-head h2 { margin: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font-size: 0.8rem; font-weight: 800;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px;
}
.eyebrow::before, .eyebrow::after { content: ""; width: 22px; height: 4px; border-radius: 4px; background: var(--grad-line); }

.page-hero { padding: 64px 0 40px; position: relative; overflow: hidden; }
.page-hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 62ch; }

/* ---------- Home hero ---------- */
.hero { position: relative; padding: 72px 0 88px; overflow: hidden; }
.hero::before, .hero::after, .page-hero::before {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; z-index: -1;
}
.hero::before, .page-hero::before { width: 520px; height: 520px; background: var(--cyan); top: -180px; right: -120px; }
.hero::after { width: 420px; height: 420px; background: var(--violet); bottom: -200px; left: -140px; opacity: .22; }
.hero-grid { display: grid; gap: 48px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; } }
.hero h1 { margin-bottom: 18px; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 54ch; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 36px; }
.hero-stats strong { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; }
.hero-stats span { color: var(--muted); font-size: 0.9rem; }
.hero-art { position: relative; justify-self: center; width: min(420px, 100%); }
.hero-art .logo-card {
  background: #fefcfb; border-radius: 32px; padding: 18px; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(12, 25, 57, .06); transform: rotate(-2deg);
  animation: float 6s ease-in-out infinite;
}
.hero-art .logo-card img { border-radius: 22px; }
.spark { position: absolute; width: 14px; height: 44px; border-radius: 14px; background: var(--yellow); box-shadow: 0 6px 16px rgba(253, 186, 13, .4); }
.spark-1 { top: -14px; right: 60px; transform: rotate(35deg); }
.spark-2 { top: 30px; right: -12px; transform: rotate(70deg); }
@keyframes float { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .hero-art .logo-card { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Grids / cards ---------- */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--sky) 45%, transparent); }
.card h3 { margin: 10px 0 8px; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card p { color: var(--muted); margin-bottom: 16px; }
.card .meta { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--muted); font-size: 0.88rem; }
.card .badge, .card .card-links a { position: relative; z-index: 1; }

.feature { padding: 28px; }
.feature .feature-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; margin-bottom: 14px;
}
.feature .feature-icon svg { width: 26px; height: 26px; }
.fi-blue { background: var(--grad-brand); box-shadow: 0 8px 18px rgba(2, 75, 253, .3); }
.fi-violet { background: var(--grad-factory); box-shadow: 0 8px 18px rgba(75, 60, 252, .3); }
.fi-yellow { background: linear-gradient(135deg, #ffd45a, var(--yellow)); color: var(--navy) !important; box-shadow: 0 8px 18px rgba(253, 186, 13, .35); }
.feature:hover { transform: none; }

/* ---------- App cards ---------- */
.app-card .app-head { display: flex; gap: 16px; align-items: center; }
.app-icon {
  flex: none; width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; overflow: hidden;
  font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; color: #fff; background: var(--grad-brand);
  box-shadow: 0 6px 14px rgba(2, 75, 253, .25);
}
.app-icon.alt { background: var(--grad-factory); box-shadow: 0 6px 14px rgba(75, 60, 252, .25); }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card h3 { margin: 0 0 4px; }
.app-card .tagline { margin: 0; color: var(--muted); font-size: 0.95rem; }
.app-card .desc { margin: 16px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.toolbar {
  display: grid; gap: 14px; margin-bottom: 28px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
@media (min-width: 760px) { .toolbar { grid-template-columns: 1fr auto auto; align-items: center; } }
.toolbar .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.92rem; }
input[type="search"], input[type="text"], input[type="email"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky) 22%, transparent); }
textarea { min-height: 160px; resize: vertical; }
.result-count { color: var(--muted); font-size: 0.95rem; margin: -10px 0 20px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 2px dashed var(--border); border-radius: var(--radius); }

/* ---------- App detail ---------- */
.app-detail-head { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; margin-bottom: 28px; }
.app-detail-head .app-icon { width: 96px; height: 96px; border-radius: 26px; font-size: 2.2rem; }
.app-detail-head h1 { margin: 0 0 6px; }
.detail-grid { display: grid; gap: 28px; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 1fr 320px; } }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.facts li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.facts li span:first-child { color: var(--muted); }
.shots { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-top: 20px; }
.shots img { border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ---------- Blog / article ---------- */
.post-card .thumb {
  height: 8px; border-radius: 8px; margin: -4px 0 12px; background: var(--grad-line);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }

.article { max-width: 760px; margin: 0 auto; }
.article-header { margin-bottom: 28px; }
.article-header .meta { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; color: var(--muted); font-size: 0.95rem; }
.prose h2 { font-size: 1.7rem; margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.35em; }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-soft); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
.prose pre {
  background: var(--code-bg); color: var(--code-text); padding: 18px 20px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 0.9rem; line-height: 1.55; border: 1px solid rgba(255, 255, 255, .06); margin: 0 0 1.4em;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose th { font-family: var(--font-display); }
.callout {
  border-left: 5px solid var(--yellow); background: color-mix(in srgb, var(--yellow) 10%, var(--surface));
  padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1.4em;
}
.author-box { display: flex; gap: 16px; align-items: center; margin-top: 48px; padding: 20px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--border); }
.author-box img { width: 56px; height: 56px; border-radius: 16px; }
.author-box p { margin: 0; }

/* ---------- CTA ---------- */
.cta {
  position: relative; overflow: hidden; border-radius: 28px; padding: 48px 28px; color: #fff; text-align: center;
  background: linear-gradient(120deg, var(--blue-deep) 0%, var(--indigo) 55%, var(--violet) 100%);
  box-shadow: var(--shadow-lg);
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255, 255, 255, .85); max-width: 56ch; margin: 0 auto 24px; }
.cta .btn-ghost { background: #fff; color: var(--navy) !important; }
.cta::after { content: ""; position: absolute; width: 18px; height: 60px; border-radius: 18px; background: var(--yellow); top: 24px; right: 40px; transform: rotate(35deg); opacity: .9; }

/* ---------- About / contact ---------- */
.two-col { display: grid; gap: 36px; align-items: start; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.contact-list a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; }
.contact-list a:hover { border-color: var(--sky); }
.contact-list svg { width: 22px; height: 22px; color: var(--blue); flex: none; }
.form { display: grid; gap: 16px; }
.form-note { font-size: 0.88rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; padding: 48px 0 28px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { font-size: 1rem; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover, .site-footer .brand { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.footer-line { height: 4px; width: 60px; border-radius: 4px; background: var(--grad-line); margin: 14px 0; }

/* Cookie consent banner (injected by analytics.js) */
.consent-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; max-width: 560px; margin: 0 auto; padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.consent-banner p { margin: 0; flex: 1 1 260px; font-size: 0.92rem; }
.consent-actions { display: flex; gap: 8px; margin-left: auto; }
