/* ============================================================
   ARKENZI Portal — dark navy + gold, cinematic
   ============================================================ */

:root {
  --bg: #05080d;
  --bg-2: #070b12;
  --panel: rgba(14, 19, 27, 0.66);
  --panel-solid: #0e131b;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --gold: #f2c66d;
  --gold-soft: rgba(242, 198, 109, 0.55);
  --gold-dim: rgba(242, 198, 109, 0.16);
  --gold-bright: #ffe9ad;
  --ink: #e7edf3;
  --dim: #8b97a5;
  --green: #3ddc84;
  --amber: #f0b35c;
  --red: #ff6b6b;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

.mono { font-family: var(--font-mono); }
.dim { color: var(--dim); }

::selection { background: rgba(242, 198, 109, 0.28); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- starfield ---------- */

.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.8;
}
.stars canvas { width: 100%; height: 100%; display: block; }

/* ---------- topbar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 3vw, 32px);
  background: linear-gradient(180deg, rgba(5, 8, 13, 0.72) 0%, transparent 100%);
}

.brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(242, 198, 109, 0.8);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(10, 14, 20, 0.55);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.btn-pill:hover { color: var(--gold); border-color: var(--gold-soft); background: rgba(16, 22, 31, 0.7); }
.btn-pill svg { width: 14px; height: 14px; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  align-items: center;
  isolation: isolate;
}

.hero-media { position: absolute; inset: 0; z-index: -1; overflow: hidden; }

.hero-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.03);
  opacity: 0;
  transition: opacity 1.4s var(--ease);
  z-index: 1;
}
.hero.has-video .hero-media video { opacity: 1; }

.hero-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(90% 70% at 70% 18%, rgba(242, 198, 109, 0.10) 0%, transparent 55%),
    radial-gradient(70% 90% at 18% 80%, rgba(56, 96, 150, 0.14) 0%, transparent 60%),
    radial-gradient(130% 110% at 50% 45%, #0b1220 0%, #070b12 55%, #05080d 100%);
}
.hero.novideo .hero-media video { display: none; }

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(5, 8, 13, 0.44) 0%, rgba(5, 8, 13, 0.08) 40%, rgba(5, 8, 13, 0.42) 78%, var(--bg) 100%),
    radial-gradient(120% 90% at 24% 50%, rgba(5, 8, 13, 0.38) 0%, transparent 55%);
}

.hero-inner {
  width: min(1120px, 100% - 48px);
  margin: 0 auto;
  padding: clamp(90px, 14vh, 140px) 0 clamp(40px, 8vh, 90px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}
.gold-eyebrow { color: var(--gold-soft); }

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
}
.pulse[data-state="ok"]      { background: var(--green); color: var(--green); animation: pulse 2.4s infinite; }
.pulse[data-state="partial"] { background: var(--amber); color: var(--amber); animation: pulse 2.4s infinite; }
.pulse[data-state="down"]    { background: var(--red); }
.pulse[data-state="check"]   { background: var(--amber); animation: blink 1.1s infinite; }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 currentColor; }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes blink { 50% { opacity: 0.25; } }

.hero-title {
  margin: 0;
  font-size: clamp(3.4rem, 10vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 0.98;
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 52%, #a97e2f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 34px rgba(242, 198, 109, 0.16));
  font-variant-ligatures: none;
}

.hero-sub {
  margin: 16px 0 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #b8c2cc;
  max-width: 34ch;
}

.hero-clock {
  margin: 26px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.hero-clock #clockTime { color: var(--gold-soft); }

.hero-hint {
  position: absolute;
  right: max(24px, calc((100% - 1120px) / 2));
  bottom: clamp(60px, 10vh, 110px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--dim);
  background: none;
  border: 0;
  border-right: 1px solid var(--line-strong);
  writing-mode: vertical-rl;
  padding: 14px 4px;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}
.hero-hint:hover { color: var(--gold); border-color: var(--gold-soft); }

/* ---------- brain chip (sentuhan kecil) ---------- */

.brain-chip {
  position: absolute;
  right: calc(max(24px, (100% - 1120px) / 2) + 44px);
  bottom: clamp(140px, 24vh, 210px);
  width: clamp(210px, 21vw, 290px);
  aspect-ratio: 3 / 2;
  border: 1px solid var(--gold-dim);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel-solid);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(242, 198, 109, 0.05);
  transform: rotate(1.6deg);
}

.brain-chip video,
.chip-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chip-fallback {
  z-index: 0;
  background:
    radial-gradient(80% 90% at 50% 40%, rgba(96, 130, 255, 0.22) 0%, transparent 60%),
    radial-gradient(120% 120% at 50% 50%, #0c1322 0%, #070b12 60%, #05080d 100%);
}

.brain-chip video { opacity: 0; transition: opacity 1s var(--ease); z-index: 1; }
.brain-chip.has-video video { opacity: 1; }
.brain-chip.novideo video { display: none; }

.chip-label {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 10px;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: rgba(231, 237, 243, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}

/* ---------- dashboard overlay ---------- */

.dash {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 7, 11, 0.86);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
  overflow-y: auto;
}
.dash.open { opacity: 1; visibility: visible; }

.dash-inner {
  width: min(1120px, 100% - 48px);
  margin: 0 auto;
  padding: 40px 0 36px;
  transform: translateY(16px);
  transition: transform 0.4s var(--ease);
}
.dash.open .dash-inner { transform: none; }

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.dash-head .eyebrow { margin: 0; font-size: 13px; }
.dash-tools { display: flex; align-items: center; gap: 16px; }
.dash-tools .mono { font-size: 12px; letter-spacing: 0.1em; }

/* ---------- grid & card ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
}
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 218px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.45s, box-shadow 0.45s;
}

.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(242, 198, 109, 0.38);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(242, 198, 109, 0.08);
}

.card-media { position: absolute; inset: 0; z-index: 0; }

.card-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 130% at 82% -10%, var(--tint, rgba(242, 198, 109, 0.13)) 0%, transparent 52%),
    radial-gradient(120% 120% at 15% 110%, rgba(50, 84, 134, 0.16) 0%, transparent 55%),
    linear-gradient(160deg, #0d1420 0%, #080d15 60%, #060a10 100%);
}
.card.span-3:nth-child(2) .card-fallback { --tint: rgba(127, 178, 255, 0.13); }
.card.span-2:nth-child(3) .card-fallback { --tint: rgba(201, 160, 255, 0.11); }
.card.span-2:nth-child(4) .card-fallback { --tint: rgba(61, 220, 132, 0.10); }
.card.span-2:nth-child(5) .card-fallback { --tint: rgba(240, 179, 92, 0.14); }

.card-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.card.video-ok:hover .card-media video,
.card.video-ok:focus-visible .card-media video { opacity: 0.62; }
.card.novideo .card-media video { display: none; }

.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 8, 13, 0.10) 0%, rgba(5, 8, 13, 0.62) 100%);
}

.card-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 16px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: auto;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--gold);
  background: rgba(5, 8, 13, 0.45);
}
.card-icon svg { width: 21px; height: 21px; }

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
.dot[data-state="ok"]      { background: var(--green); box-shadow: 0 0 8px rgba(61, 220, 132, 0.7); }
.dot[data-state="down"]    { background: var(--red); box-shadow: 0 0 8px rgba(255, 107, 107, 0.6); }
.dot[data-state="check"]   { background: var(--amber); animation: blink 1.1s infinite; }

.card-title {
  margin: 22px 0 2px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.card-desc {
  margin: 0;
  font-size: 0.86rem;
  color: #a7b2bd;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
}

.card-go {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-soft);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.35s, transform 0.35s var(--ease);
}
.card:hover .card-go, .card:focus-visible .card-go { opacity: 1; transform: none; }

/* ---------- footer strip (di dalam overlay) ---------- */

.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;
}
.btn-ghost:hover { color: var(--gold); border-color: var(--gold-soft); }
.btn-ghost svg { width: 13px; height: 13px; }
.btn-ghost.busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal 0.8s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes reveal { to { opacity: 1; transform: none; } }

.brain-chip.reveal { transform: translateY(16px) rotate(1.6deg); }
@keyframes revealChip { to { opacity: 1; transform: translateY(0) rotate(1.6deg); } }
.brain-chip.reveal { animation-name: revealChip; }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .span-3, .span-2 { grid-column: span 6; }
  .card { min-height: 186px; }
  .brain-chip { display: none; }
}

@media (max-width: 760px) {
  .hero-hint { display: none; }
  .hero-inner, .dash-inner { width: min(1120px, 100% - 40px); }
  .hero-title { font-size: clamp(3rem, 15vw, 4.6rem); }
  .card-body { padding: 16px 18px 14px; }
  .card-title { margin-top: 18px; }
  .topbar { padding: 14px 20px; }
  .dash-inner { padding: 26px 0 30px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; opacity: 1; transform: rotate(0); }
  .brain-chip.reveal { transform: rotate(1.6deg); }
  .card, .card-media video, .hero-media video, .brain-chip video { transition: none; }
  .pulse, .dot, .btn-ghost.busy svg { animation: none; }
}
