/* ===== Beranda: latar 3D (Three.js) + kaca (glassmorphism) =====
 * Selalu SATU LAYAR tanpa scroll: ukuran mengikuti tinggi layar (vh), dan bagian
 * pendukung (deskripsi, EKG, alamat) disembunyikan otomatis pada layar pendek.
 */
html:has(.home-page) { height: 100%; overflow: hidden; }
.home-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  color: #e6f1ff;
  background: #061a33;
}

/* Latar cadangan (tampil juga bila WebGL tidak tersedia) */
.bg-fallback {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(1100px 800px at 78% 38%, rgba(20, 184, 166, .30), transparent 60%),
    radial-gradient(900px 700px at 8% 95%, rgba(29, 95, 168, .40), transparent 60%),
    radial-gradient(700px 500px at 45% -10%, rgba(45, 212, 191, .14), transparent 60%),
    linear-gradient(160deg, #071d3a 0%, #0b2d57 55%, #0a3b4f 100%);
}
#bg3d {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%; display: block;
  opacity: 0; transition: opacity 1.4s ease;
}
#bg3d.ready { opacity: 1; }
.scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(6, 26, 51, .82) 0%, rgba(6, 26, 51, .45) 42%, rgba(6, 26, 51, 0) 68%);
}

.home {
  position: relative; z-index: 2;
  height: 100%;
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: clamp(8px, 1.7vh, 22px);
  padding: clamp(10px, 2.2vh, 28px) clamp(14px, 4vw, 56px);
}

.rise { animation: rise .95s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 150ms); }
@keyframes rise { from { opacity: 0; translate: 0 26px; filter: blur(6px); } to { opacity: 1; translate: 0 0; filter: none; } }

/* ---------- Header ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-width: 0;
  padding: clamp(4px, .8vh, 8px) 16px clamp(4px, .8vh, 8px) 10px; border-radius: 999px;
  color: #fff; text-decoration: none;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px);
}
.brand:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 3px; }
.brand img { height: clamp(30px, 4.4vh, 46px); width: auto; flex: none; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); }
.brand > span { min-width: 0; }
.brand strong { display: block; font-size: clamp(.95rem, 1.9vh, 1.12rem); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.brand small { display: block; font-size: clamp(.7rem, 1.35vh, .8rem); color: rgba(230, 241, 255, .72); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 14px; flex: none; }
.top-clock { text-align: right; line-height: 1.1; }
.top-clock span { font-size: clamp(1.15rem, 2.8vh, 1.6rem); font-weight: 800; letter-spacing: .02em; }
.top-clock small { display: block; font-size: clamp(.7rem, 1.4vh, .82rem); color: rgba(230, 241, 255, .72); font-weight: 600; }
.home-top .conn {
  font-size: .8rem; color: rgba(230, 241, 255, .85); white-space: nowrap;
  padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}

/* ---------- Hero ---------- */
.hero {
  align-self: center; min-height: 0; max-width: 640px;
  display: flex; flex-direction: column; gap: clamp(6px, 1.5vh, 16px);
}
.eyebrow {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 9px;
  padding: clamp(4px, .7vh, 7px) 13px; border-radius: 999px;
  font-size: clamp(.68rem, 1.35vh, .8rem); font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #99f6e4; background: rgba(20, 184, 166, .12); border: 1px solid rgba(45, 212, 191, .3);
}
.pulse-dot, .live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2dd4bf; flex: none;
  box-shadow: 0 0 0 0 rgba(45, 212, 191, .7); animation: ping 1.8s ease-out infinite;
}
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, .7); } 100% { box-shadow: 0 0 0 10px rgba(45, 212, 191, 0); } }
.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, min(4.8vw, 6.4vh), 4.1rem);
  font-weight: 800; line-height: 1.05; letter-spacing: -.025em;
  color: #fff; text-wrap: balance;
}
.grad {
  background: linear-gradient(100deg, #5eead4 0%, #67e8f9 28%, #ffffff 50%, #67e8f9 72%, #5eead4 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.lead { margin: 0; font-size: clamp(.88rem, 1.75vh, 1.1rem); line-height: 1.55; color: rgba(230, 241, 255, .78); max-width: 56ch; }

/* Status antrean realtime */
.live {
  padding: clamp(8px, 1.3vh, 14px); border-radius: 18px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .7);
}
.live-head { display: flex; align-items: center; gap: 9px; padding: 0 4px clamp(5px, 1vh, 10px); font-size: clamp(.68rem, 1.3vh, .78rem); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgba(230, 241, 255, .7); }
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.live-chip {
  --c: 45, 212, 191;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px;
  padding: clamp(7px, 1.2vh, 12px) clamp(10px, 1.2vw, 16px); border-radius: 13px;
  background: linear-gradient(135deg, rgba(var(--c), .18), rgba(var(--c), .04));
  border: 1px solid rgba(var(--c), .3);
}
.live-chip.loket-b { --c: 96, 165, 250; }
.lc-label { display: inline-flex; align-items: center; gap: 7px; font-size: clamp(.7rem, 1.35vh, .8rem); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgb(var(--c)); white-space: nowrap; }
.lc-label i { width: 8px; height: 8px; border-radius: 3px; background: rgb(var(--c)); }
.lc-num { grid-row: span 2; font-size: clamp(1.35rem, 3.6vh, 2.4rem); font-weight: 800; color: #fff; line-height: 1; }
.lc-num.empty { color: rgba(230, 241, 255, .3); font-weight: 600; }
.lc-num.bump { animation: bump .8s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes bump { 0% { transform: scale(.6); opacity: .2; color: rgb(var(--c)); } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.lc-meta { font-size: clamp(.7rem, 1.35vh, .8rem); color: rgba(230, 241, 255, .72); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-meta b { color: #fff; }

/* ---------- Garis EKG ---------- */
.ecg { height: clamp(16px, 3.4vh, 40px); margin: 0 -8px; }
.ecg svg { width: 100%; height: 100%; overflow: visible; }
.ecg path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ecg-base { stroke: rgba(94, 234, 212, .18); stroke-width: 1.5; }
.ecg-glow {
  stroke: #5eead4; stroke-width: 2.5;
  stroke-dasharray: 140 860; stroke-dashoffset: 1000;
  filter: drop-shadow(0 0 6px rgba(45, 212, 191, .9));
  animation: ecg 3.6s linear infinite;
}
@keyframes ecg { to { stroke-dashoffset: 0; } }

/* ---------- Kartu menu ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(10px, 1.3vw, 18px); }
.h-card {
  --accent: 45, 212, 191;
  position: relative; isolation: isolate; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; gap: clamp(5px, 1vh, 10px);
  padding: clamp(11px, 2vh, 22px) clamp(14px, 1.5vw, 22px) clamp(10px, 1.7vh, 18px);
  border-radius: clamp(14px, 2vh, 22px);
  color: inherit; text-decoration: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 60px -36px rgba(0, 0, 0, .8);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition: transform .2s ease-out, border-color .25s ease, box-shadow .25s ease;
}
.h-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--accent), .30), transparent 45%);
  opacity: 0; transition: opacity .3s ease;
}
.h-card::after {
  content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent), .9), transparent);
  opacity: .6;
}
.h-card:hover, .h-card:focus-visible {
  --lift: -5px;
  border-color: rgba(var(--accent), .6);
  box-shadow: 0 34px 80px -34px rgba(var(--accent), .7);
}
.h-card:hover::before, .h-card:focus-visible::before { opacity: 1; }
.h-card:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 3px; }
.hc-icon {
  flex: none;
  width: clamp(36px, 5vh, 52px); height: clamp(36px, 5vh, 52px); border-radius: 30%;
  display: grid; place-items: center; color: #04203a;
  background: linear-gradient(135deg, rgb(var(--accent)), rgba(var(--accent), .55));
  box-shadow: 0 12px 30px -10px rgba(var(--accent), .9), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.h-card:hover .hc-icon { transform: translateY(-2px) rotate(-6deg) scale(1.06); }
.hc-icon svg { width: 54%; height: 54%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hc-body { display: flex; flex-direction: column; gap: clamp(3px, .7vh, 8px); min-width: 0; }
.h-card h2 { margin: 0; font-size: clamp(1rem, 2.2vh, 1.28rem); font-weight: 800; color: #fff; letter-spacing: -.01em; }
.h-card p {
  margin: 0; font-size: clamp(.8rem, 1.55vh, .94rem); line-height: 1.5; color: rgba(230, 241, 255, .74);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.hc-foot { margin-top: auto; padding-top: clamp(2px, .8vh, 8px); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hc-tags { font-size: .78rem; font-weight: 600; color: rgba(230, 241, 255, .6); white-space: nowrap; }
.hc-tags kbd { font-size: .78em; }
.hc-go { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: clamp(.82rem, 1.6vh, .92rem); color: rgb(var(--accent)); white-space: nowrap; }
.hc-go svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.h-card:hover .hc-go svg { transform: translateX(5px); }

/* ---------- Footer ---------- */
.home-foot {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: clamp(.68rem, 1.3vh, .78rem); color: rgba(230, 241, 255, .55); white-space: nowrap;
}
.foot-addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.foot-copy, .foot-wa { flex: none; }
.foot-wa b { color: #5eead4; }
@media (max-width: 1250px) { .foot-addr { display: none; } }
@media (max-width: 560px) { .foot-copy { display: none; } }

/* ---------- Layar desktop pendek (laptop 768p, 720p, dsb.) ---------- */
@media (min-width: 1001px) and (max-height: 820px) {
  .h-card p { -webkit-line-clamp: 2; line-clamp: 2; }
}
@media (min-width: 1001px) and (max-height: 700px) {
  .lead, .hc-tags { display: none; }
  .h-card p { -webkit-line-clamp: 1; line-clamp: 1; }
}
@media (min-width: 1001px) and (max-height: 600px) {
  .ecg, .eyebrow, .h-card p, .foot-addr { display: none; }
  .hc-foot { padding-top: 0; }
  .home-foot { justify-content: flex-end; }
}

/* ---------- Tablet & ponsel: animasi di atas, konten di bawah ---------- */
@media (max-width: 1000px) {
  .scrim { background: linear-gradient(180deg, rgba(6, 26, 51, .1) 0%, rgba(6, 26, 51, .55) 34%, rgba(6, 26, 51, .9) 100%); }
  .hero { align-self: end; max-width: none; }
  .lead { display: none; }

  /* Kartu jadi baris ringkas: ikon | judul + deskripsi singkat | panah */
  .cards { grid-template-columns: 1fr; gap: clamp(6px, 1.1vh, 10px); }
  .h-card { flex-direction: row; align-items: center; gap: 12px; padding: clamp(9px, 1.5vh, 14px) 14px; border-radius: 16px; }
  .h-card::after { left: 12px; right: 12px; }
  .hc-icon { width: clamp(36px, 5.2vh, 46px); height: clamp(36px, 5.2vh, 46px); }
  .hc-body { flex: 1; gap: 2px; }
  .h-card h2 { font-size: clamp(.95rem, 2.1vh, 1.1rem); }
  .h-card p { font-size: clamp(.76rem, 1.5vh, .86rem); -webkit-line-clamp: 1; line-clamp: 1; }
  .hc-foot { margin: 0; padding: 0; flex: none; }
  .hc-tags { display: none; }
  .hc-go { font-size: 0; gap: 0; }
  .hc-go svg { width: 22px; height: 22px; }
  .foot-addr { display: none; }
  .home-foot { justify-content: center; }
}
@media (max-width: 1000px) and (min-height: 960px) {
  .lead { display: block; }
}
@media (max-width: 1000px) and (max-height: 760px) {
  .eyebrow, .ecg { display: none; }
}
@media (max-width: 1000px) and (max-height: 620px) {
  .h-card p, .live-head { display: none; }
}

@media (max-width: 560px) {
  .top-clock { display: none; }
  .live-chip { grid-template-columns: 1fr; gap: 3px; }
  .lc-num { grid-row: auto; }
}
/* Ponsel posisi mendatar (landscape) */
@media (max-width: 1000px) and (max-height: 500px) {
  .home-foot { display: none; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .h-card { padding: 8px 10px; gap: 8px; }
  .hc-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .h-card { transform: none !important; }
}
