/*
  Theme system:
  - Default follows OS (prefers-color-scheme)
  - Can be overridden with: <html data-theme="light"> or "dark"
*/

/* =========================
   THEME TOKENS
========================= */
:root{
  --bg-dark: url("./assets/bg-dark.webp");
  --bg-light: url("./assets/bg-light.webp");
  --bg: var(--bg-dark);

  /* core */
  --page-bg: #050814;
  --text: #ffffff;

  /* glass card */
  --card-bg: rgba(10, 14, 30, .55);
  --card-border: rgba(120, 190, 255, .15);

  /* background image treatment */
  --bg-filter: brightness(.78) contrast(1.05) saturate(.95);

  /* vignette / overlays (dark) */
  --v1: radial-gradient(1200px 800px at 50% 10%, rgba(50, 150, 220, .18), transparent 62%);
  --v2: none;
  --v3: linear-gradient(to bottom, rgba(0,0,0,.08), rgba(0,0,0,.20));
  --vignette-blend: multiply;

  /* canvas FX colors (space separated RGB) */
  --fx-glow-rgb: 90 190 255;
  --fx-line-rgb: 70 170 240;
}

/* Auto light theme (OS preference) */
@media (prefers-color-scheme: light){
  :root{
    --bg: var(--bg-light);
    --page-bg: #f7f9ff;
    --text: #0b1220;

    --card-bg: rgba(255,255,255,.62);
    --card-border: rgba(10, 30, 70, .14);

    --bg-filter: brightness(1.08) contrast(1.02) saturate(1.0);

    --v1: radial-gradient(1200px 800px at 50% 10%, rgba(255,255,255,.55), transparent 55%);
    --v2: radial-gradient(1000px 700px at 50% 80%, rgba(255,255,255,.0), rgba(0,0,0,.10) 60%, rgba(0,0,0,.18) 100%);
    --v3: linear-gradient(to bottom, rgba(255,255,255,.12), rgba(255,255,255,.0));
    --vignette-blend: normal;

    --fx-glow-rgb: 25 90 155;
    --fx-line-rgb: 30 110 185;
  }
}

/* Manual overrides */
html[data-theme="dark"]{ color-scheme: dark; }
html[data-theme="light"]{
  color-scheme: light;
  --bg: var(--bg-light);
  --page-bg: #f7f9ff;
  --text: #0b1220;
  --card-bg: rgba(255,255,255,.62);
  --card-border: rgba(10, 30, 70, .14);
  --bg-filter: brightness(1.08) contrast(1.02) saturate(1.0);
  --v1: radial-gradient(1200px 800px at 50% 10%, rgba(255,255,255,.55), transparent 55%);
  --v2: radial-gradient(1000px 700px at 50% 80%, rgba(255,255,255,.0), rgba(0,0,0,.10) 60%, rgba(0,0,0,.18) 100%);
  --v3: linear-gradient(to bottom, rgba(255,255,255,.12), rgba(255,255,255,.0));
  --vignette-blend: normal;
  --fx-glow-rgb: 25 90 155;
  --fx-line-rgb: 30 110 185;
}

/* =========================
   STICKY FOOTER LAYOUT
   (copyright nempel bawah kalau halaman pendek)
========================= */
html, body{ height: 100%; }

body{
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================
   BACKGROUND LAYERS
========================= */
.bg-wrap{
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg-image{
  position: absolute;
  inset: 0;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.02);
  filter: var(--bg-filter);
}

canvas#fx{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bg-vignette{
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--v1), var(--v2), var(--v3);
  mix-blend-mode: var(--vignette-blend);
}

@media (prefers-reduced-motion: reduce){
  canvas#fx{ display: none; }
}

/* =========================
   THEME BUTTON
========================= */
.theme-toggle{
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;

  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 10px 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  backdrop-filter: blur(10px);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;

  background: transparent;
  color: inherit;

  transition: background-color .18s ease,
              border-color .18s ease,
              color .18s ease,
              transform .12s ease;
}

.theme-toggle[data-next="light"]{
  background: rgba(255,255,255,.85);
  border-color: rgba(0,0,0,.10);
  color: #0b1020;
}
.theme-toggle[data-next="dark"]{
  background: rgba(10,14,28,.70);
  border-color: rgba(255,255,255,.18);
  color: #ffffff;
}

.theme-label{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
  line-height: 1;
  text-transform: uppercase;
}

.theme-label .tl-top{
  font: 800 9px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: .7px;
  opacity: .75;
  white-space: nowrap;
}
.theme-label .tl-bot{
  margin-top: 2px;
  font: 900 clamp(8px, 1.6vw, 10px)/1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: .6px;
  white-space: nowrap;
}

@media (max-width: 600px){
  .theme-label{ display: none; }
}

.theme-icon{
  display: inline-flex;
  width: 18px;
  height: 18px;
  line-height: 0;
}
.theme-icon svg{ display: block; }

.theme-toggle:hover{ transform: translateY(-1px); }
.theme-toggle:active{ transform: translateY(0); }
.theme-toggle:focus-visible{
  outline: 2px solid rgba(255,255,255,.35);
  outline-offset: 3px;
}

@media (max-width: 1024px){
  .theme-toggle{
    top: 14px;
    right: 14px;
    padding: 9px 11px;
  }
  .theme-icon{ width: 18px; height: 18px; }
}

@media (max-width: 600px){
  .theme-toggle{
    top: 10px;
    right: 12px;
    padding: 8px 10px;
  }
  .theme-icon{ width: 16px; height: 16px; }
}

/* =========================
   LOGO
========================= */
@font-face{
  font-family: "Feast of Flesh BB";
  src:
    url("./assets/fonts/FEASTF.woff2") format("woff2"),
    url("./assets/fonts/FEASTF.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.brand{
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;

  display: inline-flex;
  align-items: center;
  gap: 0px;

  text-decoration: none;
  color: var(--text);

  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 1024px){ .brand{ top: 14px; } }
@media (max-width: 600px){ .brand{ top: 10px; } }

.brand-logo{
  width: 60px;
  height: 60px;
  display: block;
}

.brand-text{
  font-family: "Feast of Flesh BB", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  font-size: 54px;
  line-height: .1;
  letter-spacing: 3px;
}

@media (max-width: 600px){
  .brand-logo{ width: 34px; height: 34px; }
  .brand-text{ font-size: 28px; }
}

/* =========================
   CONTENT / CARDS
========================= */
.content{
  position: relative;
  z-index: 10;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;

  padding-top: 120px;
  padding-bottom: 64px;

  flex: 1 0 auto; /* penting untuk sticky footer */
}

@media (max-width: 1024px){
  .content{
    width: min(980px, calc(100% - 36px));
    padding-top: 110px;
  }
}
@media (max-width: 600px){
  .content{
    width: calc(100% - 28px);
    padding-top: 96px;
    padding-bottom: 44px;
  }
}

.cards-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

@media (max-width: 1024px){
  .cards-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px){
  .cards-grid{ grid-template-columns: 1fr; }
}

.card{
  border-radius: 28px;
  overflow: hidden;

  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  border: 1px solid var(--card-border);

  box-shadow:
    0 18px 44px rgba(0,0,0,.35),
    0 2px 10px rgba(0,0,0,.18);

  transform: translateY(0);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover{
  transform: translateY(-4px);
  box-shadow:
    0 26px 58px rgba(0,0,0,.42),
    0 8px 18px rgba(0,0,0,.22);
}

.card__media{
  position: relative;
  height: 260px;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  filter: saturate(.95) contrast(1.05) brightness(.92);
}

.card__media::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.18),
    rgba(0,0,0,.06) 45%,
    rgba(0,0,0,.55));
  pointer-events: none;
}

html[data-theme="light"] .card__media::after{
  background: linear-gradient(to bottom,
    rgba(0,0,0,.12),
    rgba(0,0,0,.04) 45%,
    rgba(0,0,0,.40));
}

.card__body{ padding: 18px 20px 22px; }

.card__title{
  margin: 0 0 10px;
  font: 800 28px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: .2px;
}

.card__desc{
  margin: 0 0 16px;
  font: 500 15px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  opacity: .82;
}

.card__link{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 15px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  text-decoration: none;
}
.card__link:hover{ text-decoration: underline; }

@media (max-width: 600px){
  .card__media{ height: 230px; }
  .card__title{ font-size: 26px; }
}

/* ================================
   "Lebih lanjut →" + stickman bonk
================================ */
.card__link.more-bonk{
  text-decoration: none;
}
.card__link.more-bonk:hover{
  text-decoration: underline;
}
.card__link.more-bonk:visited{
  color: var(--text);
}

.card__link.more-bonk .bonk{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card__link.more-bonk .arrow{
  display: inline-block;
  will-change: transform;
  animation: arrowBonk 5s ease-in-out infinite;
}

.card__link.more-bonk .mini-man{
  width: 32px;
  height: 16px;
  margin-left: 2px;
  opacity: .95;

  transform-origin: 18px 28px;
  will-change: transform;
  animation: manBonk 5s ease-in-out infinite;
}

/* Hover card: stickman hilang + pause animasi */
.card:hover .card__link.more-bonk .mini-man,
.card:focus-within .card__link.more-bonk .mini-man{
  opacity: 0;
}

.card:hover .card__link.more-bonk .arrow,
.card:hover .card__link.more-bonk .mini-man,
.card:focus-within .card__link.more-bonk .arrow,
.card:focus-within .card__link.more-bonk .mini-man{
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce){
  .card__link.more-bonk .arrow,
  .card__link.more-bonk .mini-man{
    animation: none !important;
  }
}

/* Keyframes: panah nabrak -> berhenti -> didorong balik */
@keyframes arrowBonk{
  0%   { transform: translateX(0); }
  44%  { transform: translateX(0); }

  56%  { transform: translateX(12px); }  /* impact */
  92%  { transform: translateX(12px); }  /* hold */

  94%  { transform: translateX(-8px); }  /* pushed back */
  98%  { transform: translateX(0); }
  100% { transform: translateX(0); }
}

@keyframes manBonk{
  0%   { transform: translateX(0) translateY(0) rotate(0deg); }
  58%  { transform: translateX(0) translateY(0) rotate(0deg); }

  62%  { transform: translateX(50px) translateY(0) rotate(28deg); }  /* knocked */
  68%  { transform: translateX(54px) translateY(6px) rotate(92deg); }/* down */
  82%  { transform: translateX(54px) translateY(6px) rotate(92deg); }/* stay */

  88%  { transform: translateX(42px) translateY(2px) rotate(30deg); }/* get up */
  91%  { transform: translateX(12px) translateY(0) rotate(0deg); }   /* touch */
  94%  { transform: translateX(24px) translateY(0) rotate(0deg); }   /* push */

  100% { transform: translateX(0) translateY(0) rotate(0deg); }
}

/* =========================
   QUOTE (dekat cards)
   Tempatkan <div class="quote-near-cards"> ... </div>
   setelah .cards-grid (di dalam .content)
========================= */
.quote-near-cards{
  margin: 72px auto 0;
  text-align: center;
  pointer-events: none;
  color: var(--text);

  font-family: "Lora", serif;
  font-weight: 400;
  font-size: 42px;
  line-height: 1.15;
  letter-spacing: .2px;
  opacity: .92;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
}

@media (max-width: 1024px){
  .quote-near-cards{
    margin-top: 26px;
    font-size: 28px;
    line-height: 1.2;
  }
}
@media (max-width: 600px){
  .quote-near-cards{
    margin-top: 24px;
    font-size: 18px;
  }
}

/* =========================
   COPYRIGHT (sticky footer)
   <footer class="site-copy">...</footer>
   letakkan setelah </main>
========================= */
.site-copy{
  margin-top: auto;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  text-align: center;

  position: relative;
  z-index: 10;
  pointer-events: none;

  font: 600 11px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  opacity: .72;
  text-shadow: 0 2px 16px rgba(0,0,0,.35);
}

@media (max-width: 600px){
  .site-copy{ font-size: 10px; }
}

/* Login Button */
.internal-btn {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 9999;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 5px 12px;

  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;

  color: rgba(255,255,255,.85);
  text-decoration: none;

  transition: all .2s ease;
}

.internal-btn .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
}

.internal-btn:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.35);
  color: #fff;
  transform: translateY(-1px);
}

/* page fade transition */
.page-overlay {
  position: fixed;
  inset: 0;
  background: #050814;
  opacity: 0;
  pointer-events: none;
  z-index: 999999;
  transition: opacity .4s ease;
}

.page-overlay.active {
  opacity: 1;
}

.staff-terminal {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(59, 130, 246, 0.5) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.staff-terminal:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 10px #3b82f6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}