/* ==========================================================================
   081 · KAI MORENO (رامي كنعان · مختبر التفاعل) — 1:1 Creative Technologist & GLSL Lab
   #050505 void · #EDEFF2 crisp ink · #C9CDD2 liquid chrome · #C6FF3D acid lime · Reticle HUD
   ========================================================================== */

:root {
  --km-bg: #050505;
  --km-fg: #EDEFF2;
  --km-chrome: #C9CDD2;
  --km-lime: #C6FF3D;
  --km-line: rgba(237, 239, 242, 0.11);
  --km-mut: rgba(237, 239, 242, 0.62);
  --km-sans: 'IBM Plex Sans Arabic', 'Readex Pro', system-ui, sans-serif;
  --km-display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --km-mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
  background: var(--km-bg);
  color: var(--km-fg);
  font-family: var(--km-sans);
  letter-spacing: 0;
}

body {
  background: var(--km-bg);
  color: var(--km-fg);
  font-family: var(--km-sans);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; letter-spacing: 0; }
.bidi { unicode-bidi: isolate; font-family: var(--km-mono); }

/* Difference Cursor Ring */
.km-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--km-lime);
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 120;
  transform: translate(-50%, -50%);
  transition: width 0.18s ease, height 0.18s ease, opacity 0.2s ease;
  opacity: 0;
}

@media (hover: hover) {
  .km-cursor.on { opacity: 1; }
}

/* ======================== FIXED MINIMAL NAVBAR ======================== */
.km-header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 70;
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(5, 5, 5, 0.76);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--km-line);
}

.km-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.km-sphere {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #FFFFFF, #9CA3AF 52%, #18181B 88%);
  box-shadow: 0 0 12px rgba(198, 255, 61, 0.35);
}

.km-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--km-chrome);
  white-space: nowrap;
}

.km-nav a:hover { color: var(--km-lime); }

.km-nav-end {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.km-avail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid rgba(198, 255, 61, 0.35);
  border-radius: 999px;
  font-family: var(--km-mono);
  font-size: 11px;
  color: var(--km-lime);
}

.km-avail i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--km-lime);
  box-shadow: 0 0 10px var(--km-lime);
}

.km-btn-lime {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--km-lime);
  color: #050505;
  font-weight: 800;
  font-size: 13px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.km-btn-lime:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(198, 255, 61, 0.42);
}

.km-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--km-line);
  color: var(--km-fg);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.km-btn-ghost:hover { border-color: var(--km-lime); color: var(--km-lime); }

/* ======================== 1. HERO (100dvh RETICLE CHROME STAGE) ======================== */
.km-hero {
  position: relative;
  min-height: 100dvh;
  padding: 88px 28px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--km-line);
}

.km-reticle-frame {
  position: relative;
  flex: 1;
  min-height: 510px;
  border: 1px dashed rgba(198, 255, 61, 0.34);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 36px;
  background: #070809;
}

.km-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--km-lime);
  border-style: solid;
  z-index: 4;
  pointer-events: none;
}
.km-corner.tl { top: 10px; left: 10px; border-width: 2px 0 0 2px; }
.km-corner.tr { top: 10px; right: 10px; border-width: 2px 2px 0 0; }
.km-corner.bl { bottom: 10px; left: 10px; border-width: 0 0 2px 2px; }
.km-corner.br { bottom: 10px; right: 10px; border-width: 0 2px 2px 0; }

.km-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.76;
  z-index: 0;
}

.km-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.km-hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(5,5,5,0.28) 0%, rgba(5,5,5,0.12) 42%, rgba(5,5,5,0.88) 100%);
  pointer-events: none;
}

.km-hero-copy {
  position: relative;
  z-index: 5;
  max-width: 760px;
}

.km-kicker {
  font-family: var(--km-mono);
  font-size: 11.5px;
  color: var(--km-lime);
  margin-bottom: 12px;
  display: inline-block;
}

.km-h1 {
  font-family: var(--km-display);
  font-size: clamp(2.15rem, 4.3vw, 3.85rem);
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 14px;
}

.km-h1 em {
  font-style: normal;
  color: var(--km-lime);
}

.km-lead {
  max-width: 600px;
  color: var(--km-chrome);
  font-size: 15.5px;
  margin-bottom: 22px;
}

/* Bottom 4-Stat HUD + Live Telemetry */
.km-hud-bar {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--km-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.km-hud-stats {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.km-hud-stat strong {
  font-family: var(--km-mono);
  font-size: 18px;
  color: var(--km-lime);
  margin-inline-end: 6px;
}

.km-hud-stat span {
  font-size: 12.5px;
  color: var(--km-mut);
}

.km-telemetry {
  font-family: var(--km-mono);
  font-size: 11.5px;
  color: var(--km-chrome);
  display: flex;
  gap: 18px;
}

/* ======================== 2. WORK INDEX + RGB SCANLINE PREVIEW ======================== */
.km-section {
  max-width: 1260px;
  margin: 0 auto;
  padding: 92px 28px;
  border-bottom: 1px solid var(--km-line);
}

.km-sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.km-h2 {
  font-family: var(--km-display);
  font-size: clamp(1.85rem, 3.1vw, 2.7rem);
  font-weight: 700;
}

.km-work-stage {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 32px;
  align-items: center;
}

.km-work-list {
  border-top: 1px solid var(--km-line);
}

.km-work-list:hover .km-work-row {
  opacity: 0.36;
}

.km-work-list .km-work-row:hover,
.km-work-list .km-work-row.active {
  opacity: 1;
}

.km-work-row {
  padding: 22px 12px;
  border-bottom: 1px solid var(--km-line);
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: opacity 0.22s ease, padding-inline-start 0.22s ease;
}

.km-work-row:hover,
.km-work-row.active {
  padding-inline-start: 22px;
}

.km-work-idx {
  font-family: var(--km-mono);
  font-size: 13px;
  color: var(--km-lime);
}

.km-work-title {
  font-size: 20px;
  font-weight: 700;
}

.km-work-meta {
  font-family: var(--km-mono);
  font-size: 11.5px;
  color: var(--km-mut);
}

/* 4:3 RGB Scanline Preview Box */
.km-preview-box {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(198, 255, 61, 0.45);
  border-radius: 8px;
  overflow: hidden;
  background: #0B0D10;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.km-preview-box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  pointer-events: none;
}

.km-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.km-preview-caption {
  position: relative;
  z-index: 2;
  background: rgba(5, 5, 5, 0.8);
  border: 1px solid var(--km-line);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}

/* ======================== 3. SERVICES (3D METALLIC STAGES) ======================== */
.km-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.km-svc-card {
  border: 1px solid var(--km-line);
  background: #090A0C;
  border-radius: 10px;
  padding: 26px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.km-svc-card:hover {
  border-color: var(--km-lime);
  transform: translateY(-4px);
}

.km-orbital-stage {
  position: relative;
  height: 170px;
  margin-bottom: 20px;
  border: 1px solid var(--km-line);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 50%, rgba(201, 205, 210, 0.12), #050505 72%);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 600px;
  overflow: hidden;
}

.km-orbit-ring {
  position: absolute;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: 1.5px solid rgba(198, 255, 61, 0.55);
  transform: rotateX(74deg) rotateZ(18deg);
  animation: kmSpinRing 9s linear infinite;
}

@keyframes kmSpinRing {
  from { transform: rotateX(74deg) rotateZ(0deg); }
  to { transform: rotateX(74deg) rotateZ(360deg); }
}

.km-metal-shape {
  width: 66px;
  height: 66px;
  background: linear-gradient(135deg, #FFFFFF 0%, #9CA3AF 46%, #1F2937 82%, #C6FF3D 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.35s ease;
}

.km-metal-shape.cube { border-radius: 12px; transform: rotate(24deg); }
.km-metal-shape.sphere { border-radius: 50%; }
.km-metal-shape.torus {
  border-radius: 50%;
  background: transparent;
  border: 15px solid #D1D5DB;
  box-shadow: inset 0 0 12px #050505, 0 0 22px rgba(198, 255, 61, 0.25);
}

.km-svc-card:hover .km-metal-shape {
  transform: scale(1.12) rotate(-14deg);
}

/* Sprint Estimator Strip */
.km-est-strip {
  margin-top: 34px;
  border: 1px solid var(--km-line);
  border-radius: 10px;
  padding: 24px 28px;
  background: #08090B;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: center;
}

/* ======================== 4. ABOUT (3:4 LIME-BRACKETED PORTRAIT + 2x2 TABLE) ======================== */
.km-about-grid {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: 42px;
  align-items: center;
}

.km-portrait-frame {
  position: relative;
  aspect-ratio: 3 / 3.7;
  border: 1px solid var(--km-line);
  padding: 14px;
  background: #090A0D;
}

.km-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.18);
}

.km-meta-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--km-line);
  border-inline-start: 1px solid var(--km-line);
  margin-top: 24px;
}

.km-meta-cell {
  padding: 18px 20px;
  border-bottom: 1px solid var(--km-line);
  border-inline-end: 1px solid var(--km-line);
}

.km-meta-cell span {
  display: block;
  font-family: var(--km-mono);
  font-size: 11px;
  color: var(--km-lime);
  margin-bottom: 4px;
}

/* ======================== 5. CONTACT BAND + METALLIC WORDMARK FOOTER ======================== */
.km-contact-band {
  max-width: 1260px;
  margin: 0 auto;
  padding: 96px 28px;
  text-align: center;
  border-bottom: 1px solid var(--km-line);
}

.km-copy-email {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 30px;
  border: 1px dashed var(--km-lime);
  border-radius: 999px;
  background: rgba(198, 255, 61, 0.05);
  color: var(--km-fg);
  font-family: var(--km-mono);
  font-size: clamp(1.05rem, 2.4vw, 1.85rem);
  cursor: pointer;
}

.km-copy-email:hover {
  background: var(--km-lime);
  color: #050505;
}

.km-footer {
  max-width: 1260px;
  margin: 0 auto;
  padding: 48px 28px 36px;
}

.km-chrome-wordmark {
  font-family: var(--km-mono);
  font-size: clamp(3rem, 11vw, 8.8rem);
  font-weight: 800;
  text-align: center;
  line-height: 0.95;
  background: linear-gradient(180deg, #FFFFFF 0%, #9CA3AF 52%, #27272A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 18px 0 32px;
  direction: ltr;
}

.km-showcase-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--km-line);
  font-size: 13px;
}

@media (max-width: 720px) {
  .km-nav, .km-avail { display: none; }
  .km-work-stage,
  .km-services-grid,
  .km-est-strip,
  .km-about-grid {
    grid-template-columns: 1fr;
  }
}
