/* Halaman awal Sistem Risk Register — tema air terang.
   Tata letak orbit mengikuti Portal Sistem Informasi Terintegrasi (airduasudaraapp.id);
   warnanya gradien biru air dengan tetesan, gelembung, dan gelombang. */
:root {
  --sky-50: #f0fbff;
  --sky-100: #d9f3ff;
  --sky-300: #7dd3fc;
  --sky-500: #0ea5e9;
  --blue-600: #0284c7;
  --blue-700: #0369a1;
  --navy: #0b3a5c;
  --ink: #0b3a5c;
  --ink-soft: #3b6684;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .85);
  --glass-border: rgba(255, 255, 255, .9);
  --font-display: 'Poppins', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;

  --card-w: 178px;    /* lebar satu item orbit (ikon + nama satu baris) */
  --tile: 96px;       /* ukuran kotak ikon */
  --logo-size: 210px;
  /* Lama satu putaran penuh. Makin besar, makin lambat. */
  --orbit-duration: 60s;
}

*, *::before, *::after { box-sizing: border-box; }
body.portal {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--ink);
  background: #bfeaff;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.portal img { max-width: 100%; display: block; }
.portal a { color: inherit; text-decoration: none; }

/* ---------------- latar air */
.bg-layer { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-gradient {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(255,255,255,.95), transparent 70%),
    radial-gradient(700px 500px at 10% 30%, rgba(255,255,255,.45), transparent 70%),
    radial-gradient(800px 600px at 95% 55%, rgba(125,211,252,.55), transparent 70%),
    linear-gradient(180deg, #f2fbff 0%, #cdeffe 28%, #8ad6f8 62%, #38aee6 88%, #1590d4 100%);
}
/* berkas cahaya matahari yang menembus air */
.bg-rays {
  position: absolute; inset: -20% -10% 0;
  background: repeating-linear-gradient(105deg, rgba(255,255,255,0) 0 70px, rgba(255,255,255,.22) 70px 110px, rgba(255,255,255,0) 110px 190px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
  filter: blur(6px);
  animation: raysSway 16s ease-in-out infinite;
}
@keyframes raysSway { 50% { transform: translateX(40px) skewX(-3deg); opacity: .7; } }
.glow-blob { position: absolute; border-radius: 50%; filter: blur(60px); }
.glow-blob--a { width: 520px; height: 520px; left: -140px; top: 20%; background: radial-gradient(circle, rgba(255,255,255,.7), transparent 70%); animation: driftA 22s ease-in-out infinite; }
.glow-blob--b { width: 600px; height: 600px; right: -180px; top: -10%; background: radial-gradient(circle, rgba(186,230,253,.9), transparent 70%); animation: driftB 26s ease-in-out infinite; }
@keyframes driftA { 50% { transform: translate(60px, 40px) scale(1.12); } }
@keyframes driftB { 50% { transform: translate(-50px, 50px) scale(1.08); } }

/* tetesan air jatuh */
.drops { position: absolute; inset: 0; }
.drop { position: absolute; top: -40px; width: 12px; height: 12px; opacity: 0; animation: dropFall linear infinite; }
.drop::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 0 50% 50% 50%;
  transform: rotate(45deg);
  background: radial-gradient(circle at 60% 60%, rgba(255,255,255,.95), rgba(125,211,252,.85) 45%, rgba(2,132,199,.75));
  box-shadow: 0 2px 6px rgba(2,132,199,.3), inset -1px -1px 2px rgba(255,255,255,.8);
}
@keyframes dropFall {
  0% { opacity: 0; transform: translateY(0) scale(var(--s, 1)); }
  10% { opacity: .85; }
  85% { opacity: .75; }
  100% { opacity: 0; transform: translateY(105vh) scale(var(--s, 1)); }
}
/* gelembung / droplet naik */
.bubbles { position: absolute; inset: 0; }
.bubble {
  position: absolute; bottom: -30px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.95), rgba(255,255,255,.25) 45%, rgba(14,165,233,.12) 75%);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: inset -2px -3px 6px rgba(2,132,199,.18);
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(0, 0) scale(.8); }
  10% { opacity: .9; }
  90% { opacity: .6; }
  100% { opacity: 0; transform: translate(var(--drift, 30px), -110vh) scale(1.08); }
}
/* gelombang di dasar layar */
.waves { position: absolute; left: 0; bottom: 0; width: 100%; height: 150px; }
.wave { animation: waveMove linear infinite; }
.wave--1 { fill: rgba(255,255,255,.35); animation-duration: 26s; }
.wave--2 { fill: rgba(255,255,255,.45); animation-duration: 18s; animation-direction: reverse; }
.wave--3 { fill: rgba(255,255,255,.7); animation-duration: 32s; }
@keyframes waveMove { to { transform: translateX(-1440px); } }

/* ---------------- header & sambutan */
.site-header, .welcome, .hero, .site-footer { position: relative; z-index: 10; }
/* logo di tengah, tepat di atas judul sambutan */
.site-header { display: flex; justify-content: center; align-items: center; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 24px 4px; }
.h-logo { height: 64px; width: auto; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(2,132,199,.3)); }
.h-session { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); }
.h-session {
  margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--blue-700);
  padding: 8px 14px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--glass-border);
  box-shadow: 0 4px 14px rgba(2,132,199,.15);
}
.h-session span { color: var(--ink-soft); font-weight: 500; }

.welcome { text-align: center; padding: 6px 16px 0; }
.welcome h1 {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .3px; line-height: 1.25; margin: 0 auto 6px;
  font-size: clamp(1.15rem, 2.4vw, 1.85rem); max-width: 980px;
  background: linear-gradient(120deg, #0b3a5c 10%, #0369a1 50%, #0ea5e9 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.7));
}
.welcome h1 span { display: block; }
.welcome p { margin: 0; color: var(--ink-soft); font-size: 13px; }

/* ---------------- panggung orbit */
.hero { display: flex; justify-content: center; padding: 18px 16px 8px; }
.orbit-system { position: relative; width: 100%; max-width: 1400px; }
/* Mode orbit: halaman pas satu layar (tanpa scroll). Panggung orbit mengisi sisa
   tinggi di antara sambutan dan footer. */
body.portal.orbit-mode { height: 100dvh; overflow: hidden; }
body.orbit-mode .hero { flex: 1 1 auto; min-height: 0; padding: 6px 16px 0; }
body.orbit-mode .orbit-system { height: 100%; overflow: hidden; }
body.orbit-mode .site-header { padding-top: 10px; padding-bottom: 0; }
body.orbit-mode .welcome h1 { font-size: clamp(1.05rem, 1.9vw, 1.6rem); margin-bottom: 2px; }
/* layar pendek (mis. laptop 1280×720): header & judul diringkas agar orbit tetap muat tanpa scroll */
@media (max-height: 780px) {
  body.orbit-mode .h-logo { height: 46px; }
  body.orbit-mode .site-header { padding-top: 6px; }
  body.orbit-mode .welcome h1 { font-size: 1.15rem; }
  body.orbit-mode .welcome p { font-size: 12px; }
}
/* footer menempel di atas gelombang, tidak memakan tinggi panggung */
body.orbit-mode .site-footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 4px 16px 8px; line-height: 1.5; }
body.orbit-mode .site-footer > * { display: inline; }
body.orbit-mode .site-footer .ver::before { content: ' · '; color: var(--navy); }
body.orbit-mode .hero { padding-bottom: 26px; }

.ripple-wrap { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 1; pointer-events: none; }
.ripple {
  position: absolute; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.85); box-shadow: 0 0 12px rgba(14,165,233,.25);
  opacity: 0; animation: rippleOut 6.5s ease-out infinite;
}
.ripple:nth-child(2) { animation-delay: 2.15s; }
.ripple:nth-child(3) { animation-delay: 4.3s; }
@keyframes rippleOut { 0% { opacity: 0; transform: scale(.3); } 12% { opacity: .8; } 100% { opacity: 0; transform: scale(6); } }

.orbit-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.orbit-ring--main { border: 2px solid rgba(255,255,255,.75); box-shadow: 0 0 24px rgba(255,255,255,.5), inset 0 0 24px rgba(255,255,255,.35); }
.orbit-ring--inner { border: 1.5px dashed rgba(255,255,255,.7); }

/* ---------------- panel tengah orbit (logo + Tim MR + akses Pimpinan/SPI) */
/* Mode orbit: panel dua kolom yang ringkas, agar ikon bisa mengorbit dengan ukuran penuh.
     [ logo + tombol Pimpinan/SPI ] [ struktur Tim MR ]
     [ alur kerja 4 langkah ..................................... ] */
.hub {
  position: absolute; left: 50%; top: 50%; z-index: 5;
  transform: translate(-50%, -50%);
  display: grid; grid-template-columns: 214px 268px; grid-template-areas: "title title" "links info" "alur alur";
  column-gap: 14px; row-gap: 8px; align-items: stretch;
  padding: 14px 18px 12px; border-radius: 32px;
  background: linear-gradient(160deg, rgba(255,255,255,.9), rgba(232,247,255,.8));
  border: 2px solid rgba(255,255,255,.95);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(2,132,199,.3), 0 0 0 8px rgba(255,255,255,.3);
  opacity: 0; transition: opacity 1s ease;
}
body.is-ready .hub { opacity: 1; }
.hub-title { grid-area: title; font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--navy); margin: 0; text-align: center; }
/* 2 kotak kiri dan 5 kotak kanan mengisi tinggi yang sama: tepi atas & bawah sejajar */
.hub-links { grid-area: links; display: grid; grid-template-rows: 1fr 1fr; gap: 6px; }
.hub-info { grid-area: info; display: flex; }
.hub-struktur { margin: 0; flex: 1; display: grid; grid-template-rows: repeat(5, 1fr); gap: 4px; }
.hub-struktur div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.75); }
.hub-struktur dt { font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--blue-600); }
.hub-struktur dd { margin: 0; font-size: 12px; font-weight: 600; color: var(--navy); }
.hub-alur {
  grid-area: alur; counter-reset: s; list-style: none; margin: 0; padding: 8px 0 0;
  border-top: 1px dashed rgba(2,132,199,.3);
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 6px;
}
.hub-alur li { counter-increment: s; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--navy); cursor: help; }
.hub-alur li::before {
  content: counter(s); width: 18px; height: 18px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--sky-500), var(--blue-700));
}
.hub-alur li:not(:last-child)::after { content: '›'; margin-left: 4px; color: var(--sky-500); font-size: 15px; font-weight: 700; }
.hub-btn {
  display: flex; align-items: center; gap: 9px; text-align: left; padding: 6px 10px; border-radius: 14px;
  background: linear-gradient(135deg, var(--sky-500), var(--blue-700)); color: #fff !important;
  box-shadow: 0 8px 18px rgba(2,105,161,.3); transition: transform .2s ease, box-shadow .2s ease;
}
.hub-btn:hover, .hub-btn:focus-visible { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(2,105,161,.4); }
.hub-btn > span:first-child { font-size: 17px; width: 30px; height: 30px; border-radius: 10px; background: rgba(255,255,255,.95); display: flex; align-items: center; justify-content: center; flex: none; }
.hub-btn strong { display: block; font-family: var(--font-display); font-size: 13px; line-height: 1.2; }
.hub-btn small { font-size: 10.5px; opacity: .9; white-space: nowrap; }
.hub-btn b { margin-left: auto; font-size: 16px; }

/* ---------------- item orbit: kotak ikon + nama bagian */
.orbit { position: absolute; inset: 0; z-index: 4; }
.orbit-slot {
  position: absolute; left: 50%; top: 50%; width: var(--card-w);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transform: translate(-50%, -50%); will-change: transform;
  opacity: 0; transition: opacity .9s ease;
  outline: none;
}
body.is-ready .orbit-slot { opacity: 1; }
.tile {
  position: relative; width: var(--tile); height: var(--tile); border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #ffffff 0%, #eaf8ff 55%, #cdeeff 100%);
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: 0 14px 30px rgba(2,105,161,.28), 0 0 0 6px rgba(255,255,255,.35), inset 0 -6px 14px rgba(14,165,233,.16);
  transition: transform .35s cubic-bezier(.2,.9,.25,1), box-shadow .35s ease;
}
/* kilau kaca di sudut kiri atas */
.tile::before {
  content: ''; position: absolute; left: 10px; top: 8px; width: 42%; height: 26%;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  pointer-events: none;
}
.tile-icon { font-size: calc(var(--tile) * .48); line-height: 1; filter: drop-shadow(0 3px 4px rgba(2,105,161,.25)); transition: transform .4s cubic-bezier(.2,.9,.25,1); }
.tile-count {
  position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--sky-500), var(--blue-700));
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(2,105,161,.35);
}
.tile-name {
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px; line-height: 1.25; text-align: center;
  color: var(--navy); text-shadow: 0 1px 0 rgba(255,255,255,.9), 0 0 10px rgba(255,255,255,.8);
}
/* di orbit nama dibuat satu baris agar item lebih pendek (ruang vertikal paling terbatas) */
body.orbit-mode .tile-name { white-space: nowrap; font-size: 13px; }
.orbit-slot:hover .tile, .orbit-slot:focus-visible .tile {
  transform: translateY(-6px) scale(1.08);
  box-shadow: 0 20px 40px rgba(2,105,161,.35), 0 0 0 6px rgba(255,255,255,.6), 0 0 0 9px rgba(14,165,233,.35), inset 0 -6px 14px rgba(14,165,233,.16);
}
.orbit-slot:hover .tile-icon { transform: scale(1.1) rotate(-6deg); }
.orbit-slot:hover .tile-name, .orbit-slot:focus-visible .tile-name { color: var(--blue-700); }

/* ---------------- mode grid (tablet, HP, atau layar yang tidak muat untuk orbit) */
body.grid-mode .orbit-system { height: auto; display: flex; flex-direction: column; align-items: center; }
body.grid-mode .orbit-ring, body.grid-mode .ripple-wrap { display: none; }
/* Panel tengah "dibuka" agar isinya bisa diurutkan: logo → ikon bagian → info Tim MR */
body.grid-mode .hub { display: contents; }
body.grid-mode .hub-title { order: 3; margin-top: 18px; font-size: 14px; }
body.grid-mode .orbit { order: 1; width: 100%; }
body.grid-mode .hub-links { order: 2; width: 100%; max-width: 760px; margin-top: 30px; grid-template-columns: 1fr 1fr; grid-template-rows: none; gap: 10px; }
body.grid-mode .hub-btn { padding: 10px 12px; }
body.grid-mode .hub-info {
  order: 4; width: 100%; max-width: 760px; margin-top: 14px; padding: 16px; border-radius: 24px;
  background: linear-gradient(160deg, rgba(255,255,255,.85), rgba(232,247,255,.75)); border: 2px solid #fff;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 14px 36px rgba(2,132,199,.22);
}

body.grid-mode .hub-struktur div { grid-template-columns: 110px 1fr; padding: 6px 10px; }
body.grid-mode .hub-alur { order: 5; width: 100%; max-width: 760px; margin-top: 14px; border-top: 0; padding: 0; }
.orbit.is-grid { position: relative; inset: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 14px; max-width: 760px; margin: 0 auto; }
.orbit.is-grid .orbit-slot { position: relative; left: auto; top: auto; width: auto; transform: none !important; }

.site-footer { text-align: center; padding: 18px 16px 26px; color: var(--navy); font-size: 12px; line-height: 1.8; }
.site-footer strong { font-weight: 600; }
.site-footer .ver { font-size: 11.5px; color: var(--blue-700); font-weight: 600; }
.site-footer .ver:hover { text-decoration: underline; }

/* ---------------- responsif */
@media (max-width: 640px) {
  :root { --tile: 78px; }
  .site-header { padding: 14px 16px 4px; gap: 10px; flex-direction: column; }
  .h-logo { height: 56px; }
  .h-session { position: static; transform: none; }
  .h-session span { display: none; }
  .orbit.is-grid { gap: 22px 8px; }
  .tile { border-radius: 22px; }
  .tile-name { font-size: 12.5px; }
  body.grid-mode .hub-links { grid-template-columns: 1fr; }
  body.grid-mode .hub-struktur div { grid-template-columns: 92px 1fr; }
  .waves { height: 90px; }
}
@media (max-width: 340px) {
  :root { --tile: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  .glow-blob, .ripple, .bubble, .drop, .wave, .bg-rays { animation: none !important; }
  .drop, .bubble { display: none; }
}
