/* ============================================================================
   Atlas Runtime Labs — site styles
   IBM Carbon Design language. Light (g10) + Dark (g100) themes via [data-theme].
   ========================================================================== */

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; padding: 0; }
h1, h2, h3, h4 { line-height: 1.15; font-weight: 600; letter-spacing: -0.01em; }

/* ---- Theme tokens --------------------------------------------------------- */
:root {
  /* fixed brand ramp (Carbon Blue) */
  --blue-60: #0f62fe;
  --blue-70: #0353e9;
  --blue-40: #78a9ff;

  /* layout */
  --container: 1184px;
  --header-h: 56px;
  --ease: cubic-bezier(0.2, 0, 0.1, 1);
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f4f4f4;
  --layer: #f4f4f4;
  --layer-2: #ffffff;
  --layer-hover: #e8e8e8;
  --text: #161616;
  --text-secondary: #525252;
  --text-placeholder: #6f6f6f;
  --border: #e0e0e0;
  --border-strong: #8d8d8d;
  --accent: #0f62fe;
  --accent-hover: #0353e9;
  --link: #0f62fe;
  --on-accent: #ffffff;
  --hero-grid: rgba(15, 98, 254, 0.08);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
  --code-bg: #f4f4f4;
}

:root[data-theme="dark"] {
  --bg: #161616;
  --bg-alt: #1c1c1c;
  --layer: #262626;
  --layer-2: #393939;
  --layer-hover: #333333;
  --text: #f4f4f4;
  --text-secondary: #c6c6c6;
  --text-placeholder: #a8a8a8;
  --border: #393939;
  --border-strong: #6f6f6f;
  --accent: #0f62fe;
  --accent-hover: #4589ff;
  --link: #78a9ff;
  --on-accent: #ffffff;
  --hero-grid: rgba(120, 169, 255, 0.10);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --code-bg: #262626;
}

/* ---- Utilities ------------------------------------------------------------ */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-block;
  margin-bottom: 16px;
}
.section { padding: 96px 0; }
.section--tight { padding: 64px 0; }
.section__head { max-width: 640px; margin-bottom: 56px; }
.section__title { font-size: clamp(1.75rem, 4vw, 2.625rem); margin-bottom: 16px; }
.section__lead { font-size: 1.125rem; color: var(--text-secondary); }
.text-secondary { color: var(--text-secondary); }
.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;
}

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 40px;
  min-height: 48px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 0;
  font-size: 0.875rem; font-weight: 400; letter-spacing: 0.01em;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--layer-hover); }
.btn--ghost { background: transparent; color: var(--link); gap: 12px; }
.btn--ghost:hover { background: var(--layer-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- Header / nav --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), background-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.brand-text { font-size: 0.9375rem; letter-spacing: -0.01em; }
.brand-text b { font-weight: 600; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  position: relative; color: var(--text-secondary); padding: 8px 16px;
  font-size: 0.875rem; transition: color .15s var(--ease);
}
.nav-link::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: 4px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s var(--ease);
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.nav-link[aria-current="page"] { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: transparent; border: none; color: var(--text);
  border-radius: 0; transition: background-color .15s var(--ease);
}
.icon-btn:hover { background: var(--layer-hover); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.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; }

/* ---- Hero ----------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 80px; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--hero-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 80% 70% at 70% 0%, #000 0%, transparent 75%);
  animation: grid-in 1.2s var(--ease) both;
}
@keyframes grid-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: scale(1); } }
.hero .container { position: relative; z-index: 1; }
.hero__inner { max-width: 760px; }
.hero__title {
  font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 1.05; letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.hero__title .accent { color: var(--accent); }
.hero__lead { font-size: clamp(1.125rem, 2.2vw, 1.375rem); color: var(--text-secondary); max-width: 600px; margin-bottom: 40px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 16px; }
.hero--sub { padding: 80px 0 56px; }
.hero--sub .hero__title { font-size: clamp(2rem, 5vw, 3.25rem); }

/* staggered entrance for hero children */
.stagger > * { opacity: 0; transform: translateY(20px); animation: rise .7s var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .15s; }
.stagger > *:nth-child(3) { animation-delay: .25s; }
.stagger > *:nth-child(4) { animation-delay: .35s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ---- Scroll reveal -------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0s); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Grid + cards --------------------------------------------------------- */
.grid { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.tile { background: var(--bg); padding: 40px 32px; transition: background-color .2s var(--ease); }
.tile:hover { background: var(--layer); }
.tile__num { font-family: 'IBM Plex Mono', monospace; font-size: 0.8125rem; color: var(--accent); margin-bottom: 20px; }
.tile__icon { color: var(--accent); margin-bottom: 20px; }
.tile__icon svg { width: 32px; height: 32px; }
.tile h3 { font-size: 1.25rem; margin-bottom: 12px; }
.tile p { color: var(--text-secondary); font-size: 0.9375rem; }

/* feature card (bordered, hover lift) */
.card {
  background: var(--layer-2); border: 1px solid var(--border); padding: 32px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  position: relative;
}
.card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
  transform: scaleY(0); transform-origin: top; transition: transform .25s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card:hover::before { transform: scaleY(1); }

/* ---- Featured strip ------------------------------------------------------- */
.feature { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: center; }
.feature__media {
  aspect-ratio: 4 / 3; background: var(--layer);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.feature__media .glyph { width: 96px; height: 96px; color: var(--accent); position: relative; z-index: 1; }
.feature__media::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--hero-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
  background-size: 32px 32px;
}
.feature h2 { font-size: clamp(1.75rem, 3.5vw, 2.25rem); margin-bottom: 16px; }
.feature p { color: var(--text-secondary); font-size: 1.0625rem; margin-bottom: 24px; }

/* ---- Principles list ------------------------------------------------------ */
.principle { display: grid; grid-template-columns: 64px 1fr; gap: 24px; padding: 28px 0; border-top: 1px solid var(--border); }
.principle:last-child { border-bottom: 1px solid var(--border); }
.principle__n { font-family: 'IBM Plex Mono', monospace; font-size: 1.25rem; color: var(--accent); }
.principle h3 { font-size: 1.25rem; margin-bottom: 8px; }
.principle p { color: var(--text-secondary); }

/* ---- Product cards -------------------------------------------------------- */
.products { display: grid; grid-template-columns: 1fr; gap: 24px; }
.product {
  display: grid; grid-template-columns: auto 1fr; gap: 32px;
  background: var(--layer-2); border: 1px solid var(--border); padding: 40px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.product:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.product__icon {
  width: 96px; height: 96px; border-radius: 20px; overflow: hidden; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.product__icon svg { width: 100%; height: 100%; }
.product__cat { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.product__name { font-size: 1.625rem; margin: 8px 0 4px; }
.product__tag { color: var(--text-secondary); font-size: 1rem; margin-bottom: 20px; }
.product__desc { color: var(--text-secondary); font-size: 0.9375rem; max-width: 60ch; margin-bottom: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  font-size: 0.75rem; padding: 6px 12px; background: var(--layer); border: 1px solid var(--border);
  color: var(--text-secondary); font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.02em;
}
.product__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.product__meta { font-size: 0.8125rem; color: var(--text-placeholder); font-family: 'IBM Plex Mono', monospace; }

/* Play badge (custom, Carbon-styled) */
.play-badge {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--bg); padding: 10px 20px; border: 1px solid var(--text);
  transition: opacity .15s var(--ease);
}
.play-badge:hover { opacity: 0.88; text-decoration: none; }
.play-badge svg { width: 22px; height: 22px; }
.play-badge .pb-small { font-size: 0.625rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: .8; line-height: 1; }
.play-badge .pb-large { font-size: 1.0625rem; font-weight: 600; line-height: 1.1; }
.play-badge[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* "coming soon" placeholder product */
.product--soon { border-style: dashed; align-items: center; justify-items: center; text-align: center; grid-template-columns: 1fr; color: var(--text-placeholder); }
.product--soon .product__icon { display: flex; align-items: center; justify-content: center; background: var(--layer); box-shadow: none; border: 1px solid var(--border); border-radius: 20px; }
.product--soon svg { width: 40px; height: 40px; color: var(--text-placeholder); }

/* ---- Legal / prose -------------------------------------------------------- */
.prose { max-width: 760px; }
.prose .toc { background: var(--layer); border: 1px solid var(--border); padding: 24px 28px; margin-bottom: 48px; }
.prose .toc strong { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); display: block; margin-bottom: 12px; }
.prose .toc ol { counter-reset: toc; padding: 0; }
.prose .toc li { counter-increment: toc; padding: 4px 0; }
.prose .toc a::before { content: counter(toc, decimal-leading-zero) " · "; font-family: 'IBM Plex Mono', monospace; color: var(--accent); }
.prose h2 { font-size: 1.375rem; margin: 48px 0 16px; padding-top: 16px; scroll-margin-top: 80px; }
.prose h2 .h2-n { font-family: 'IBM Plex Mono', monospace; color: var(--accent); font-size: 1rem; margin-right: 12px; }
.prose h3 { font-size: 1.0625rem; margin: 28px 0 8px; }
.prose p { color: var(--text-secondary); margin-bottom: 16px; }
.prose ul.bullets { list-style: none; margin: 0 0 20px; }
.prose ul.bullets li { position: relative; padding-left: 24px; margin-bottom: 10px; color: var(--text-secondary); }
.prose ul.bullets li::before { content: ''; position: absolute; left: 4px; top: 10px; width: 8px; height: 8px; background: var(--accent); }
.prose a.inline { color: var(--link); text-decoration: underline; }
.prose code { font-family: 'IBM Plex Mono', monospace; font-size: 0.875em; background: var(--code-bg); padding: 2px 6px; border: 1px solid var(--border); }
.callout { background: var(--layer); border-left: 3px solid var(--accent); padding: 20px 24px; margin: 24px 0; }
.callout p { margin: 0; color: var(--text); }
.updated { font-family: 'IBM Plex Mono', monospace; font-size: 0.8125rem; color: var(--text-placeholder); margin-top: 8px; }

/* ---- CTA band ------------------------------------------------------------- */
.cta-band { background: var(--layer); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cta-band .inner { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; padding: 56px 0; }
.cta-band h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.cta-band p { color: var(--text-secondary); margin-top: 8px; }

/* ---- Footer --------------------------------------------------------------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 64px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; margin-bottom: 48px; }
.footer-brand .brand { margin-bottom: 16px; }
.footer-brand p { color: var(--text-secondary); font-size: 0.9375rem; max-width: 34ch; }
.footer-col h4 { font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 16px; font-weight: 500; }
.footer-col a { display: block; color: var(--text); font-size: 0.9375rem; padding: 6px 0; }
.footer-col a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding-top: 24px; border-top: 1px solid var(--border); }
.footer-bottom p { font-size: 0.8125rem; color: var(--text-placeholder); font-family: 'IBM Plex Mono', monospace; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
  .grid--3 { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: 32px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .product { grid-template-columns: 1fr; gap: 24px; padding: 28px; }
  .section { padding: 72px 0; }
}
@media (max-width: 640px) {
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px; transform: translateY(-120%); transition: transform .3s var(--ease);
    box-shadow: var(--shadow);
  }
  .main-nav.is-open { transform: translateY(0); }
  .nav-link { padding: 14px 16px; }
  .nav-link::after { display: none; }
  .nav-toggle { display: inline-flex; }
  .hero { padding: 64px 0 56px; }
  .cta-band .inner { flex-direction: column; align-items: flex-start; }
}

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .stagger > * { opacity: 1; transform: none; }
}
