/* ==========================================================================
   Aritrem — global styles
   ========================================================================== */

:root {
  --bg: #000;
  --bg-2: #0d0d0f;
  --card: #161617;
  --fg: #f5f5f7;
  --muted: #86868b;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #2997ff;
  --accent-2: #a78bfa;
  --light-bg: #f5f5f7;
  --light-fg: #1d1d1f;
  --light-muted: #6e6e73;
  --nav-h: 52px;
  --gutter: clamp(20px, 5vw, 48px);
  --maxw: 1120px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
body.lock { overflow: hidden; }

img, svg { display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 8px; }

/* ---------- Typography ---------- */

.eyebrow {
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.h1 {
  font-size: clamp(48px, 10vw, 128px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
}
.h2 {
  font-size: clamp(36px, 6.4vw, 80px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.lead {
  font-size: clamp(19px, 2.1vw, 26px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--muted);
}
.grad {
  background: linear-gradient(100deg, #8fd0ff 0%, var(--accent) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff;
  font-size: 17px; font-weight: 500;
  padding: 15px 30px; border-radius: 999px;
  text-decoration: none;
  transition: background 0.25s, transform 0.25s var(--ease);
}
.btn:hover { background: #0077ed; transform: scale(1.03); }
.btn svg { width: 18px; height: 18px; }
.link-arrow { color: var(--accent); text-decoration: none; font-size: 19px; }
.link-arrow:hover { text-decoration: underline; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed; inset: 0 0 auto; z-index: 100;
  height: var(--nav-h);
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); height: 100%; margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-logo { color: #fff; display: block; }
.nav-logo svg { height: 17px; width: auto; }
.nav-menu { display: flex; align-items: center; gap: 36px; }
.nav-links { display: flex; gap: 32px; list-style: none; font-size: 13px; }
.nav-links a { color: rgba(245, 245, 247, 0.8); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: #fff; }

.lang { display: flex; gap: 2px; font-size: 12px; font-weight: 600; }
.lang a {
  padding: 4px 9px; border-radius: 999px;
  color: var(--muted); text-decoration: none; transition: color 0.2s, background 0.2s;
}
.lang a:hover { color: #fff; }
.lang a[aria-current="true"] { color: #fff; background: rgba(255, 255, 255, 0.14); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px; margin-right: -12px;
  background: none; border: 0; cursor: pointer; position: relative;
}
.nav-toggle span {
  position: absolute; left: 13px; width: 18px; height: 1.5px; background: #fff;
  transition: transform 0.35s var(--ease);
}
.nav-toggle span:first-child { top: 18px; }
.nav-toggle span:last-child { top: 25px; }
.nav.open .nav-toggle span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav.open .nav-toggle span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  /* .nav's backdrop-filter makes it the containing block, so position relative to it. */
  .nav-menu {
    position: absolute; top: 100%; left: 0; right: 0;
    height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h));
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 32px;
    padding: 24px var(--gutter) 40px;
    background: rgba(0, 0, 0, 0.96);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
  }
  .nav.open .nav-menu { opacity: 1; visibility: visible; transform: none; }
  .nav-links { flex-direction: column; gap: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
  .nav-links a { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--fg); }
  .lang { font-size: 15px; }
  .lang a { padding: 8px 16px; }
}

/* ---------- Scroll scenes (sticky) ---------- */

.scene { position: relative; }
.sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Hero ---------- */

.hero { height: 220vh; }
.hero .glow {
  position: absolute; left: 50%; top: 50%;
  width: 140vmax; height: 140vmax; margin: -70vmax 0 0 -70vmax;
  background: radial-gradient(closest-side, rgba(41, 151, 255, 0.22), rgba(167, 139, 250, 0.08) 45%, transparent 70%);
  pointer-events: none;
}
.hero-brand {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(20px, 3vw, 36px);
  padding: 0 var(--gutter);
}
.hero-logo { width: min(80vw, 860px); color: #fff; overflow: visible; }
.hero-logo use {
  opacity: 0;
  transform: translateY(700px);
  animation: letterIn 1.4s var(--ease) forwards;
}
.hero-logo use:nth-child(2) { animation-delay: 0.07s; }
.hero-logo use:nth-child(3) { animation-delay: 0.14s; }
.hero-logo use:nth-child(4) { animation-delay: 0.21s; }
.hero-logo use:nth-child(5) { animation-delay: 0.28s; }
.hero-logo use:nth-child(6) { animation-delay: 0.35s; }
.hero-logo use:nth-child(7) { animation-delay: 0.42s; }
@keyframes letterIn { to { opacity: 1; transform: none; } }

.hero-tag { animation: fadeUp 1.2s var(--ease) 0.8s backwards; text-align: center; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.hero-copy {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  text-align: center; padding: 0 var(--gutter);
  opacity: 0;
}
.hero-copy .lead { max-width: 640px; }

.scroll-hint {
  position: absolute; bottom: max(28px, 4svh); left: 0; right: 0; margin: 0 auto; width: max-content;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  padding-left: 0.12em;
  animation: fadeUp 1s var(--ease) 1.4s backwards;
}
.scroll-hint i {
  display: block; width: 1px; height: 40px;
  background: linear-gradient(var(--muted), transparent);
  transform-origin: top; animation: hint 2s ease-in-out infinite;
  margin-right: 0.12em; /* offsets the padding above so the line sits under the text centre */
}
@keyframes hint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- Chip scene ---------- */

.chip-scene { height: 520vh; }
.chip-scene .sticky {
  background:
    radial-gradient(ellipse at center, transparent 30%, var(--bg) 75%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
.chip-head {
  position: absolute; top: calc(var(--nav-h) + 5svh); left: 0; right: 0;
  text-align: center; padding: 0 var(--gutter); z-index: 2;
}
.chip-head .eyebrow { margin-bottom: 10px; }
.chip-svg {
  width: min(92vw, 68svh);
  height: auto;
  overflow: visible;
  transform-origin: 50% 50%;
}
.chip-caps {
  position: absolute; left: 0; right: 0; bottom: max(36px, 7svh);
  height: 130px; z-index: 2;
}
.cap {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 0 var(--gutter);
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.cap.on { opacity: 1; transform: none; }
.cap h3 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.03em; }
.cap p { color: var(--muted); max-width: 520px; font-size: clamp(16px, 1.6vw, 19px); }
.chip-dots {
  position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 2;
}
.chip-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); transition: background 0.4s, transform 0.4s; }
.chip-dots span.on { background: #fff; transform: scale(1.4); }

/* SVG parts */
.trace { fill: none; stroke: #3a3a3e; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.8s; }
.via { fill: var(--bg); stroke: #3a3a3e; stroke-width: 3; transition: stroke 0.8s; }
.pulse {
  fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 0.07 1.3; opacity: 0;
  transition: opacity 0.8s;
  animation: pulse 2.6s linear infinite;
}
@keyframes pulse { from { stroke-dashoffset: 1.37; } to { stroke-dashoffset: 0; } }
.pin { fill: #5a5a5f; transition: fill 0.8s; }
.die-label { color: #8e8e93; transition: color 0.8s; }
.powered .trace, .powered .via { stroke: #4a4a50; }
.powered .pulse { opacity: 1; }
.powered .pin { fill: #c9a85a; }
.powered .die-label { color: #fff; }
.code { font-family: var(--mono); font-size: 9.6px; white-space: pre; }
.code .k { fill: #ff7ab2; }
.code .f { fill: #6bc1ff; }
.code .s { fill: #fc9d6a; }
.code .c { fill: #6c7986; }
.code .t { fill: #e5e5ea; }

/* ---------- Statement (word highlight) ---------- */

.statement { height: 260vh; }
.statement .sticky { padding: 0 var(--gutter); }
.statement-text {
  max-width: 1000px;
  font-size: clamp(30px, 4.8vw, 60px);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.12;
}
.statement-text span { color: rgba(245, 245, 247, 0.16); transition: color 0.15s linear; }

/* ---------- Generic sections ---------- */

.section { padding: clamp(96px, 14vw, 180px) var(--gutter); }
.container { max-width: var(--maxw); margin: 0 auto; }
.section-head { max-width: 760px; margin-bottom: clamp(48px, 7vw, 88px); }
.section-head .eyebrow { margin-bottom: 14px; }
.section-head .lead { margin-top: 22px; }

.light { background: var(--light-bg); color: var(--light-fg); }
.light .eyebrow, .light .lead { color: var(--light-muted); }

/* Services grid */
.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.card {
  background: #fff; border-radius: 28px;
  padding: clamp(28px, 3vw, 40px);
  min-height: 280px;
  display: flex; flex-direction: column;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.card:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.08); }
.card .ico {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: auto;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(41, 151, 255, 0.14), rgba(167, 139, 250, 0.14));
  color: #0071e3;
}
.card .ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.card h3 { margin-top: 48px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.card p { margin-top: 10px; color: var(--light-muted); }

/* Reveal on scroll */
.reveal {
  opacity: 0; transform: translateY(48px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Process (horizontal scroll) ---------- */

.process { height: 400vh; }
.process .sticky { flex-direction: column; align-items: stretch; justify-content: center; gap: clamp(32px, 6svh, 64px); }
.process-head { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.process-head .eyebrow { margin-bottom: 12px; }
.track-wrap { width: 100%; }
.track {
  display: flex; gap: 20px;
  padding: 0 max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  width: max-content;
  will-change: transform;
}
.step {
  width: min(80vw, 440px);
  min-height: min(48svh, 440px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(28px, 3.4vw, 44px);
  display: flex; flex-direction: column;
}
.step .num { font-size: clamp(56px, 7vw, 88px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.step h3 { margin-top: auto; padding-top: 40px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; letter-spacing: -0.02em; }
.step p { margin-top: 10px; color: var(--muted); }
.progress {
  width: min(240px, 50vw); height: 2px; margin: 0 auto;
  background: rgba(255, 255, 255, 0.14); border-radius: 2px; overflow: hidden;
}
.progress i { display: block; height: 100%; background: var(--fg); transform-origin: left; transform: scaleX(0); }

/* ---------- CTA ---------- */

.cta { text-align: center; padding-top: clamp(120px, 18vw, 220px); padding-bottom: clamp(120px, 18vw, 220px); position: relative; overflow: hidden; }
.cta::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; margin: -450px 0 0 -450px;
  background: radial-gradient(closest-side, rgba(41, 151, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.cta .container { position: relative; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.cta .lead { max-width: 560px; }
.cta-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 20px 32px; margin-top: 12px; }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--line); padding: 40px var(--gutter) 48px; font-size: 13px; color: var(--muted); }
.footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.footer-logo { color: #fff; }
.footer-logo svg { height: 15px; width: auto; }

/* ---------- Hero actions & nav behaviour ---------- */

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 28px; margin-top: 8px; }
.nav { transition: transform 0.45s var(--ease); }
.nav.hidden { transform: translateY(-100%); }
.nav-links a.active { color: #fff; }

/* ---------- Why Aritrem (bento) ---------- */

.why { background: var(--bg); }
.bento { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.tile {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  padding: clamp(28px, 3vw, 40px); min-height: 260px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.tile h3 { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.tile p { margin-top: 10px; color: var(--muted); max-width: 520px; }
.tile-lg { grid-column: span 2; grid-row: span 2; min-height: 560px; }
.tile-wide { grid-column: 1 / -1; min-height: 200px; }

/* Cursor-following glow */
.spot::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(41, 151, 255, 0.16), transparent 60%);
  opacity: 0; transition: opacity 0.4s;
}
.spot:hover::before { opacity: 1; }

/* Exploded hardware / firmware / software stack */
.stack {
  position: absolute; top: 4%; left: 50%;
  width: min(58%, 340px); aspect-ratio: 1;
  transform: translateX(-50%);
  perspective: 1400px;
}
.layer {
  --z: 0px;
  position: absolute; inset: 0; border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform: rotateX(58deg) rotateZ(-45deg) translateZ(var(--z));
  transition: transform 1.4s var(--ease), box-shadow 1.4s var(--ease);
}
.layer span {
  position: absolute; left: 22px; bottom: 18px;
  font-size: 15px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.l1 { background: linear-gradient(135deg, rgba(167, 139, 250, 0.35), rgba(167, 139, 250, 0.08)); }
.l2 { background: linear-gradient(135deg, rgba(41, 151, 255, 0.35), rgba(41, 151, 255, 0.08)); }
.l3 { background: linear-gradient(135deg, rgba(143, 208, 255, 0.4), rgba(143, 208, 255, 0.1)); }
.tile.in .l1 { --z: -70px; transition-delay: 0.2s; }
.tile.in .l3 { --z: 70px; transition-delay: 0.2s; }
.tile.in:hover .l1 { --z: -105px; transition-delay: 0s; }
.tile.in:hover .l3 { --z: 105px; transition-delay: 0s; }
.tile.in .layer { box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45); }

@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .tile-lg, .tile-wide { grid-column: auto; grid-row: auto; }
  .tile-lg { min-height: 500px; }
  .tile:not(.tile-lg) { min-height: 0; }
  .stack { width: min(62%, 280px); top: 7%; }
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden; padding: clamp(28px, 4vw, 44px) 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track { display: flex; width: max-content; animation: marquee 45s linear infinite; }
.marquee span {
  display: inline-flex; align-items: center; gap: clamp(28px, 4vw, 56px);
  margin-right: clamp(28px, 4vw, 56px);
  font-size: clamp(24px, 3.4vw, 44px); font-weight: 700; letter-spacing: -0.03em;
  color: #48484d; white-space: nowrap;
}
.marquee span::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.7; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Footer info ---------- */

.footer-info { display: flex; flex-direction: column; gap: 4px; }
.footer-info a { text-decoration: none; }
.footer-info a:hover { color: var(--fg); }

/* Short screens: keep the chip heading clear of the board */
@media (max-height: 720px) {
  .chip-head .eyebrow { display: none; }
  .chip-head .h2 { font-size: clamp(28px, 4.6vw, 52px); }
}

/* ---------- Mobile tweaks ---------- */

@media (max-width: 760px) {
  .chip-dots { display: none; }
  .chip-caps { height: 150px; }
  .hero { height: 200vh; }
  .chip-scene { height: 480vh; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  .pulse { display: none; }
  .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
}
