:root {
  --bg-deep: #071018;
  --bg-mid: #0c1a24;
  --ink: #e8f1f4;
  --muted: #a9c2cc;
  --line: rgba(120, 180, 200, 0.18);
  --accent: #3ecfcf;
  --accent-soft: rgba(62, 207, 207, 0.14);
  --lined: #5bb8ff;
  --dia: #7ad4a8;
  --services: #d4b87a;
  --bcut: #f08fc0;
  --mqtt: #a78bfa;
  --online: #5ddea0;
  --offline: #8a7a6a;
  --radius: 2px;
  --font: "Outfit", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  /* background theme accent — services page keeps cyan */
  --bg-accent: #3ecfcf;
  --bg-accent-rgb: 62, 207, 207;
}

/* gate homepage defaults to black */
.page-gate {
  --bg-accent: #000000;
  --bg-accent-rgb: 0, 0, 0;
  --bg-hue: 0;
  --bg-sat: 0;
  --bg-val: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-deep);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(var(--bg-accent-rgb), 0.1), transparent 55%),
    radial-gradient(900px 600px at 90% 110%, rgba(var(--bg-accent-rgb), 0.08), transparent 50%),
    linear-gradient(165deg, var(--bg-deep), var(--bg-mid) 45%, #09141c);
}

.bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* full-bleed tint that shifts with the hovered card's theme */
.bg-tint {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 600px at 50% 42%, rgba(var(--bg-accent-rgb), 0.22), transparent 60%),
    radial-gradient(1400px 800px at 80% 110%, rgba(var(--bg-accent-rgb), 0.1), transparent 65%);
  opacity: 0.6;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  opacity: 0.55;
  animation: grid-drift 28s linear infinite;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.22;
}

.orb-a {
  width: 280px;
  height: 280px;
  top: 12%;
  left: 18%;
  background: rgba(var(--bg-accent-rgb), 0.35);
  animation: float-a 12s ease-in-out infinite;
}

.orb-b {
  width: 320px;
  height: 320px;
  right: 10%;
  bottom: 8%;
  background: rgba(var(--bg-accent-rgb), 0.28);
  animation: float-b 16s ease-in-out infinite;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4.5rem);
  max-width: 1120px;
  margin: 0 auto;
}

.page-gate .stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: calc(1120px + 24.8rem);
}

.site-filing {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
  text-align: center;
}

.site-filing a {
  max-width: 100%;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-filing-police {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.site-filing-police img {
  flex: none;
}

.site-filing-police span {
  min-width: 0;
}

.site-filing a:hover,
.site-filing a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-filing a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.stage--services {
  justify-content: flex-start;
  padding-top: clamp(2.5rem, 8vw, 5rem);
  padding-bottom: 3rem;
  max-width: 980px;
}

.brand {
  margin-bottom: clamp(2.5rem, 6vw, 3.75rem);
}

.brand-mark {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: clamp(2.75rem, 8vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  line-height: 1;
  color: var(--ink);
  text-indent: 0.28em;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.svc[style*="--c"] {
  border-color: color-mix(in oklab, var(--c) 22%, var(--line));
}

.svc:hover,
.svc:focus-within {
  border-color: color-mix(in oklab, var(--c, var(--accent)) 55%, transparent);
}

.brand-mark--sm {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  margin-bottom: 1rem;
}

.headline {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.lede {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both;
}

/* —— entry cards —— */

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  perspective: 1200px;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 40%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Preserve the original five-card desktop width when adding entries. */
  flex: 0 0 auto;
  width: 11.4rem;
  max-width: 200px;
  min-width: 0;
  min-height: 250px;
  padding: 1.4rem 1.3rem 1.2rem;
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(160deg, rgba(16, 30, 40, 0.92), rgba(8, 18, 26, 0.88));
  border: 1px solid rgba(150, 200, 215, 0.14);
  overflow: hidden;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--ty, 0));
  transition:
    transform 0.28s ease-out,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  will-change: transform;
}

/* iridescent foil — themed-gradient holographic overlay, follows cursor */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    var(--g, linear-gradient(120deg,
      color-mix(in oklab, var(--c) 30%, white 8%) 0%,
      color-mix(in oklab, var(--c) 70%, black 5%) 35%,
      color-mix(in oklab, var(--c) 100%, white 18%) 55%,
      color-mix(in oklab, var(--c) 75%, black 8%) 75%,
      color-mix(in oklab, var(--c) 40%, white 12%) 100%));
  background-size: 200% 200%;
  background-position: var(--mx) var(--my);
  opacity: 0.14;
  transition: opacity 0.4s ease;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* cursor-follow light — trae-style spotlight */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: radial-gradient(
    260px circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.22),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* left accent rail */
.card-rail {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, transparent, var(--c) 30%, var(--c) 70%, transparent);
  opacity: 0.75;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

/* diagonal sheen sweep */
.card-sheen {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  transform: translateX(-130%);
  transition: transform 0.65s ease;
  mix-blend-mode: screen;
  pointer-events: none;
}

.card:hover,
.card:focus-visible {
  outline: none;
  border-color: color-mix(in oklab, var(--c) 55%, transparent);
  box-shadow:
    0 14px 40px -12px color-mix(in oklab, var(--c) 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card:hover::before {
  opacity: 0.55;
}
.card:hover::after { opacity: 1; }
.card:hover .card-rail { opacity: 1; box-shadow: 0 0 14px color-mix(in oklab, var(--c) 80%, transparent); }
.card:hover .card-sheen { transform: translateX(130%); }
.card:focus-visible::before {
  opacity: 0.55;
  background-position: 100% 100%;
}
.card:focus-visible::after { opacity: 1; }

/* —— animated entry-card icons (above the title, centered) —— */

.card-icon {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 62px;
  height: 62px;
  margin: -1.1rem auto 0.3rem;
  color: color-mix(in oklab, var(--c) 78%, white 22%);
  filter: drop-shadow(0 0 12px color-mix(in oklab, var(--c) 35%, transparent));
  pointer-events: none;
}

.card-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Lined — flowing connection between two nodes */
.card-icon--lined .nd {
  transform-box: fill-box;
  transform-origin: center;
  animation: nd-pulse 3.2s ease-in-out infinite;
}
.card-icon--lined .nd-a { animation-delay: 0s; }
.card-icon--lined .nd-b { animation-delay: 0.55s; }
.card-icon--lined .ln {
  stroke-dasharray: 40;
  stroke-dashoffset: 0;
  animation: dash-flow 3.2s linear infinite;
}
.card-icon--lined svg { animation: sway 4.5s ease-in-out infinite; }

@keyframes nd-pulse {
  0%, 100% { r: 3.2; opacity: 1; }
  50% { r: 4.3; opacity: 0.55; }
}
@keyframes dash-flow {
  to { stroke-dashoffset: -80; }
}
@keyframes sway {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}

/* Día — terminal prompt with blinking cursor */
.card-icon--dia .term {
  transform-box: fill-box;
  transform-origin: center;
  animation: term-breathe 3.6s ease-in-out infinite;
}
.card-icon--dia .prompt {
  stroke-dasharray: 12;
  stroke-dashoffset: 0;
  animation: prompt-draw 3.6s ease-in-out infinite;
}
.card-icon--dia .cursor {
  animation: cursor-blink 1s steps(2, jump-none) infinite;
}

@keyframes term-breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes prompt-draw {
  0%, 100% { stroke-dashoffset: 0; opacity: 1; }
  45%, 55% { stroke-dashoffset: -12; opacity: 0.35; }
}
@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ΩME — floating mark with a current flowing along its outline */
.card-icon--ome svg {
  transform-origin: center;
  animation: omega-float 3.6s ease-in-out infinite;
}
.card-icon--ome .omega-flow {
  stroke: #A692FF;
  stroke-dasharray: 18 82;
  animation: omega-current 2.4s linear infinite;
}

@keyframes omega-float {
  0%, 100% { transform: translateY(3px) rotate(-6deg) scale(0.98); }
  50% { transform: translateY(-3px) rotate(6deg) scale(1.08); }
}
@keyframes omega-current {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

/* BCUT Studio — pulsing play button over equalizer bars */
.card-icon--bcut .play {
  transform-box: fill-box;
  transform-origin: center;
  animation: play-pulse 2.4s ease-in-out infinite;
}
.card-icon--bcut .eq {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: eq-bounce 1.1s ease-in-out infinite;
}
.card-icon--bcut .eq-1 { animation-delay: 0s; }
.card-icon--bcut .eq-2 { animation-delay: 0.35s; }

@keyframes play-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.14); opacity: 0.8; }
}
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1); }
}

/* مُقْتَطَف — expanding concentric signal ripples */
.card-icon--mqtt .rip {
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 2.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  opacity: 0;
}
.card-icon--mqtt .rip-1 { animation-delay: 0s; }
.card-icon--mqtt .rip-2 { animation-delay: 0.42s; }
.card-icon--mqtt .rip-3 { animation-delay: 0.84s; }
.card-icon--mqtt .core {
  transform-box: fill-box;
  transform-origin: center;
  animation: core-blink 2.6s ease-in-out infinite;
}

@keyframes ripple {
  0% { transform: scale(0.9); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}
@keyframes core-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Game — a pixel monster hopping in discrete arcade steps */
.card-icon--game svg {
  animation: game-hop 1.2s steps(2, end) infinite;
}

@keyframes game-hop {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-4px); }
}

/* ॐ — server rack with blinking status dots */
.card-icon--services .d1 {
  animation: dot-blink 2.2s ease-in-out infinite;
}
.card-icon--services .d2 {
  animation: dot-blink 2.2s ease-in-out 1.1s infinite;
}
.card-icon--services svg { animation: rack-tilt 6s ease-in-out infinite; }

@keyframes dot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}
@keyframes rack-tilt {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

.card-name {
  position: relative;
  z-index: 3;
  margin-top: 0.25rem;
  width: 100%;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  color: color-mix(in oklab, var(--c) 72%, white 28%);
  text-shadow: 0 0 18px color-mix(in oklab, var(--c) 35%, transparent);
}

.card-desc {
  position: relative;
  z-index: 3;
  margin-top: 0.5rem;
  width: 100%;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.card-arrow {
  position: absolute;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 3;
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--c);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  transform: translate(5px, -3px);
}

/* —— services page —— */
.svc-list {
  display: grid;
  gap: 1rem;
}

.svc {
  position: relative;
  padding: 1.35rem 1.5rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 18, 26, 0.55);
  backdrop-filter: blur(10px);
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.svc:nth-child(1) { animation-delay: 0.18s; }
.svc:nth-child(2) { animation-delay: 0.24s; }
.svc:nth-child(3) { animation-delay: 0.30s; }
.svc:nth-child(4) { animation-delay: 0.36s; }
.svc:nth-child(5) { animation-delay: 0.42s; }
.svc:nth-child(6) { animation-delay: 0.48s; }
.svc:nth-child(7) { animation-delay: 0.54s; }

.svc--skeleton {
  opacity: 0.6;
  pointer-events: none;
  border-color: rgba(120, 180, 200, 0.1);
}

.svc--skeleton .svc-name,
.svc--skeleton .svc-desc {
  background: linear-gradient(90deg, rgba(120, 180, 200, 0.1) 25%, rgba(120, 180, 200, 0.22) 50%, rgba(120, 180, 200, 0.1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  color: transparent;
  border-radius: 2px;
}

.svc--skeleton .svc-name {
  width: 40%;
  height: 1.25rem;
  margin-bottom: 0.4rem;
}

.svc--skeleton .svc-desc {
  width: 70%;
  height: 0.95rem;
  margin-bottom: 0;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.svc-error {
  padding: 1.5rem;
  border: 1px solid rgba(255, 140, 120, 0.35);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.95rem;
}

.svc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.svc-index {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.svc-status {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.svc-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--offline);
}

.svc-status[data-live="online"]::before {
  background: var(--online);
  box-shadow: 0 0 0 0 rgba(93, 222, 160, 0.45);
  animation: pulse-online 2.4s ease-out infinite;
}

.svc-status[data-live="online"]::after { content: "online"; color: var(--online); }
.svc-status[data-live="offline"]::after { content: "offline"; color: var(--offline); }

.svc-name {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.svc-desc {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.svc-meta {
  margin: 0 0 1rem;
  display: grid;
  gap: 0.45rem;
}

.svc-meta > div {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.88rem;
}

.svc-meta dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.svc-meta dd {
  margin: 0;
  color: var(--ink);
}

.svc-meta a {
  color: var(--accent);
  text-decoration: none;
}

.svc-meta a:hover {
  text-decoration: underline;
}

.svc-meta code {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--accent);
}

.svc-link {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  transition: transform 0.3s ease;
  display: inline-block;
}

.svc-link:hover {
  transform: translateX(4px);
}

.svc-link--muted {
  color: var(--muted);
  cursor: default;
}

.svc-link--muted:hover {
  transform: none;
}

.back {
  margin: 2rem 0 0;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.48s both;
}

.back a {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
}

.back a:hover {
  color: var(--accent);
}

.meta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

.meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(62, 207, 207, 0.5);
  animation: pulse 2.4s ease-out infinite;
}

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

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 64px 64px, 64px 64px; }
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(24px, 18px); }
}

@keyframes float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -14px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 207, 207, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(62, 207, 207, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 207, 207, 0); }
}

@keyframes pulse-online {
  0% { box-shadow: 0 0 0 0 rgba(93, 222, 160, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(93, 222, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(93, 222, 160, 0); }
}

@media (max-width: 820px) {
  .cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
  }
  .card {
    flex: 0 0 auto;
    width: clamp(150px, 42vw, 190px);
    min-height: 230px;
  }
  .brand-mark {
    letter-spacing: 0.2em;
    text-indent: 0.2em;
  }
  .svc-meta > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

@media (max-width: 400px) {
  .card {
    width: 78vw;
    min-height: 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-icon--ome .omega-flow { display: none; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
