/* Alfcode — App Showcase (rebranded from Pidwire)
   Theme-aware: dark tokens align to the main site (assets/alfcode.css), and a
   [data-theme="light"] block flips every token + restyles the page chrome.
   The shared `alf-theme` localStorage key is honoured by the head bootstrap. */

:root {
  /* Dark surfaces — aligned to alfcode.css (deep navy-black) */
  --bg: #080a11;
  --bg-elev: #0d1019;
  --bg-elev-2: #121622;
  --line: rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.16);
  --ink: #f4f6f9;
  --ink-dim: rgba(244,246,249,0.66);
  --ink-mute: rgba(244,246,249,0.42);
  --accent: #e6c552;          /* Alfcode gold */
  --accent-deep: #c8a838;      /* darker gold for text on tinted fills */
  --accent-hot: #5b8cf0;       /* Alfcode blue */
  --accent-glow: 230, 197, 82;
  --grid: rgba(255,255,255,0.04);

  /* Floating glass-pill nav scrims (match alfcode.css) */
  --scrim: rgba(5, 5, 6, 0.72);
  --scrim-solid: rgba(7, 7, 9, 0.96);

  /* Chrome surfaces used in light overrides (default to dark translucency) */
  --glass-fill-a: rgba(255,255,255,0.04);
  --glass-fill-b: rgba(255,255,255,0.01);
  --glass-sheen: rgba(255,255,255,0.08);
  --surface-soft: rgba(255,255,255,0.04);
  --surface-softer: rgba(255,255,255,0.025);
  --scrollbar-thumb: rgba(255,255,255,0.1);
  --scrollbar-thumb-hover: rgba(255,255,255,0.2);
  --cursor-ring: rgba(255,255,255,0.5);
  --selection-fg: var(--bg);

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, sans-serif;
  --display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', ui-monospace, monospace;
}

/* ─────────────────────────────────────────────────────────────────────────
   LIGHT THEME — derived from alfcode.css's light palette.
   Warm off-white background, dark navy ink, gold + blue accents, light lines.
   Overrides every apps token plus the chrome-surface helpers above so the
   showcase reads as a real, legible light theme (not white-on-white).
   ───────────────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f7f6f1;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0efe8;
  --line: rgba(18, 33, 66, 0.10);
  --line-strong: rgba(18, 33, 66, 0.20);
  --ink: #122142;
  --ink-dim: #3c4658;
  --ink-mute: #6b7280;
  --accent: #d8b441;          /* Alfcode gold (light) */
  --accent-deep: #b0892c;      /* darker gold for text on tinted fills */
  --accent-hot: #214c9e;       /* Alfcode blue (light) */
  --accent-glow: 216, 180, 65;
  --grid: rgba(18, 33, 66, 0.06);

  --scrim: rgba(247, 246, 241, 0.80);
  --scrim-solid: rgba(250, 249, 245, 0.97);

  /* Light glass + surfaces: tinted off-white with dark hairline borders */
  --glass-fill-a: rgba(255, 255, 255, 0.66);
  --glass-fill-b: rgba(255, 255, 255, 0.30);
  --glass-sheen: rgba(255, 255, 255, 0.65);
  --surface-soft: rgba(18, 33, 66, 0.04);
  --surface-softer: rgba(18, 33, 66, 0.05);
  --scrollbar-thumb: rgba(18, 33, 66, 0.18);
  --scrollbar-thumb-hover: rgba(18, 33, 66, 0.32);
  --cursor-ring: rgba(18, 33, 66, 0.45);
  --selection-fg: #f7f6f1;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
body { cursor: none; }
@media (hover: none) { body { cursor: auto; } .os-cursor { display: none !important; } }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: none; }

/* — Custom cursor — */
.os-cursor {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  mix-blend-mode: difference;
  transform: translate(-50%, -50%);
  transition: width .25s cubic-bezier(.2,.8,.2,1), height .25s cubic-bezier(.2,.8,.2,1), background .2s, opacity .2s;
}
.os-cursor.hover { width: 56px; height: 56px; background: var(--accent-hot); }
.os-cursor.text { width: 4px; height: 28px; border-radius: 2px; }
.os-cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9998;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--cursor-ring);
  transform: translate(-50%, -50%);
  transition: opacity .2s;
}

/* — Spotlight (large radial) — */
.os-spotlight {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(var(--accent-glow), 0.10), transparent 70%);
  transition: opacity .4s;
}
/* Softer, cooler spotlight so it doesn't muddy the warm off-white. */
[data-theme="light"] .os-spotlight {
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(var(--accent-glow), 0.14), transparent 70%);
}

/* — Grid overlay — */
.os-grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* — Noise — */
.os-noise::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  opacity: .035; mix-blend-mode: overlay; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* — Layout — */
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 32px; position: relative; }
section { position: relative; padding: 120px 0; }

/* — Type — */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-dim);
}
.eyebrow::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.h-display {
  font-family: var(--display); font-weight: 500; letter-spacing: -0.04em; line-height: 0.92;
  font-size: clamp(56px, 9vw, 144px);
}
.h-display em {
  font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.02em;
  color: var(--accent);
}
.h-section {
  font-family: var(--display); font-weight: 500; letter-spacing: -0.03em; line-height: 1;
  font-size: clamp(44px, 6vw, 88px);
}
.h-section em {
  font-family: var(--serif); font-style: italic; font-weight: 400;
}
.lead { font-size: 18px; line-height: 1.5; color: var(--ink-dim); max-width: 56ch; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }

/* — Surfaces — */
.glass {
  background: linear-gradient(180deg, var(--glass-fill-a), var(--glass-fill-b));
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  position: relative;
  overflow: hidden;
}
.glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, var(--glass-sheen), transparent 30%);
  mask: linear-gradient(black,black) content-box, linear-gradient(black,black);
  mask-composite: exclude;
  padding: 1px;
}
/* Light glass: a readable border + soft drop shadow lift the card off the
   warm background so it doesn't read as white-on-white. */
[data-theme="light"] .glass {
  border-color: var(--line-strong);
  box-shadow: 0 18px 50px -28px rgba(18, 33, 66, 0.30),
              0 2px 8px -4px rgba(18, 33, 66, 0.12);
}

/* — Buttons — */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: -0.01em;
  background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink);
  position: relative; overflow: hidden;
  transition: transform .15s ease, background .2s;
  will-change: transform;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-soft); border-color: var(--ink); }
.btn .arrow { transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.btn:hover .arrow { transform: translateX(4px); }

/* — Reveal — */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s, transform .9s; transition-timing-function: cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal-stagger > * { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--d, 0s), transform .6s var(--d, 0s); transition-timing-function: cubic-bezier(.2,.8,.2,1); }
.reveal-stagger.in > * { opacity: 1; transform: none; }

/* — Marquee — */
.marquee { overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent); }
.marquee-track { display: inline-flex; gap: 64px; animation: scroll 40s linear infinite; align-items: center; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* — Tag chip — */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--surface-soft); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim);
}
.chip.accent { color: var(--accent); border-color: rgba(var(--accent-glow),0.35); background: rgba(var(--accent-glow),0.10); }
[data-theme="light"] .chip.accent { color: var(--accent-deep, #b0892c); }

/* — Util — */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* — Scrollbar — */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* — Selection — */
::selection { background: var(--accent); color: var(--selection-fg); }

/* ─────────────────────────────────────────────────────────────────────────
   FLOATING GLASS-PILL NAV — replicates the homepage .nav / .nav-inner so the
   /apps nav matches the rest of the site. The markup is rendered by TopNav in
   app-main.jsx; these classes mirror assets/alfcode.css using the apps tokens.
   ───────────────────────────────────────────────────────────────────────── */
.alf-nav {
  position: fixed;
  top: 14px; left: 0; right: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.alf-nav-inner {
  pointer-events: auto;
  max-width: calc(100% - 48px);
  height: 56px;
  padding: 0 10px 0 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 32px);
  background: var(--scrim);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 12px 40px -18px rgba(0, 0, 0, 0.55);
  transition: background .3s cubic-bezier(.16,1,.3,1), box-shadow .3s, border-color .3s;
}
.alf-nav.scrolled .alf-nav-inner {
  background: var(--scrim-solid);
  border-color: var(--line-strong);
  box-shadow: 0 16px 50px -18px rgba(0, 0, 0, 0.65);
}
[data-theme="light"] .alf-nav-inner {
  box-shadow: 0 12px 40px -18px rgba(18, 33, 66, 0.22);
}
[data-theme="light"] .alf-nav.scrolled .alf-nav-inner {
  box-shadow: 0 16px 50px -18px rgba(18, 33, 66, 0.30);
}

.alf-brand { display: flex; align-items: center; }
.alf-brand-logo { height: 24px; width: auto; display: block; }
.alf-brand-logo.logo-light { display: none; }
[data-theme="light"] .alf-brand-logo.logo-dark { display: none; }
[data-theme="light"] .alf-brand-logo.logo-light { display: block; }

.alf-nav-links { display: none; align-items: center; gap: clamp(16px, 1.8vw, 26px); }
.alf-nav-links a {
  font-size: 14px;
  color: var(--ink-mute);
  font-weight: 450;
  letter-spacing: -0.01em;
  position: relative;
  transition: color .2s;
}
.alf-nav-links a:hover { color: var(--ink); }
.alf-nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .42s cubic-bezier(.22,1,.36,1);
}
.alf-nav-links a:hover::after { transform: scaleX(1); }
.alf-nav-links a.active { color: var(--ink); }
.alf-nav-links a.active::after { transform: scaleX(1); }

.alf-nav-actions { display: flex; align-items: center; gap: 12px; }

.alf-theme-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-dim);
  transition: border-color .2s, color .2s, background .2s;
  flex: none;
}
.alf-theme-toggle:hover { border-color: var(--ink-mute); color: var(--ink); }
.alf-theme-toggle svg { width: 18px; height: 18px; stroke-width: 1.8; }
.alf-theme-toggle .i-sun { display: none; }
[data-theme="light"] .alf-theme-toggle .i-moon { display: none; }
[data-theme="light"] .alf-theme-toggle .i-sun { display: block; }

.alf-nav-cta { display: none; }
/* Gold-filled primary CTA, matching the homepage .btn-primary */
.alf-nav-cta, .alf-mobile-menu a.btn {
  background: var(--accent); color: #0b0f1a; border-color: var(--accent);
}
.alf-nav-cta:hover, .alf-mobile-menu a.btn:hover { filter: brightness(1.06); background: var(--accent); }

/* mobile hamburger */
.alf-nav-toggle {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
}
.alf-nav-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); position: relative; transition: .3s cubic-bezier(.16,1,.3,1); }
.alf-nav-toggle span::before, .alf-nav-toggle span::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 1.5px; background: var(--ink); transition: .3s cubic-bezier(.16,1,.3,1);
}
.alf-nav-toggle span::before { top: -6px; }
.alf-nav-toggle span::after { top: 6px; }
.alf-nav-toggle.open span { background: transparent; }
.alf-nav-toggle.open span::before { top: 0; transform: rotate(45deg); }
.alf-nav-toggle.open span::after { top: 0; transform: rotate(-45deg); }

@media (min-width: 920px) {
  .alf-nav-links, .alf-nav-cta { display: flex; }
  .alf-nav-toggle { display: none; }
}

/* full-screen mobile menu */
.alf-mobile-menu {
  position: fixed;
  inset: 72px 0 0 0;
  background: var(--scrim-solid);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  padding: 24px 24px 34px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: .3s cubic-bezier(.16,1,.3,1);
  z-index: 199;
}
.alf-mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.alf-mobile-menu a { font-size: 22px; color: var(--ink); padding: 12px 0; border-bottom: 1px solid var(--line); letter-spacing: -0.02em; }
/* The CTA keeps its button styling (dark-on-light pill); don't let the generic
   link rule above recolor its label or give it a border. */
.alf-mobile-menu a.btn { color: var(--bg); font-size: 14px; padding: 14px 22px; border-bottom: 1px solid var(--ink); margin-top: 18px; justify-content: center; }
.alf-mobile-menu a.btn:hover { color: var(--bg); }
body.menu-open { overflow: hidden; }

/* ─────────────────────────────────────────────────────────────────────────
   LIGHT-MODE CHROME — restyle the dark-specific decorative surfaces so the
   page reads as a proper light theme. App content inside the phones is left
   untouched in both themes; this only targets the page chrome around them.
   ───────────────────────────────────────────────────────────────────────── */

/* Hero blobs: `screen` blend vanishes on light, so switch to a gentle
   `multiply` tint at low opacity for a soft gold/blue wash. */
[data-theme="light"] .blob {
  mix-blend-mode: multiply;
  opacity: 0.18;
  filter: blur(90px);
}

/* Coverflow arrow buttons + reset/close pills carry rgba(255,255,255,..)
   fills inline; map those generic surfaces to a token-aware class so they
   stay visible on light. (Applied via className on the elements.) */
.alf-surface-soft { background: var(--surface-soft) !important; border-color: var(--line-strong) !important; }
.alf-surface-soft:hover { background: var(--surface-softer) !important; }

/* Big footer wordmark: render both brand variants and swap by theme so the
   "alfcode" logo stays legible on dark (white wordmark) and light (dark
   wordmark). Mirrors the nav brand's .logo-dark / .logo-light swap. */
.footer-wordmark-img { display: block; }
.footer-wordmark-img.logo-light { display: none; }
[data-theme="light"] .footer-wordmark-img.logo-dark { display: none; }
[data-theme="light"] .footer-wordmark-img.logo-light { display: block; }

/* CTA radial glow — already token-driven via inline rgba(var(--accent-glow)). */

/* — Reduced motion: stop infinite float / marquee / auto-animations — */
@media (prefers-reduced-motion: reduce) {
  .floaty { animation: none !important; }
  .marquee-track { animation: none !important; }
  .reveal, .reveal-stagger > * { transition: none !important; opacity: 1 !important; transform: none !important; }
  * { scroll-behavior: auto !important; }
}

/* Larger tap targets for footer links + hero breadcrumb on touch/mobile */
footer ul li a { display: inline-block; padding: 5px 0; }
.alf-breadcrumb { display: inline-block; padding: 8px 0; }
@media (max-width: 700px) {
  footer ul li a { padding: 9px 0; }
}

/* Footer office locations */
.alf-offices { display: grid; grid-template-columns: 1fr; gap: 28px; padding: 36px 0; border-top: 1px solid var(--line); margin-bottom: 4px; }
@media (min-width: 640px) { .alf-offices { grid-template-columns: repeat(3, 1fr); } }
.alf-office { display: flex; flex-direction: column; gap: 8px; }
