/* Kerai Studio Landing — M3 Expressive Dark Monochrome */
@layer reset, tokens, base, components, layout, animations, util;

/* ============================================
   RESET
   ============================================ */
@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    min-height: 100dvh;
  }

  img, svg {
    display: block;
    max-width: 100%;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  ul {
    list-style: none;
  }

  button, input, textarea {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
  }

  textarea {
    resize: vertical;
  }
}

/* ============================================
   TOKENS
   ============================================ */
@layer tokens {
  :root {
    /* Surfaces */
    --surface-lowest:  #0a0a0a;
    --surface-low:     #151517;
    --surface:         #1c1c1f;
    --surface-high:    #252528;
    --surface-highest: #2e2e32;

    /* Text */
    --on-surface:      #e3e2e8;
    --on-surface-dim:  #8e8e96;
    --on-surface-faint:#5a5a62;

    /* Outlines */
    --outline:         #3a3a40;
    --outline-variant: #2a2a2f;

    /* White for accents */
    --white:           #ffffff;
    --white-dim:       rgba(255, 255, 255, 0.08);
    --white-hover:     rgba(255, 255, 255, 0.12);
    --white-pressed:   rgba(255, 255, 255, 0.16);

    /* Shape scale — M3 */
    --radius-xs:   4px;
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-xxl:  28px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --text-display:   clamp(2.5rem, 5vw, 3.5rem);
    --text-headline:  clamp(1.5rem, 3vw, 2rem);
    --text-title:     1.25rem;
    --text-body:      1rem;
    --text-label:     0.875rem;
    --text-small:     0.8125rem;

    --weight-regular: 400;
    --weight-medium:  500;
    --weight-semibold:600;

    /* Elevation — subtle */
    --elevation-1: 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
    --elevation-2: 0 4px 12px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);

    /* Glass */
    --glass-bg:       rgba(21, 21, 23, 0.55);
    --glass-bg-hover: rgba(28, 28, 31, 0.65);
    --glass-bg-light: rgba(28, 28, 31, 0.45);
    --glass-blur:     16px;

    /* Transitions */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Layout */
    --max-width: 1120px;
    --nav-height: 64px;
  }
}

/* ============================================
   BASE
   ============================================ */
@layer base {
  body {
    font-family: var(--font-family);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: 1.6;
    color: var(--on-surface);
    background: var(--surface-lowest);
  }

  h1, h2, h3 {
    color: var(--white);
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--text-display);
    font-weight: var(--weight-semibold);
  }

  h2 {
    font-size: var(--text-headline);
    font-weight: var(--weight-semibold);
  }

  h3 {
    font-size: var(--text-title);
    font-weight: var(--weight-medium);
  }

  p {
    color: var(--on-surface-dim);
    max-width: 60ch;
  }

  ::selection {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
  }
}

/* ============================================
   COMPONENTS
   ============================================ */
@layer components {

  /* --- Buttons --- */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 28px;
    border-radius: var(--radius-full);
    font-size: var(--text-label);
    font-weight: var(--weight-medium);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition:
      background var(--duration-normal) var(--ease-out),
      transform var(--duration-fast) var(--ease-out),
      box-shadow var(--duration-normal) var(--ease-out);
    user-select: none;
    white-space: nowrap;
  }

  .btn .material-symbols-outlined {
    font-size: 18px;
  }

  .btn-primary {
    background: var(--white);
    color: var(--surface-lowest);
  }

  .btn-primary:hover {
    background: var(--on-surface);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255,255,255,0.1);
  }

  .btn-primary:active {
    transform: translateY(0);
  }

  .btn-outline {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--on-surface);
    border: 1px solid var(--outline);
  }

  .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--on-surface-dim);
  }

  .btn-sm {
    padding: 8px 20px;
    font-size: var(--text-small);
  }

  /* --- Material Symbols baseline --- */
  .material-symbols-outlined {
    font-variation-settings:
      'FILL' 0,
      'wght' 400,
      'GRAD' 0,
      'opsz' 24;
    vertical-align: middle;
  }

  /* --- Section headers --- */
  .section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
  }

  .section-header h2 {
    margin-bottom: var(--space-md);
  }
}

/* ============================================
   LAYOUT
   ============================================ */
@layer layout {

  /* --- Navbar --- */
  .header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }

  header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    height: var(--nav-height);
  }

  .logo {
    color: var(--white);
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .logo-svg {
    height: 40px;
    width: auto;
  }

  header nav {
    flex: 1;
  }

  header nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
  }

  header nav a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-size: var(--text-label);
    font-weight: var(--weight-medium);
    color: var(--on-surface-dim);
    transition: color var(--duration-fast) var(--ease-out),
                background var(--duration-fast) var(--ease-out);
  }

  header nav a:hover {
    color: var(--white);
    background: var(--white-dim);
  }

  header > .btn {
    flex-shrink: 0;
  }

  /* Mobile nav toggle */
  .menu-checkbox {
    display: none;
  }

  .menu-toggle {
    display: none;
    cursor: pointer;
    color: var(--on-surface);
    margin-left: auto;
  }

  .menu-toggle .material-symbols-outlined {
    font-size: 24px;
  }

  .menu-toggle [data-show="open"] {
    display: none;
  }

  .menu-checkbox:checked ~ .menu-toggle [data-show="closed"] {
    display: none;
  }

  .menu-checkbox:checked ~ .menu-toggle [data-show="open"] {
    display: block;
  }

  /* Backdrop blur for navbar */
  .header-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: none;
    z-index: -1;
  }

  /* --- Mobile nav --- */
  @media (width < 768px) {
    .menu-toggle {
      display: block;
    }

    header > .btn {
      display: none;
    }

    header nav {
      display: none;
      position: fixed;
      top: var(--nav-height);
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(10, 10, 10, 0.95);
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
      padding: var(--space-xl);
      z-index: 99;
    }

    .menu-checkbox:checked ~ nav {
      display: block;
      animation: fadeIn var(--duration-normal) var(--ease-out);
    }

    header nav ul {
      flex-direction: column;
      gap: var(--space-sm);
    }

    header nav a {
      font-size: var(--text-title);
      padding: var(--space-md);
    }
  }

  /* --- Hero --- */
  #hero {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-height) + var(--space-3xl)) var(--space-lg) var(--space-3xl);
    position: relative;
    z-index: 1;
  }

  /* Tubes cursor — fixed full-page behind everything */
  #tubes-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
  }

  /* Particle canvas — fills hero, sits behind content */
  #hero-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
  }

  /* Allow mouse events to pass through to canvas for interaction */
  #hero {
    /* canvas captures mouse via JS on the section itself */
  }

  .hero-content {
    max-width: 720px;
    text-align: center;
    position: relative;
  }

  .hero-content h1 {
    margin-bottom: var(--space-lg);
  }

  .hero-content h1 .dim {
    color: var(--on-surface-dim);
  }

  .hero-sub {
    font-size: clamp(1rem, 2vw, 1.125rem);
    margin: 0 auto var(--space-xl);
    max-width: 55ch;
  }

  .hero-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  /* --- Terminal --- */
  .terminal {
    max-width: 480px;
    margin: 0 auto var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--outline-variant);
    background: var(--surface-low);
  }

  .terminal-bar {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--outline-variant);
  }

  .terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--outline);
  }

  .terminal-body {
    padding: var(--space-md) var(--space-lg);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: var(--text-label);
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  .terminal-prompt {
    color: var(--on-surface-dim);
  }

  .terminal-text {
    color: var(--on-surface);
  }

  .terminal-cursor {
    color: var(--on-surface);
    animation: blink 1s step-end infinite;
  }

  @keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
  }

  /* --- Services Grid --- */
  #services {
    padding: var(--space-4xl) var(--space-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  .services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

  @media (width < 900px) {
    .services-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (width < 560px) {
    .services-grid {
      grid-template-columns: 1fr;
    }
  }

  .service-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    transition:
      background var(--duration-normal) var(--ease-out),
      border-color var(--duration-normal) var(--ease-out),
      transform var(--duration-normal) var(--ease-spring);
  }

  .service-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--outline);
    transform: translateY(-2px);
  }

  .service-card h3 {
    margin-bottom: var(--space-sm);
  }

  .service-card p {
    font-size: var(--text-label);
    line-height: 1.5;
  }

  /* ---- Service demos shared ---- */
  .demo {
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    margin-bottom: var(--space-md);
    overflow: hidden;
    position: relative;
    height: 148px;
    display: flex;
    flex-direction: column;
  }

  /* Shared dots (browser/code bars) */
  .demo-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--outline);
    display: inline-block;
  }

  /* ---- 1. Browser demo ---- */
  .demo-browser-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    background: var(--surface-high);
    border-bottom: 1px solid var(--outline-variant);
  }

  .demo-url {
    flex: 1;
    margin-left: 6px;
    background: var(--surface);
    border-radius: var(--radius-full);
    padding: 2px 10px;
    font-size: 9px;
    color: var(--on-surface-dim);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .demo-url-lock {
    font-size: 6px;
    color: var(--on-surface-faint);
  }

  .demo-browser-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .demo-nav-bar {
    height: 6px;
    width: 60%;
    border-radius: 3px;
    background: var(--outline-variant);
    animation: shimmer 2s ease-in-out infinite;
  }

  .demo-hero-block {
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--outline-variant) 0%, var(--surface-highest) 50%, var(--outline-variant) 100%);
    background-size: 200% 100%;
    animation: shimmer 2.5s ease-in-out infinite;
  }

  .demo-content-row {
    display: flex;
    gap: 5px;
  }

  .demo-card-block {
    flex: 1;
    height: 28px;
    border-radius: 4px;
    background: var(--outline-variant);
    animation: shimmer 2s ease-in-out infinite;
  }

  .demo-card-block:nth-child(2) { animation-delay: 0.3s; }
  .demo-card-block:nth-child(3) { animation-delay: 0.6s; }

  @keyframes shimmer {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }

  /* ---- 2. Chat demo ---- */
  .demo-chat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface-high);
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
  }

  .demo-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--outline);
  }

  .demo-chat-name {
    font-size: 9px;
    font-weight: 600;
    color: var(--on-surface);
    flex: 1;
  }

  .demo-chat-status {
    font-size: 7px;
    color: #6abf69;
  }

  .demo-chat-body {
    flex: 1;
    overflow: hidden;
    position: relative;
  }

  .demo-chat-scroll {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 8px;
    animation: chatScroll 8s ease-in-out infinite;
  }

  /* Scroll down as messages appear, then reset */
  @keyframes chatScroll {
    0%   { transform: translateY(0); }
    25%  { transform: translateY(0); }
    60%  { transform: translateY(-50px); }
    92%  { transform: translateY(-50px); }
    96%  { opacity: 0; transform: translateY(-50px); }
    97%  { opacity: 0; transform: translateY(0); }
    100% { opacity: 1; transform: translateY(0); }
  }

  .demo-msg {
    max-width: 80%;
    opacity: 0;
    animation: msgLoop 8s ease infinite;
  }

  .demo-msg span {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 8px;
    line-height: 1.3;
  }

  .demo-msg-in span {
    background: var(--surface-highest);
    color: var(--on-surface);
    border-bottom-left-radius: 3px;
  }

  .demo-msg-out {
    align-self: flex-end;
  }

  .demo-msg-out span {
    background: var(--white-dim);
    color: var(--on-surface);
    border-bottom-right-radius: 3px;
  }

  /* Staggered: 6 messages across 8s cycle */
  .demo-msg:nth-child(1) { animation-delay: 0s; }
  .demo-msg:nth-child(2) { animation-delay: 0.7s; }
  .demo-msg:nth-child(3) { animation-delay: 1.4s; }
  .demo-msg:nth-child(4) { animation-delay: 2.1s; }
  .demo-msg:nth-child(5) { animation-delay: 2.8s; }
  .demo-msg:nth-child(6) { animation-delay: 3.5s; }

  @keyframes msgLoop {
    0%   { opacity: 0; transform: translateY(6px) scale(0.96); }
    5%   { opacity: 1; transform: translateY(0) scale(1); }
    92%  { opacity: 1; transform: translateY(0) scale(1); }
    97%  { opacity: 0; }
    100% { opacity: 0; }
  }

  .demo-msg-card {
    background: transparent;
  }

  .demo-plan {
    font-size: 8px;
    font-weight: 600;
    color: var(--on-surface);
    padding: 4px 8px 2px;
    background: var(--surface-highest);
    border-radius: 6px 6px 0 0;
  }

  .demo-plan-btn {
    font-size: 8px;
    font-weight: 500;
    color: var(--surface-lowest);
    background: var(--on-surface-dim);
    text-align: center;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
  }

  /* ---- 3. Dashboard demo ---- */
  .demo-dash-metrics {
    display: flex;
    gap: 4px;
    padding: 10px 10px 6px;
  }

  .demo-metric {
    flex: 1;
    background: var(--surface-high);
    border-radius: 6px;
    padding: 6px;
    text-align: center;
  }

  .demo-metric-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--white);
    font-variant-numeric: tabular-nums;
  }

  .demo-metric-label {
    font-size: 7px;
    color: var(--on-surface-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .demo-chart {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding: 6px 10px 10px;
    flex: 1;
  }

  .demo-bar {
    flex: 1;
    background: var(--on-surface-faint);
    border-radius: 3px 3px 0 0;
    height: 0;
    animation: barLoop 4s ease-in-out infinite;
    transition: background 0.2s;
  }

  .service-card:hover .demo-bar {
    background: var(--on-surface-dim);
  }

  .demo-bar:nth-child(1) { animation-delay: 0.0s; }
  .demo-bar:nth-child(2) { animation-delay: 0.06s; }
  .demo-bar:nth-child(3) { animation-delay: 0.12s; }
  .demo-bar:nth-child(4) { animation-delay: 0.18s; }
  .demo-bar:nth-child(5) { animation-delay: 0.24s; }
  .demo-bar:nth-child(6) { animation-delay: 0.30s; }
  .demo-bar:nth-child(7) { animation-delay: 0.36s; }

  @keyframes barLoop {
    0%   { height: 0; }
    20%  { height: var(--h); }
    70%  { height: var(--h); }
    90%  { height: 0; }
    100% { height: 0; }
  }

  /* ---- 4. AI neural net demo ---- */
  .demo-ai {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
  }

  .demo-ai-svg {
    width: 100%;
    height: 100%;
  }

  .ai-node {
    fill: var(--on-surface-faint);
    animation: nodePulse 3s ease-in-out infinite;
  }

  .ai-node:nth-child(2) { animation-delay: 0.3s; }
  .ai-node:nth-child(3) { animation-delay: 0.6s; }
  .ai-node:nth-child(4) { animation-delay: 0.9s; }
  .ai-node:nth-child(5) { animation-delay: 1.2s; }
  .ai-node:nth-child(6) { animation-delay: 1.5s; }

  .service-card:hover .ai-node {
    fill: var(--on-surface-dim);
  }

  @keyframes nodePulse {
    0%, 100% { fill: var(--on-surface-faint); r: 5; }
    50%      { fill: var(--on-surface-dim); r: 7; }
  }

  .ai-line {
    stroke: var(--outline-variant);
    stroke-width: 1;
    animation: lineGlow 3s ease-in-out infinite;
  }

  .ai-line:nth-child(odd) { animation-delay: 0.5s; }

  .service-card:hover .ai-line {
    stroke: var(--outline);
  }

  @keyframes lineGlow {
    0%, 100% { stroke: var(--outline-variant); stroke-width: 1; }
    50%      { stroke: var(--outline); stroke-width: 1.5; }
  }

  .ai-pulse {
    fill: var(--on-surface);
    opacity: 0.7;
  }

  /* ---- 5. E-commerce demo ---- */
  .demo-ecom {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    border: none;
    background: transparent;
  }

  .demo-product {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--outline-variant);
    padding: 10px;
  }

  .demo-product-img {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface-high);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .demo-product-img .material-symbols-outlined {
    font-size: 22px;
    color: var(--on-surface-dim);
  }

  .demo-product-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--on-surface);
  }

  .demo-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
    margin-top: 2px;
  }

  .demo-cart-action {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .demo-cart-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 0;
    background: var(--white-dim);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 500;
    color: var(--on-surface);
    transition: background 0.2s;
  }

  .demo-cart-btn .material-symbols-outlined {
    font-size: 14px;
  }

  .service-card:hover .demo-cart-btn {
    background: var(--white-hover);
  }

  .demo-cart-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--on-surface-dim);
    color: var(--surface-lowest);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgeLoop 3.5s ease infinite;
  }

  .demo-cart-btn {
    animation: cartPulse 3.5s ease infinite;
  }

  @keyframes badgeLoop {
    0%   { transform: scale(0); opacity: 0; }
    20%  { transform: scale(1.15); opacity: 1; }
    25%  { transform: scale(1); opacity: 1; }
    70%  { transform: scale(1); opacity: 1; }
    85%  { transform: scale(0); opacity: 0; }
    100% { transform: scale(0); opacity: 0; }
  }

  @keyframes cartPulse {
    0%   { background: var(--white-dim); }
    18%  { background: var(--white-hover); }
    25%  { background: var(--white-dim); }
    100% { background: var(--white-dim); }
  }

  /* ---- 6. Code editor demo ---- */
  .demo-code-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    background: var(--surface-high);
    border-bottom: 1px solid var(--outline-variant);
  }

  .demo-code-tab {
    margin-left: 8px;
    font-size: 9px;
    color: var(--on-surface-dim);
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 4px 4px 0 0;
  }

  .demo-code-body {
    padding: 10px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 9.5px;
    line-height: 1.7;
    flex: 1;
  }

  .demo-code-line {
    opacity: 0;
    animation: codeLoop 6s ease infinite;
    white-space: nowrap;
  }

  .demo-code-line:nth-child(1) { animation-delay: 0s; }
  .demo-code-line:nth-child(2) { animation-delay: 0.25s; }
  .demo-code-line:nth-child(3) { animation-delay: 0.5s; }
  .demo-code-line:nth-child(4) { animation-delay: 0.75s; }
  .demo-code-line:nth-child(5) { animation-delay: 1.0s; }

  @keyframes codeLoop {
    0%   { opacity: 0; transform: translateX(-4px); }
    8%   { opacity: 1; transform: translateX(0); }
    70%  { opacity: 1; transform: translateX(0); }
    85%  { opacity: 0; transform: translateX(4px); }
    100% { opacity: 0; }
  }

  .code-kw  { color: #c0a0f0; }
  .code-fn  { color: #7ab0e0; }
  .code-name{ color: #e0d080; }
  .code-str { color: #80c8a0; }
  .code-cmt { color: var(--on-surface-faint); }

  /* --- Process --- */
  #process {
    padding: var(--space-4xl) var(--space-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  .process-steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
  }

  .step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 var(--space-md);
  }

  .step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--glass-bg-light);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--outline);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-title);
    font-weight: var(--weight-semibold);
    color: var(--white);
    margin-bottom: var(--space-lg);
    flex-shrink: 0;
  }

  .step-content h3 {
    margin-bottom: var(--space-xs);
  }

  .step-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--on-surface-dim);
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-md);
  }

  .step-content p {
    font-size: var(--text-label);
    margin: 0 auto;
    max-width: 28ch;
  }

  .step-connector {
    width: 1px;
    align-self: stretch;
    background: linear-gradient(to bottom, transparent, var(--outline), transparent);
    margin-top: 24px;
    flex-shrink: 0;
  }

  @media (width >= 768px) {
    .step-connector {
      width: auto;
      height: 1px;
      flex: 0 0 auto;
      min-width: 40px;
      align-self: auto;
      margin-top: 24px;
      background: linear-gradient(to right, transparent, var(--outline), transparent);
    }

    .process-steps {
      align-items: flex-start;
    }
  }

  @media (width < 768px) {
    .process-steps {
      flex-direction: column;
      align-items: center;
    }

    .step {
      flex-direction: row;
      text-align: left;
      gap: var(--space-lg);
      padding: var(--space-md) 0;
    }

    .step-number {
      margin-bottom: 0;
    }

    .step-content p {
      max-width: none;
    }

    .step-connector {
      width: 1px;
      height: 32px;
      min-width: auto;
      margin-top: 0;
      margin-left: 24px;
      align-self: flex-start;
    }
  }

  /* --- Contact --- */
  #contact {
    padding: var(--space-4xl) var(--space-lg);
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  .contact-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
  }

  .contact-header {
    text-align: center;
    margin-bottom: var(--space-xl);
  }

  .contact-header h2 {
    margin-bottom: var(--space-sm);
  }

  .contact-header p {
    margin: 0 auto;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }

  @media (width < 560px) {
    .form-row {
      grid-template-columns: 1fr;
    }
  }

  .form-field {
    margin-bottom: var(--space-md);
  }

  .form-field label {
    display: block;
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
    color: var(--on-surface-dim);
    margin-bottom: var(--space-sm);
  }

  .form-field input,
  .form-field textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    color: var(--on-surface);
    font-size: var(--text-label);
    transition: border-color var(--duration-fast) var(--ease-out),
                background var(--duration-fast) var(--ease-out);
  }

  .form-field input::placeholder,
  .form-field textarea::placeholder {
    color: var(--on-surface-faint);
  }

  .form-field input:focus,
  .form-field textarea:focus {
    outline: none;
    border-color: var(--on-surface-dim);
    background: var(--surface-high);
  }

  .btn-submit {
    width: 100%;
    justify-content: center;
    padding: 14px 28px;
    margin-top: var(--space-sm);
  }

  .form-status {
    text-align: center;
    margin-top: var(--space-md);
    font-size: var(--text-label);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
  }

  .form-status.success {
    color: #a3d9a5;
    background: rgba(163, 217, 165, 0.1);
  }

  .form-status.error {
    color: #f4a0a0;
    background: rgba(244, 160, 160, 0.1);
  }

  /* --- Footer --- */
  footer {
    padding: var(--space-xl) var(--space-lg);
    border-top: 1px solid var(--outline-variant);
    background: rgba(10, 10, 10, 0.5);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    position: relative;
    z-index: 1;
  }

  .footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: var(--text-small);
    color: var(--on-surface-faint);
  }

  .footer-logo {
    display: flex;
    align-items: center;
    color: var(--on-surface-dim);
  }

  .footer-logo-svg {
    height: 24px;
    width: auto;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@layer animations {

  /* Fade in on page load */
  @keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Hero entrance */
  .hero-content h1 {
    animation: fadeInUp 0.8s var(--ease-out) both;
  }

  .hero-sub {
    animation: fadeInUp 0.8s var(--ease-out) 0.1s both;
  }

  .terminal {
    animation: fadeInUp 0.8s var(--ease-out) 0.2s both;
  }

  .hero-cta {
    animation: fadeInUp 0.8s var(--ease-out) 0.3s both;
  }

  /* Scroll reveal — cards & steps */
  .service-card,
  .step,
  .contact-card {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity var(--duration-slow) var(--ease-out),
      transform var(--duration-slow) var(--ease-out);
  }

  .service-card.visible,
  .step.visible,
  .contact-card.visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered card reveal */
  .service-card:nth-child(1) { transition-delay: 0ms; }
  .service-card:nth-child(2) { transition-delay: 60ms; }
  .service-card:nth-child(3) { transition-delay: 120ms; }
  .service-card:nth-child(4) { transition-delay: 180ms; }
  .service-card:nth-child(5) { transition-delay: 240ms; }
  .service-card:nth-child(6) { transition-delay: 300ms; }

  /* Staggered steps */
  .step:nth-of-type(1) { transition-delay: 0ms; }
  .step:nth-of-type(2) { transition-delay: 100ms; }
  .step:nth-of-type(3) { transition-delay: 200ms; }

  /* Scroll-driven hero parallax — progressive enhancement */
  @supports (animation-timeline: view()) {
    #hero .hero-content {
      animation: heroParallax linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 50%;
    }

    @keyframes heroParallax {
      from {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
      to {
        opacity: 0;
        transform: translateY(-40px) scale(0.97);
      }
    }
  }
}

/* ============================================
   UTIL
   ============================================ */
@layer util {
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }
}
