/* =========================================================================
   xapplab home: clean white, cobalt accent, and a mark built from app tiles.
   Motion lives in home.js; without it every section is complete and static.
   ========================================================================= */

.home { overflow-x: clip; }
.home .btn { border-radius: 99px; }
.home .btn-primary { box-shadow: 0 8px 24px rgba(46, 68, 255, 0.24); }
.home .btn-lg { --btn-pad-y: 18px; --btn-pad-x: 32px; font-size: 17px; }

.home h1 em,
.home h2 em {
  font-style: normal;
  color: var(--accent);
}

.home .lede {
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1.6;
}

/* SplitText masks */
.home .wd { white-space: nowrap; }

/* ---------------------------------------------------------------------- */
/* 1. Hero                                                                 */
/* ---------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: center;
  padding: 56px 0 96px;
}

.hero-grid {
  width: 100%;
  display: grid;
  gap: 56px;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 40px; }
}

.hero h1 {
  margin-top: 22px;
  font-size: clamp(46px, 6vw, 86px);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero .lede { margin-top: 28px; max-width: 44ch; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-stats {
  display: flex;
  gap: clamp(28px, 5vw, 56px);
  margin: 52px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.hero-stats dt {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stats dd {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* The bench: a 3 by 3 grid where the apps form the xapplab X. */
.bench-wrap {
  position: relative;
  display: grid;
  place-items: center;
  perspective: 1400px;
}

.bench-wrap::before {
  content: "";
  position: absolute;
  inset: -12% -20%;
  background-image:
    linear-gradient(rgba(17, 19, 24, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 19, 24, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
  mask-image: radial-gradient(closest-side, #000, transparent);
  pointer-events: none;
}

.bench-wrap::after {
  content: "";
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(46, 68, 255, 0.16), transparent);
  filter: blur(10px);
  pointer-events: none;
}

.bench {
  --t: clamp(86px, 11vw, 136px);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, var(--t));
  grid-template-rows: repeat(3, var(--t));
  gap: calc(var(--t) * 0.14);
  transform-style: preserve-3d;
}

.tile {
  position: relative;
  grid-column: calc(var(--x) + 1);
  grid-row: calc(var(--y) + 1);
  display: grid;
  place-items: center;
  border-radius: 23%;
  transform-style: preserve-3d;
}

.tile-app img {
  width: 100%;
  height: 100%;
  border-radius: 23%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 24px 48px -12px rgba(17, 19, 24, 0.28);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.tile-app:hover img {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 32px 60px -14px rgba(17, 19, 24, 0.35);
}

.tile-slot {
  border: 1.5px dashed rgba(17, 19, 24, 0.14);
}

.tile-core {
  background: linear-gradient(145deg, #4a5dff, var(--accent) 55%, #1f30d6);
  box-shadow: 0 24px 50px -12px rgba(46, 68, 255, 0.55), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.tile-core svg { width: 44%; fill: #fff; }

.tile-next {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 16px 36px -16px rgba(17, 19, 24, 0.2);
}

.tile-next b {
  font-family: var(--font-display);
  font-size: calc(var(--t) * 0.34);
  font-weight: 500;
  color: var(--text-faint);
}

.tile-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
}

.tile:hover .tile-label { opacity: 1; transform: translate(-50%, 0); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.scroll-cue::after {
  content: "";
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--text-faint), transparent);
  animation: cue 2.2s var(--ease) infinite;
  transform-origin: top;
}

@keyframes cue {
  0% { transform: scaleY(0); }
  50% { transform: scaleY(1); }
  100% { transform: scaleY(1); opacity: 0; }
}

@media (max-height: 720px), (max-width: 959px) { .scroll-cue { display: none; } }

/* ---------------------------------------------------------------------- */
/* 2. Marquee                                                              */
/* ---------------------------------------------------------------------- */

.marquee {
  padding: 40px 0;
  border-block: 1px solid var(--border);
  background: var(--bg-soft);
  overflow: hidden;
}

.marquee-row { display: flex; width: max-content; }
.marquee-row + .marquee-row { margin-top: 8px; }

.marquee-track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.6em;
  padding-right: 0.6em;
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 72px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.04em;
  white-space: nowrap;
  animation: marquee 48s linear infinite;
}

.marquee-row.is-reverse .marquee-track {
  font-weight: 500;
  color: var(--text-faint);
  animation-direction: reverse;
}

.marquee-track i {
  width: 0.36em;
  height: 0.36em;
  border-radius: 23%;
  background: var(--accent);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.marquee-row.is-reverse .marquee-track i { background: var(--text-faint); }

@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------------------------------------------------------------------- */
/* 3. Apps                                                                 */
/* ---------------------------------------------------------------------- */

.apps { padding: 120px 0 80px; }

.section-intro { max-width: 720px; margin-bottom: 56px; }

.section-intro h2,
.how-side h2 {
  margin-top: 16px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.chapter {
  position: relative;
  display: grid;
  gap: 40px;
  align-items: center;
  margin-top: 28px;
  padding: clamp(28px, 5vw, 64px);
  border-radius: 32px;
  overflow: hidden;
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

@media (min-width: 900px) {
  .chapter { grid-template-columns: 1fr 1fr; min-height: 520px; }
}

a.chapter:hover { transform: translateY(-4px); box-shadow: 0 40px 80px -30px rgba(17, 19, 24, 0.35); }

.chapter-head { display: flex; align-items: center; gap: 18px; }
.chapter-head img { width: 64px; height: 64px; border-radius: 23%; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.3); }
.chapter-head h3 { font-size: 34px; letter-spacing: -0.04em; }

.chip {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid currentColor;
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.7;
}

.chapter-line {
  margin-top: 30px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.chapter-copy > p:not(.chapter-line) { margin-top: 16px; max-width: 44ch; font-size: 16.5px; opacity: 0.78; }

.chapter-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

.chapter-tags li {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.5);
}

.chapter-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  font-weight: 600;
}

.chapter-cta svg { transition: transform 0.4s var(--ease); }
a.chapter:hover .chapter-cta svg { transform: translateX(5px); }

.chapter-visual { display: grid; place-items: center; }

/* NoteCast: the app's warm cream */
.chapter--notecast {
  color: #241a10;
  background:
    radial-gradient(60% 80% at 85% 30%, rgba(255, 255, 255, 0.7), transparent),
    linear-gradient(135deg, #fbf4e6, #f2e0c0);
}

.nc-card {
  width: min(400px, 100%);
  padding: 22px;
  border-radius: 24px;
  background: #fffdf9;
  box-shadow: 0 30px 60px -24px rgba(80, 52, 20, 0.35), 0 0 0 1px rgba(36, 26, 16, 0.05);
}

.nc-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(36, 26, 16, 0.6); }
.nc-top b { color: #241a10; font-weight: 600; }
.nc-top em { margin-left: auto; font-style: normal; font-variant-numeric: tabular-nums; }

.nc-rec {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e5484d;
  box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5);
  animation: rec 1.6s ease-out infinite;
}

@keyframes rec { to { box-shadow: 0 0 0 9px rgba(229, 72, 77, 0); } }

.nc-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 64px;
  margin: 18px 0;
}

.nc-wave i {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(#e9c88f, #c99a55);
  transform: scaleY(0.25);
  animation: wave 1.1s ease-in-out infinite alternate;
}

.nc-wave i:nth-child(3n) { animation-duration: 0.8s; }
.nc-wave i:nth-child(3n + 1) { animation-duration: 1.3s; animation-delay: -0.4s; }
.nc-wave i:nth-child(4n) { animation-delay: -0.7s; }
.nc-wave i:nth-child(5n + 2) { animation-duration: 0.95s; animation-delay: -0.2s; }

@keyframes wave {
  from { transform: scaleY(0.15); }
  to { transform: scaleY(0.95); }
}

.nc-lines p { font-size: 14.5px; line-height: 1.55; color: rgba(36, 26, 16, 0.8); min-height: 3.1em; }
.nc-lines p + p { margin-top: 8px; }

.nc-summary {
  display: grid;
  gap: 2px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8ecd6;
  font-size: 13.5px;
}

.nc-summary b { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(36, 26, 16, 0.55); }

/* Sabbaha: the app's emerald and gold */
.chapter--sabbaha {
  color: #f6efdc;
  background:
    radial-gradient(50% 70% at 75% 40%, rgba(222, 186, 115, 0.16), transparent),
    linear-gradient(160deg, #0f4d40, #082621 55%, #03120f);
}

.chapter--sabbaha .chapter-tags li { background: rgba(222, 186, 115, 0.12); color: #fae6ad; }
.chapter--sabbaha .chip { color: #deba73; }
.chapter--sabbaha .chapter-line { color: #fae6ad; }

.sb-dial {
  position: relative;
  width: min(300px, 70vw);
  aspect-ratio: 1;
  filter: drop-shadow(0 0 30px rgba(222, 186, 115, 0.2));
}

.sb-dial svg { position: absolute; inset: 0; }

.sb-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.sb-center .ar { font-family: "Amiri", "Geeza Pro", serif; font-size: 26px; color: #deba73; direction: rtl; }
.sb-center b { font-family: var(--font-display); font-size: 76px; font-weight: 600; line-height: 1; color: #fae6ad; font-variant-numeric: tabular-nums; }
.sb-center small { margin-top: 6px; font-size: 14px; color: rgba(204, 224, 217, 0.6); }

/* The next one */
.chapter--next {
  min-height: 0;
  border: 1.5px dashed var(--border-strong);
  color: var(--text);
}

@media (min-width: 900px) { .chapter--next { grid-template-columns: 1fr; } }
.chapter--next .chapter-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 40px; }
.chapter--next .chapter-copy > p:not(.chapter-line) { margin-top: 0; color: var(--text-dim); opacity: 1; }

.next-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 23%;
  border: 1.5px dashed var(--border-strong);
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--text-faint);
}

/* ---------------------------------------------------------------------- */
/* 4. How we work                                                          */
/* ---------------------------------------------------------------------- */

.how { padding: 80px 0 40px; }

.how-inner { display: grid; gap: 40px; }

@media (min-width: 900px) {
  .how-inner { grid-template-columns: 1fr 1fr; gap: 80px; }
  .how-side { position: sticky; top: 120px; align-self: start; }
}

.how-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 40px;
  font-family: var(--font-display);
  line-height: 1;
}

.how-count span {
  font-size: clamp(90px, 12vw, 160px);
  font-weight: 600;
  letter-spacing: -0.05em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.how-count small { font-size: 24px; color: var(--text-faint); }

.how-bar {
  width: min(320px, 100%);
  height: 3px;
  margin-top: 20px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.how-bar i {
  display: block;
  width: 33.33%;
  height: 100%;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}

.how-count, .how-bar { display: none; }

@media (min-width: 900px) {
  .how-count { display: flex; }
  .how-bar { display: block; }
  .how-step { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; }
}

.how-steps { counter-reset: none; }

.how-step { padding: 28px 0; border-top: 1px solid var(--border); }
.how-step:first-child { border-top: 0; }

.how-index {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.how-step h3 {
  margin-top: 14px;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -0.04em;
}

.how-step p { margin-top: 16px; max-width: 42ch; font-size: 18px; color: var(--text-dim); }

/* With motion on, the step you're reading is lit and the others wait. */
.has-motion .how-step { transition: opacity 0.6s var(--ease); }
@media (min-width: 900px) {
  .has-motion .how-step:not(.is-active) { opacity: 0.22; }
}

/* ---------------------------------------------------------------------- */
/* 5. About                                                                */
/* ---------------------------------------------------------------------- */

.about { padding: 100px 0; }

.statement {
  margin-top: 24px;
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 66px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.facts {
  display: grid;
  gap: 16px;
  margin-top: 72px;
}

@media (min-width: 820px) { .facts { grid-template-columns: repeat(3, 1fr); } }

.fact {
  padding: 28px;
  border-radius: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.fact-tile {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 23%;
  background: var(--accent);
  transform: rotate(45deg);
}

.fact h4 { margin-top: 22px; font-size: 22px; letter-spacing: -0.01em; }
.fact p { margin-top: 10px; font-size: 15px; color: var(--text-dim); }

/* ---------------------------------------------------------------------- */
/* 6. Contact                                                              */
/* ---------------------------------------------------------------------- */

.contact {
  position: relative;
  padding: 120px 0 140px;
  text-align: center;
  overflow: hidden;
}

.contact::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(900px, 120vw);
  aspect-ratio: 1.6;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(46, 68, 255, 0.12), transparent);
  pointer-events: none;
}

.contact-inner { position: relative; display: grid; justify-items: center; }

.contact-mark { width: 84px; height: 84px; margin-bottom: 36px; fill: var(--text); overflow: visible; }
.contact-mark .lm-core { fill: var(--accent); }
.contact-mark rect { transform-box: fill-box; transform-origin: center; }

.contact .eyebrow::before { display: none; }

.contact h2 {
  margin-top: 18px;
  max-width: 16ch;
  font-size: clamp(38px, 6vw, 80px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.contact .lede { margin: 26px 0 40px; }

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

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .nc-wave i, .nc-rec, .scroll-cue::after { animation: none; }
  .nc-wave i { transform: scaleY(0.6); }
}

/* Contact routes: one card per team. */
.contact-grid {
  display: grid;
  gap: 16px;
  width: 100%;
  margin-top: 8px;
  text-align: left;
}

@media (min-width: 820px) { .contact-grid { grid-template-columns: repeat(3, 1fr); } }

.contact-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border-radius: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(17, 19, 24, 0.04);
  transition: transform 0.5s var(--ease), border-color 0.3s var(--ease), box-shadow 0.5s var(--ease);
}

.contact-card:hover {
  transform: translateY(-4px);
  border-color: rgba(46, 68, 255, 0.35);
  box-shadow: 0 24px 50px -24px rgba(46, 68, 255, 0.35);
}

.contact-kind { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.contact-card p { margin-top: 10px; font-size: 15px; color: var(--text-dim); flex: 1; }

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent);
}

.contact-link svg { transition: transform 0.4s var(--ease); }
.contact-card:hover .contact-link svg { transform: translateX(4px); }
