/* ==========================================================================
   Useful App Labs — site styles
   Brand: charcoal #111318, off-white #F8F9FC, periwinkle #A7B5FF
   Dark theme is the default; [data-theme="light"] switches to light.
   ========================================================================== */

:root {
  --bg: #0b0c10;
  --bg-elev: #121419;
  --bg-elev-2: #171a21;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f8f9fc;
  --text-muted: #9aa1b2;
  --text-faint: #6b7183;
  --accent: #a7b5ff;
  --accent-strong: #8c9dff;
  --accent-ink: #0b0c10;
  --glow: rgba(167, 181, 255, 0.18);
  --icon-bg: #1a1d24;
  --icon-u: #f8f9fc;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.6);

  --radius: 20px;
  --radius-sm: 12px;
  --container: 1120px;
  --gutter: 24px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f8f9fc;
  --bg-elev: #ffffff;
  --bg-elev-2: #f1f3f8;
  --border: rgba(17, 19, 24, 0.08);
  --border-strong: rgba(17, 19, 24, 0.14);
  --text: #111318;
  --text-muted: #555c6e;
  --text-faint: #8a90a0;
  --accent: #5b6fe6;
  --accent-strong: #4a5ed6;
  --accent-ink: #ffffff;
  --glow: rgba(124, 142, 255, 0.22);
  --icon-bg: #111318;
  --icon-u: #f8f9fc;
  --shadow: 0 1px 2px rgba(17, 19, 24, 0.04), 0 20px 40px -28px rgba(17, 19, 24, 0.25);

  color-scheme: light;
}

/* ---------- Font (self-hosted Inter variable, latin subset) ---------- */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { top: 12px; }

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-icon { width: 30px; height: 30px; flex: none; }
.brand-icon-bg { fill: var(--icon-bg); }
:root:not([data-theme="light"]) .brand-icon-bg { stroke: var(--border-strong); stroke-width: 3; }
.brand-icon-u { stroke: var(--icon-u); }
.brand-word {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.045em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav a:hover { color: var(--text); background: var(--bg-elev-2); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -10px var(--glow); }
.btn-primary:hover svg { transform: translateX(2px); }
.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-elev-2); }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 112px 0 56px;
  text-align: center;
}

.hero::before {
  /* faint grid */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 30%, transparent 75%);
  opacity: 0.7;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  top: -260px;
  left: 50%;
  width: 900px;
  height: 600px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}

.hero .container { position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7b5ff;
  box-shadow: 0 0 0 4px rgba(167, 181, 255, 0.18);
}

.hero h1 {
  margin: 0 auto;
  max-width: 900px;
  font-size: clamp(42px, 7.2vw, 80px);
  letter-spacing: -0.045em;
  line-height: 1.02;
}
.accent {
  background: linear-gradient(120deg, #a7b5ff 0%, #c8b6ff 60%, #a7b5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
:root[data-theme="light"] .accent {
  background-image: linear-gradient(120deg, #5b6fe6 0%, #8a5cf6 70%);
}

.lede {
  margin: 24px auto 0;
  max-width: 560px;
  font-size: clamp(17px, 2vw, 19px);
  color: var(--text-muted);
}

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

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section + .section { border-top: 1px solid var(--border); }
.hero + .section { padding-top: 48px; }

.section-head { max-width: 620px; margin-bottom: 48px; }
.kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.section h2 {
  margin-top: 12px;
  font-size: clamp(30px, 4.2vw, 44px);
}
.section-sub {
  margin-top: 14px;
  font-size: 17px;
  color: var(--text-muted);
}

/* ---------- Products ---------- */
.products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.product {
  --p: var(--accent);
  --p2: var(--accent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.product:hover {
  border-color: color-mix(in srgb, var(--p) 40%, var(--border));
  transform: translateY(-2px);
}

.product-visual {
  position: relative;
  height: 240px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--p) 22%, transparent), transparent 70%),
    var(--bg-elev-2);
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 28px;
}
.product-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.product-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--p), var(--p2));
  color: #0b0c10;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.product-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-live { color: #4ade80; border-color: rgba(74, 222, 128, 0.3); }
.status-dev { color: #fbbf24; border-color: rgba(251, 191, 36, 0.3); }
:root[data-theme="light"] .status-live { color: #15803d; }
:root[data-theme="light"] .status-dev { color: #b45309; }

.product h3 { font-size: 24px; }
.tagline { font-weight: 500; color: var(--text); }
.product-body > p:not(.tagline) { color: var(--text-muted); font-size: 15px; }

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.product-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}
.product-link:hover svg { transform: translate(2px, -2px); }
.product-link.is-muted { color: var(--text-faint); font-weight: 500; }

/* FluentLens mock */
.mock-fl {
  width: min(320px, 82%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.55);
}
.mock-video {
  position: relative;
  height: 96px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--p) 45%, #1b1e27), color-mix(in srgb, var(--p2) 35%, #11131a));
}
.mock-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -60%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}
.mock-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-left: 10px solid #111318;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}
.mock-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.25);
}
.mock-progress span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}
.mock-lines { padding: 14px 16px 16px; }
.mock-sentence { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.mock-sentence .hl {
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--p) 28%, transparent);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--p);
}
.mock-translation { margin-top: 4px; font-size: 13px; color: var(--text-muted); }

/* FitxEasy mock */
.mock-fx {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 22px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.55);
}
.mock-ring { position: relative; width: 112px; height: 112px; flex: none; }
.mock-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mock-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring-track { stroke: var(--border-strong); }
.ring-fill {
  stroke: var(--p);
  stroke-dasharray: 301.6;
  stroke-dashoffset: 90;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.ring-label strong { font-size: 19px; letter-spacing: -0.02em; }
.ring-label small { font-size: 12px; color: var(--text-muted); }
.mock-macros { display: grid; gap: 12px; width: 120px; }
.macro span { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.macro i {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--border-strong);
  position: relative;
  overflow: hidden;
}
.macro i::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--w);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--p), var(--p2));
}

/* ---------- Principles ---------- */
.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.principle {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.principle-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 20px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.principle-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.principle h3 { font-size: 19px; letter-spacing: -0.02em; }
.principle p { margin-top: 10px; color: var(--text-muted); font-size: 15px; }

/* ---------- Contact ---------- */
.contact-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 56px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(80% 140% at 100% 0%, var(--glow), transparent 60%),
    var(--bg-elev);
}
.contact-card h2 { margin-top: 12px; }

/* ---------- Legal pages ---------- */
.legal { padding: 80px 0 96px; }
.legal-inner { max-width: 720px; }
.legal h1 { margin-top: 12px; font-size: clamp(34px, 5vw, 48px); }
.legal-meta { margin-top: 12px; font-size: 14px; color: var(--text-faint); }
.legal h2 { margin: 40px 0 12px; font-size: 20px; letter-spacing: -0.02em; }
.legal p:not(.kicker):not(.legal-meta), .legal li { color: var(--text-muted); }
.legal > .container > p:not(.kicker):not(.legal-meta) { margin-top: 12px; }
.legal-meta + p { margin-top: 32px !important; }
.legal ul { margin: 0; padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.legal a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.legal code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg-elev-2);
  font-size: 0.88em;
}
.info-table {
  margin: 28px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  overflow: hidden;
}
.info-table > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 14px 20px;
}
.info-table > div + div { border-top: 1px solid var(--border); }
.info-table dt { color: var(--text-faint); font-size: 14px; }
.info-table dd { margin: 0; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 64px 0 32px;
  font-size: 14px;
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 40px;
}
.footer-about .brand { color: var(--text); }
.footer-about p { margin-top: 14px; max-width: 280px; color: var(--text-muted); }
.footer-email { display: inline-block; margin-top: 14px; color: var(--text); font-weight: 500; }
.footer-email:hover { color: var(--accent); }
.footer-heading {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li + li { margin-top: 10px; }
.footer-col a { color: var(--text-muted); transition: color 0.15s ease; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .products { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .contact-card { flex-direction: column; align-items: flex-start; padding: 40px 32px; }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-about { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .nav a { display: none; }
  .hero { padding: 72px 0 40px; }
  .hero + .section { padding-top: 40px; }
  .br-wide { display: none; }
  .section { padding: 72px 0; }
  .section-head { margin-bottom: 32px; }
  .product-visual { height: 210px; }
  .product-body { padding: 22px; }
  .mock-fx { gap: 16px; padding: 16px; }
  .mock-ring { width: 92px; height: 92px; }
  .mock-macros { width: 100px; }
  .contact-card { padding: 32px 22px; }
  .contact-card .btn-lg { width: 100%; justify-content: center; font-size: 15px; padding: 0 16px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .footer-bottom { flex-direction: column; }
  .info-table > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
