/* ============================================================
   BASE.CSS — Design tokens & foundational styles
   Tema: "Brutal Glass" — kaca buram di atas hitam pekat,
   dengan aksen merah BRIN, garis tegas, dan bayangan keras.
   Palet: hitam #0A0A0B · merah #EC2425 · putih #FFFFFF
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* ---- Surface ---- */
  --bg-0: #0A0A0B;
  --bg-1: #111113;
  --bg-2: #1A1A1D;
  --glass: rgba(255,255,255,0.055);
  --glass-strong: rgba(255,255,255,0.11);
  --line: rgba(255,255,255,0.13);
  --line-strong: rgba(255,255,255,0.28);

  /* ---- Ink ---- */
  --ink: #FFFFFF;
  --ink-dim: #BDBDC4;
  --ink-faint: #8A8A93;

  /* ---- Brand red ---- */
  --red: #EC2425;          /* isian tombol, garis aksen */
  --red-hot: #FF4B4D;      /* teks/ikon aksen di atas hitam (kontras lebih tinggi) */
  --red-deep: #8F1213;
  --red-soft: rgba(236,36,37,0.14);
  --red-line: rgba(236,36,37,0.55);

  /* ---- Sensor signature colors (tanpa hijau) ---- */
  --glow-turbidity: #FFFFFF;   /* Kekeruhan — putih */
  --glow-ph: #FF4B4D;          /* pH & ORP — merah */
  --glow-do: #B4BAC8;          /* Oksigen terlarut — perak baja */
  --glow-temp: #FF9C8C;        /* Suhu — salmon */

  /* ---- System ---- */
  --on: #FF4B4D;               /* aksen utama (dulu hijau) */
  --ok: #FFFFFF;               /* status aman = putih bersih */
  --off: #FF4B4D;
  --warn: #FFC93C;
  --accent: #EC2425;

  /* ---- Type ---- */
  --f-display: 'Archivo', 'Arial Black', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;
  --f-body: 'Inter', sans-serif;

  /* ---- Radius / motion ---- */
  --r-lg: 10px;
  --r-md: 6px;
  --r-sm: 4px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 620px at 0% 0%, rgba(236,36,37,0.30) 0%, transparent 62%),
    radial-gradient(820px 600px at 100% 100%, rgba(236,36,37,0.20) 0%, transparent 62%),
    radial-gradient(600px 400px at 70% 20%, rgba(255,255,255,0.05) 0%, transparent 70%),
    var(--bg-0);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--f-body);
  overflow-x: hidden;
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

a { color: inherit; text-decoration: none; }
h1,h2,h3 { font-family: var(--f-display); margin: 0; font-weight: 800; letter-spacing: -0.015em; }
p { line-height: 1.6; color: var(--ink-dim); }

::selection { background: var(--red); color: #fff; }

/* Canvas layer that cursor-fx.js draws the dot-grid signature into */
#fx-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------------- NAVBAR ---------------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: rgba(10,10,11,0.72);
  border-bottom: 2px solid var(--red);
}
.navbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--f-display); font-weight: 800; font-size: 18px; letter-spacing: 0.04em; flex-shrink: 0; line-height: 1.1; }
.brand small { display: block; font-family: var(--f-mono); font-size: 9px; color: var(--ink-dim); font-weight: 500; letter-spacing: 0.06em; margin-top: 3px; }

/* Logo kolaborasi (BRIN × Politeknik Enjinering Indorama)
   — di atas pelat putih supaya logo gelap tetap terbaca di tema hitam. */
.brand-logos {
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  background: #fff; padding: 5px 11px; border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 3px 3px 0 var(--red);
}
.brand-logos img { height: 30px; width: auto; display: block; }
.brand-logos .sep { width: 1px; height: 26px; background: #C9C9CF; flex-shrink: 0; }

.nav-links { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.nav-links a {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.03em;
  color: var(--ink-dim); padding: 8px 12px; border-radius: var(--r-sm);
  transition: color .2s var(--ease), background .2s var(--ease);
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--glass-strong); }
.nav-links a.active { color: #fff; background: var(--red); font-weight: 700; }

.nav-user {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 11px;
  white-space: nowrap; flex-shrink: 0;
}
.nav-user > * {
  white-space: nowrap; flex-shrink: 0;
}
.nav-user .gate-note {
  font-size: 10px; color: var(--ink-faint); margin: 0 4px;
}

@media (max-width: 1240px) {
  .brand-logos img { height: 22px; }
  .brand-logos .sep { height: 18px; }
  .brand { font-size: 16px; gap: 10px; }
  .nav-links a { padding: 6px 9px; font-size: 11.5px; }
  .navbar-inner { gap: 8px; padding: 10px 16px; }
  .nav-user { gap: 6px; }
}
@media (max-width: 1100px) {
  .brand small { display: none; }
}
@media (max-width: 1060px) {
  .nav-user .gate-note { display: none; }
}
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px; cursor: default;
  padding: 5px 10px; border-radius: var(--r-sm); font-weight: 700; font-size: 11px;
  background: var(--red-soft); border: 1px solid var(--red-line); color: #FF9A9B;
  animation: streak-pulse 2.2s ease-in-out infinite; user-select: none;
}
@keyframes streak-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(236,36,37,0); }
  50% { box-shadow: 0 0 10px rgba(236,36,37,0.6); }
}
.role-chip {
  padding: 5px 10px; border-radius: var(--r-sm); font-size: 10px; font-weight: 700;
  border: 1px solid var(--line-strong); letter-spacing: 0.06em; text-transform: uppercase;
}
.role-chip.eng {
  position: relative; overflow: hidden; isolation: isolate;
  color: #fff5e0; border-color: rgba(255,90,60,0.6); font-weight: 800;
  background: #1a0300;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9), 0 0 8px rgba(255,120,60,0.9);
  box-shadow: 0 0 10px rgba(236,36,37,0.5);
}
/* Dua lapis "lidah api" (radial gradient) menyala & bergoyang di BELAKANG
   teks — orisinal, dibuat dari CSS murni (bukan aset gambar pihak ketiga). */
.role-chip.eng::before,
.role-chip.eng::after {
  content: ''; position: absolute; left: 50%; bottom: -35%;
  width: 130%; height: 230%; transform: translateX(-50%);
  z-index: -1; filter: blur(2.5px);
}
.role-chip.eng::before {
  background: radial-gradient(circle at 50% 100%, #fff2b0 0%, #ffc233 16%, #ff7a00 38%, #ff2d00 60%, transparent 74%);
  animation: flame-flicker-a 1.1s ease-in-out infinite;
}
.role-chip.eng::after {
  width: 90%; opacity: 0.65; mix-blend-mode: screen;
  background: radial-gradient(circle at 50% 100%, #ffe9a8 0%, #ff9d00 30%, #b31500 62%, transparent 75%);
  animation: flame-flicker-b 1.6s ease-in-out infinite;
}
@keyframes flame-flicker-a {
  0%, 100% { transform: translateX(-50%) scaleY(1) scaleX(1) skewX(0deg); }
  25%      { transform: translateX(-53%) scaleY(1.1) scaleX(0.92) skewX(-4deg); }
  50%      { transform: translateX(-47%) scaleY(0.92) scaleX(1.06) skewX(3deg); }
  75%      { transform: translateX(-51%) scaleY(1.06) scaleX(0.96) skewX(-2deg); }
}
@keyframes flame-flicker-b {
  0%, 100% { transform: translateX(-50%) scaleY(1) skewX(0deg); opacity: 0.5; }
  40%      { transform: translateX(-48%) scaleY(1.15) skewX(4deg); opacity: 0.75; }
  70%      { transform: translateX(-52%) scaleY(0.88) skewX(-4deg); opacity: 0.45; }
}
/* Video latar api custom (opsional) — taruh file di assets/video/engineer-flame.mp4
   dan ini otomatis tampil MENIMPA fallback CSS flame di atas. Kalau file belum
   ada / gagal dimuat, nav.js akan menyembunyikan video ini lewat JS sehingga
   fallback CSS (::before/::after) di atas tetap terlihat. */
.role-chip.eng .chip-flame-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -1; opacity: 0.9;
}
.role-chip.res { color: #fff; border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.1); }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--bg-1); border-bottom: 2px solid var(--red); padding: 10px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; background: none; border: 1px solid var(--line-strong); color: var(--ink); border-radius: var(--r-sm); padding: 8px 10px; font-size: 16px; cursor: pointer; }
}
@media (max-width: 560px) {
  .brand-logos { padding: 4px 8px; gap: 7px; box-shadow: 2px 2px 0 var(--red); }
  .brand-logos img { height: 19px; }
  .brand-logos .sep { height: 15px; }
  .brand { font-size: 14px; gap: 8px; }
}

/* ---------------- BUTTONS ---------------- */
.btn {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.03em;
  padding: 11px 20px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .12s var(--ease), background .2s, border-color .2s, box-shadow .12s var(--ease);
}
/* Tombol utama: merah pekat + bayangan putih keras (efek "ditekan" saat diklik) */
.btn-primary {
  background: var(--red); color: #fff; font-weight: 700;
  border-color: #FF6B6D; box-shadow: 3px 3px 0 rgba(255,255,255,0.92);
}
.btn-primary:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 rgba(255,255,255,0.92); background: #F53A3B; }
.btn-primary:active { transform: translate(3px,3px); box-shadow: 0 0 0 rgba(255,255,255,0.92); }
.btn-ghost { background: var(--glass); border-color: var(--line-strong); color: var(--ink); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn-ghost:hover { background: var(--glass-strong); border-color: #fff; }
.btn-ghost:active { transform: scale(0.97); }
.btn-outline { background: transparent; border-color: var(--red-line); color: #FF8688; }
.btn-outline:hover { background: var(--red-soft); border-color: var(--red-hot); color: #fff; }
.btn-outline:active { transform: scale(0.97); }
.btn-danger { background: transparent; border-color: var(--red-line); color: var(--off); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------- GLASS / CARD ----------------
   Kaca buram (blur + pantulan tepi putih) + gaya brutal:
   siku merah di pojok kiri-atas dan bayangan keras bergeser. */
.glass {
  position: relative;
  background: linear-gradient(140deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.035) 100%);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 5px 5px 0 rgba(236,36,37,0.16), 0 14px 40px rgba(0,0,0,0.45);
  padding: 20px;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), transform .1s linear;
  transform-style: preserve-3d;
}
.glass::before, .glass::after {
  content: ''; position: absolute; background: var(--red); pointer-events: none;
}
.glass::before { top: -1px; left: -1px; width: 34px; height: 3px; border-top-left-radius: var(--r-lg); }
.glass::after  { top: -1px; left: -1px; width: 3px; height: 34px; border-top-left-radius: var(--r-lg); }
.glass:hover { border-color: rgba(255,255,255,0.32); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 6px 6px 0 rgba(236,36,37,0.5), 0 14px 40px rgba(0,0,0,0.45); }
.glass.tiltable { will-change: transform; }

/* ---------------- FOOTER ---------------- */
.site-footer {
  border-top: 2px solid var(--red); margin-top: 60px; padding: 28px 20px 40px;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-dim);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  position: relative; z-index: 1;
  background: rgba(10,10,11,0.6);
}

/* ---------------- FORMS ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--f-mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; letter-spacing: 0.05em; text-transform: uppercase; }
.field input, .field select {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(0,0,0,0.4); border: 1px solid var(--line-strong); color: var(--ink);
  font-family: var(--f-body); font-size: 14px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus, .field select:focus { border-color: var(--red-hot); box-shadow: 3px 3px 0 var(--red-soft), 0 0 0 3px rgba(236,36,37,0.2); }
.form-msg { font-family: var(--f-mono); font-size: 12px; padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 14px; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: rgba(236,36,37,0.14); border: 1px solid var(--red-line); color: #FF8688; }
.form-msg.success { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.5); color: #fff; }

/* ---- Site pet (VS Code Pet-style walking cat) ---- */
#site-pet {
  position: fixed; bottom: 0; z-index: 45; width: 60px; height: 40px;
  cursor: pointer; pointer-events: auto; transition: none;
}
#site-pet .leg { transform-origin: 50% 0%; }
#site-pet.walking .leg1, #site-pet.walking .leg3 { animation: pet-leg-a 0.42s infinite ease-in-out; }
#site-pet.walking .leg2, #site-pet.walking .leg4 { animation: pet-leg-b 0.42s infinite ease-in-out; }
@keyframes pet-leg-a { 0%, 100% { transform: rotate(18deg); } 50% { transform: rotate(-18deg); } }
@keyframes pet-leg-b { 0%, 100% { transform: rotate(-18deg); } 50% { transform: rotate(18deg); } }
.pet-tail { transform-origin: 44px 25px; animation: pet-tail-wag 1.7s infinite ease-in-out; }
@keyframes pet-tail-wag { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(9deg); } }
.pet-eye { transform-box: fill-box; transform-origin: center; animation: pet-blink 4.5s infinite; }
@keyframes pet-blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.15); } }
.pet-bubble {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%) scale(0.85);
  background: rgba(10,10,11,0.85); border: 1px solid var(--red-line); border-radius: var(--r-sm);
  padding: 4px 9px; font-family: var(--f-mono); font-size: 10px; color: var(--ink);
  opacity: 0; transition: opacity .2s, transform .2s; white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pet-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
@media (prefers-reduced-motion: reduce) { #site-pet { display: none; } }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #fff; outline-offset: 2px;
}
