/* MyAppAI Living Web Engine — site build 2026-12-03
   Modules: Dimension / Environment / Typography / Motion / Performance / Compliance
   UWS-4.0 (Living Web Engine V3.0 floor) */
@layer tokens, base, dimension, components, scenes, motion, utilities;

@layer tokens {
  :root {
    --bg: #070b18;
    --bg-2: #0a1122;
    --surface: #0e1526;
    --surface-2: #141e36;
    --ink: #edf2ff;
    --ink-muted: #a7b3cf;
    --line: rgba(148, 178, 255, 0.16);
    --blue: #2e7cf6;
    --cyan: #22d3ee;
    --violet: #8b5cf6;
    --green: #34d399;
    --amber: #fbbf24;
    --radius: 14px;
    --radius-s: 10px;
    --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --shadow-card: 0 18px 40px rgba(2, 6, 18, 0.55), 0 2px 0 rgba(160, 200, 255, 0.07) inset,
      0 -14px 28px rgba(3, 8, 22, 0.5) inset;
    --shadow-raise: 0 26px 54px rgba(2, 6, 18, 0.65), 0 2px 0 rgba(170, 210, 255, 0.12) inset;
    --header-h: 76px;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  html[data-motion="off"] { scroll-behavior: auto; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.96rem + 0.25vw, 1.075rem);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  img, svg { max-width: 100%; }
  a { color: var(--cyan); }
  a:hover { color: #7de8fa; }
  :focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 3px;
    border-radius: 6px;
  }
  .skip-link {
    position: absolute; left: 1rem; top: -200px; z-index: 200;
    background: var(--amber); color: #111; padding: 0.7rem 1.1rem;
    border-radius: 0 0 10px 10px; font-weight: 700; text-decoration: none;
  }
  .skip-link:focus { top: 0; color: #111; }
  .wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
  main { display: block; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

@layer dimension {
  /* Extruded display headings with coherent top-left light */
  .display {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.01em;
    font-size: clamp(2.1rem, 1.4rem + 3.6vw, 3.6rem);
    margin: 0 0 1rem;
    text-shadow:
      0 1px 0 rgba(190, 220, 255, 0.35),
      0 3px 0 rgba(46, 124, 246, 0.28),
      0 6px 0 rgba(10, 30, 80, 0.35),
      0 14px 34px rgba(0, 0, 0, 0.55);
  }
  .display .accent {
    background: linear-gradient(92deg, var(--cyan), var(--blue) 55%, var(--violet));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 3px 10px rgba(34, 211, 238, 0.25));
  }
  h2.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 1.2rem + 1.8vw, 2.3rem);
    line-height: 1.15; margin: 0 0 0.6rem;
    text-shadow: 0 2px 0 rgba(46, 124, 246, 0.25), 0 8px 22px rgba(0, 0, 0, 0.5);
  }
  .lede { color: var(--ink-muted); font-size: clamp(1.05rem, 1rem + 0.5vw, 1.25rem); max-width: 62ch; }
  .panel {
    background: linear-gradient(160deg, var(--surface-2), var(--surface) 60%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
  }
  .btn {
    display: inline-flex; align-items: center; gap: 0.55rem;
    min-height: 48px; padding: 0.72rem 1.35rem;
    border-radius: var(--radius-s);
    font-family: var(--font-display); font-weight: 600; font-size: 1rem;
    text-decoration: none; cursor: pointer; border: 1px solid transparent;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
  }
  .btn-primary {
    color: #04122b;
    background: linear-gradient(135deg, #6ee7ff, var(--blue) 60%, #2563eb);
    box-shadow: 0 10px 26px rgba(46, 124, 246, 0.4), 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  }
  .btn-primary:hover { color: #04122b; filter: brightness(1.08); transform: translateY(-2px); }
  .btn-ghost {
    color: var(--ink); background: rgba(20, 30, 54, 0.72);
    border-color: var(--line);
    box-shadow: 0 8px 20px rgba(2, 6, 18, 0.5), 0 1px 0 rgba(170, 210, 255, 0.1) inset;
  }
  .btn-ghost:hover { color: var(--ink); transform: translateY(-2px); border-color: rgba(103, 232, 249, 0.45); }
  .btn:active { transform: translateY(1px) scale(0.99); }
  .price { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--green); }
  .tag {
    display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
    background: rgba(34, 211, 238, 0.12); color: var(--cyan); border: 1px solid rgba(34, 211, 238, 0.3);
  }
  .ad-slot {
    border: 1px dashed rgba(148, 178, 255, 0.28); border-radius: var(--radius);
    background: rgba(10, 17, 34, 0.6); min-height: 120px;
    display: grid; place-items: center; margin: 2.2rem 0; overflow: hidden;
  }
  .ad-slot .ad-label { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }
}

@layer components {
  /* ---------- Header ---------- */
  .site-header {
    position: fixed; inset: 0 0 auto 0; z-index: 100;
    transition: transform 0.35s ease, background 0.3s ease, box-shadow 0.3s ease;
  }
  .site-header .header-scene {
    position: absolute; inset: 0; overflow: hidden; pointer-events: none;
    background:
      radial-gradient(600px 120px at 12% -40%, rgba(46, 124, 246, 0.35), transparent 65%),
      radial-gradient(520px 120px at 85% -50%, rgba(139, 92, 246, 0.28), transparent 65%),
      linear-gradient(180deg, rgba(10, 17, 34, 0.96), rgba(7, 11, 24, 0.9));
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }
  .site-header[data-state="compact"] .header-scene {
    background: linear-gradient(180deg, rgba(10, 17, 34, 0.98), rgba(7, 11, 24, 0.94));
    box-shadow: 0 14px 34px rgba(2, 6, 18, 0.6);
  }
  .site-header[data-state="hidden"] { transform: translateY(-110%); }
  .header-inner {
    position: relative; display: flex; align-items: center; gap: 1.2rem;
    min-height: var(--header-h); padding-block: 0.55rem;
    transition: min-height 0.3s ease;
  }
  .site-header[data-state="compact"] .header-inner { min-height: 58px; }
  .logo { display: inline-flex; align-items: center; gap: 0.65rem; text-decoration: none; flex: none; }
  .logo-mark { width: 44px; height: 44px; filter: drop-shadow(0 4px 10px rgba(34, 211, 238, 0.35)); }
  .logo-word {
    font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; color: var(--ink);
    letter-spacing: 0.01em; text-shadow: 0 2px 0 rgba(46, 124, 246, 0.35);
  }
  .logo-word em { font-style: normal; color: var(--cyan); }
  .main-nav { margin-left: auto; }
  .main-nav ul { display: flex; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
  .main-nav a {
    position: relative; display: inline-flex; align-items: center; gap: 0.45rem;
    min-height: 44px; padding: 0.45rem 0.8rem; border-radius: 9px;
    color: var(--ink); text-decoration: none; font-family: var(--font-display);
    font-weight: 600; font-size: 0.98rem;
    background: linear-gradient(100deg, #edf2ff 20%, #9fd8ff 40%, #edf2ff 60%);
    background-size: 220% 100%; -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: navsheen 7s linear infinite;
    transition: transform 0.15s ease, filter 0.15s ease;
  }
  .main-nav a svg { width: 17px; height: 17px; flex: none; stroke: var(--cyan); -webkit-text-fill-color: initial; }
  .main-nav a:hover { transform: translateY(-2px); filter: brightness(1.25); }
  .main-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--cyan), 0 6px 16px rgba(34, 211, 238, 0.18); border-radius: 9px 9px 4px 4px; }
  .header-tools { display: flex; gap: 0.45rem; align-items: center; flex: none; }
  .tool-btn {
    width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
    display: grid; place-items: center; color: var(--ink);
    background: rgba(20, 30, 54, 0.8); border: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(2, 6, 18, 0.5), 0 1px 0 rgba(170, 210, 255, 0.12) inset;
  }
  .tool-btn[aria-pressed="true"] { color: var(--amber); border-color: rgba(251, 191, 36, 0.5); }
  .tool-btn svg { width: 20px; height: 20px; }
  .burger {
    display: none; width: 48px; height: 48px; border-radius: 10px; cursor: pointer;
    background: rgba(20, 30, 54, 0.85); border: 1px solid var(--line); position: relative;
  }
  .burger span {
    position: absolute; left: 12px; right: 12px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--cyan), var(--blue));
    box-shadow: 0 1px 0 rgba(190, 220, 255, 0.4);
    transition: transform 0.3s ease, opacity 0.2s ease, top 0.3s ease;
  }
  .burger span:nth-child(1) { top: 15px; } .burger span:nth-child(2) { top: 22px; } .burger span:nth-child(3) { top: 29px; }
  .burger[aria-expanded="true"] span:nth-child(1) { top: 22px; transform: rotate(45deg); }
  .burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .burger[aria-expanded="true"] span:nth-child(3) { top: 22px; transform: rotate(-45deg); }

  /* ---------- Drawer ---------- */
  .drawer {
    position: fixed; inset: 0 auto 0 0; width: min(340px, 88vw); z-index: 120;
    transform: translateX(-105%); transition: transform 0.38s cubic-bezier(0.22, 0.9, 0.3, 1);
    background:
      radial-gradient(420px 300px at 0% 0%, rgba(46, 124, 246, 0.3), transparent 60%),
      radial-gradient(380px 300px at 100% 100%, rgba(139, 92, 246, 0.25), transparent 60%),
      linear-gradient(200deg, #0d1730, #070b18);
    border-right: 1px solid var(--line);
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.5);
    padding: 1.2rem; overflow-y: auto;
  }
  .drawer[data-open="true"] { transform: translateX(0); }
  .drawer nav ul { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.4rem; }
  .drawer nav a {
    display: flex; align-items: center; gap: 0.7rem; min-height: 52px;
    padding: 0.6rem 0.9rem; border-radius: 10px; text-decoration: none;
    color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 1.08rem;
    background: rgba(20, 30, 54, 0.55); border: 1px solid transparent;
    text-shadow: 0 2px 0 rgba(46, 124, 246, 0.3);
  }
  .drawer nav a:hover, .drawer nav a[aria-current="page"] { border-color: rgba(34, 211, 238, 0.45); transform: translateX(4px); }
  .drawer nav a svg { width: 20px; height: 20px; stroke: var(--cyan); flex: none; }
  .scrim {
    position: fixed; inset: 0; z-index: 110; background: rgba(3, 5, 12, 0.62);
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
  }
  .scrim[data-open="true"] { opacity: 1; pointer-events: auto; }

  /* ---------- Hero / scenes ---------- */
  .hero { position: relative; padding: calc(var(--header-h) + 3.2rem) 0 3.4rem; overflow: hidden; }
  .hero-scene { position: absolute; inset: 0; pointer-events: none; }
  .hero-scene svg { width: 100%; height: 100%; display: block; }
  .hero-inner { position: relative; z-index: 2; }
  .hero-card {
    max-width: 720px; padding: clamp(1.4rem, 3vw, 2.4rem);
    background: linear-gradient(155deg, rgba(20, 30, 54, 0.88), rgba(10, 17, 34, 0.82));
    border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-raise); backdrop-filter: blur(6px);
  }
  .route-hero { padding: calc(var(--header-h) + 2.6rem) 0 2.4rem; position: relative; overflow: hidden; }
  .route-hero .hero-scene { opacity: 0.9; }

  /* ---------- Cards ---------- */
  .grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
  .card {
    position: relative; border-radius: var(--radius); overflow: hidden;
    background: linear-gradient(165deg, var(--surface-2), var(--surface) 65%);
    border: 1px solid var(--line); box-shadow: var(--shadow-card);
    display: flex; flex-direction: column;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
  }
  .card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: linear-gradient(115deg, transparent 30%, rgba(140, 200, 255, 0.13) 48%, transparent 62%);
    background-size: 250% 100%; background-position: 120% 0;
    transition: background-position 0.7s ease;
  }
  .card:hover, .card:focus-within { transform: translateY(-5px); box-shadow: var(--shadow-raise); }
  .card:hover::after, .card:focus-within::after { background-position: -60% 0; }
  .card-scene { height: 128px; position: relative; overflow: hidden; flex: none; }
  .card-scene svg { width: 100%; height: 100%; display: block; }
  .card-body { padding: 1.15rem 1.25rem 1.3rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
  .card-body h3 { margin: 0; font-family: var(--font-display); font-size: 1.22rem; line-height: 1.25; }
  .card-body p { margin: 0; color: var(--ink-muted); flex: 1; }
  .card-actions { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-top: 0.4rem; }

  .divider { height: 54px; margin: 0; position: relative; overflow: hidden; }
  .divider svg { width: 100%; height: 100%; display: block; }
  section.block { padding: 2.6rem 0; }
  .prose { max-width: 74ch; }
  .prose h2 { font-family: var(--font-display); margin-top: 2rem; }
  .prose h3 { font-family: var(--font-display); margin-top: 1.5rem; }
  .prose li { margin-bottom: 0.35rem; }
  .crumbs { font-size: 0.92rem; color: var(--ink-muted); margin-bottom: 1rem; }
  .crumbs a { color: var(--ink-muted); }

  /* ---------- Footer ---------- */
  .site-footer { position: relative; margin-top: 3rem; overflow: hidden; }
  .footer-scene {
    position: absolute; inset: 0; pointer-events: none;
    background:
      radial-gradient(700px 200px at 15% 110%, rgba(46, 124, 246, 0.3), transparent 65%),
      radial-gradient(600px 200px at 85% 110%, rgba(34, 211, 238, 0.2), transparent 65%),
      linear-gradient(0deg, #05070f, #0a1122);
    border-top: 1px solid var(--line);
  }
  .footer-inner { position: relative; padding: 2.6rem 0 2rem; display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
  .site-footer h2.footer-h { font-family: var(--font-display); margin: 0 0 0.7rem; font-size: 1.02rem; text-shadow: 0 2px 0 rgba(46, 124, 246, 0.3); }
  .site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
  .site-footer a { color: var(--ink-muted); text-decoration: none; display: inline-block; padding: 0.22rem 0; min-height: 32px; }
  .site-footer a:hover, .site-footer a:focus-visible { color: var(--cyan); transform: translateX(3px); }
  .footer-base { position: relative; border-top: 1px solid var(--line); padding: 1.1rem 0 1.4rem; color: var(--ink-muted); font-size: 0.92rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }

  @media (max-width: 900px) {
    .main-nav { display: none; }
    .burger { display: block; margin-left: auto; }
    .header-tools { margin-left: 0.4rem; }
  }
}

@layer motion {
  @keyframes navsheen { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
  @keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
  @keyframes pulse-node { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
  .logo-mark { animation: floaty 6s ease-in-out infinite; }
  .reveal { opacity: 0; transform: translateY(22px); }
  .reveal[data-dir="left"] { transform: translateX(-26px); }
  .reveal[data-dir="right"] { transform: translateX(26px); }
  .reveal.is-in { opacity: 1; transform: none; transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.8, 0.3, 1); }
  html[data-motion="off"] .reveal { opacity: 1; transform: none; }
  html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
    animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important;
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; }
    *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  }
}

@layer utilities {
  @media (forced-colors: active) {
    .card, .panel, .hero-card, .btn, .tool-btn { border: 1px solid CanvasText; }
    .display .accent { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }
    .main-nav a { background: none; -webkit-text-fill-color: CanvasText; color: CanvasText; }
  }
}
