/* ========================================================
   EDU SCIENCE — Design tokens
   Palette: soft-green / off-white, nature-led, editorial-organic
   Display: Fraunces (organic, botanical serif)
   Body: Plus Jakarta Sans
   Mono/utility: JetBrains Mono
   ======================================================== */

:root{
  --es-bg:        #FAFBF6;
  --es-bg-tint:   #EEF6EC;
  --es-forest:    #0F4D2E;   /* deep canopy green — primary */
  --es-forest-2:  #14603A;
  --es-leaf:      #6FA85A;   /* soft mid green — accent */
  --es-leaf-2:    #9CC98A;   /* pale leaf */
  --es-sun:       #E7B75F;   /* warm accent, used sparingly */
  --es-ink:       #16241C;
  --es-ink-soft:  #4B5C51;
  --es-line:      #DDE8DC;
  --es-white:     #FFFFFF;

  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--es-ink);
  background:var(--es-bg);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,.font-display{ font-family:var(--font-display); }
.font-mono{ font-family:var(--font-mono); }

a{ color:inherit; }
img{ max-width:100%; display:block; }

::selection{ background:var(--es-leaf-2); color:var(--es-forest); }

:focus-visible{
  outline:3px solid var(--es-sun);
  outline-offset:2px;
  border-radius:4px;
}

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

/* ---------- Layout helpers ---------- */
.wrap{ max-width:1200px; margin:0 auto; padding-left:20px; padding-right:20px; }
.leaf-divider{
  height:6px;
  width:100%;
  background:linear-gradient(90deg, var(--es-forest) 0%, var(--es-leaf) 45%, var(--es-leaf-2) 75%, var(--es-forest) 100%);
  background-size:200% 100%;
}

/* ---------- Header ---------- */
#site-header{ position:sticky; top:0; z-index:50; background:rgba(250,251,246,0.92); backdrop-filter:blur(8px); border-bottom:1px solid var(--es-line); }
.nav-link{ position:relative; font-weight:600; font-size:14.5px; color:var(--es-ink); padding:8px 2px; }
.nav-link::after{
  content:""; position:absolute; left:0; right:0; bottom:2px; height:2px; background:var(--es-leaf);
  transform:scaleX(0); transform-origin:left; transition:transform .25s ease;
}
.nav-link:hover::after, .nav-link.active::after{ transform:scaleX(1); }
.nav-link.active{ color:var(--es-forest); }

.dropdown{ position:relative; }
/* The panel sits flush against the trigger (top:100%) and uses padding-top
   instead of a margin/offset to create its visual gap. Padding is still part
   of the element's hoverable box, so the mouse never leaves .dropdown while
   crossing the gap — this is what previously made the menu close instantly. */
.dropdown-panel{
  position:absolute; top:100%; left:50%; transform:translateX(-50%) translateY(0);
  min-width:230px; padding-top:10px;
  opacity:0; pointer-events:none; transition:opacity .18s ease;
}
.dropdown:hover .dropdown-panel, .dropdown:focus-within .dropdown-panel, .dropdown-panel.open{
  opacity:1; pointer-events:auto;
}
.dropdown-panel-inner{
  background:var(--es-white); border:1px solid var(--es-line); border-radius:14px;
  box-shadow:0 18px 40px -12px rgba(15,77,46,0.22); padding:8px;
}
.dropdown-panel a{ display:block; padding:10px 12px; border-radius:9px; font-size:14px; font-weight:600; color:var(--es-ink-soft); }
.dropdown-panel a:hover{ background:var(--es-bg-tint); color:var(--es-forest); }

/* ---------- Buttons ---------- */
.btn{ display:inline-flex; align-items:center; gap:8px; font-weight:700; font-size:14.5px; padding:12px 22px; border-radius:999px; transition:all .2s ease; border:2px solid transparent; cursor:pointer; }
.btn-primary{ background:var(--es-forest); color:#fff; box-shadow:0 10px 24px -10px rgba(15,77,46,0.55); }
.btn-primary:hover{ background:var(--es-forest-2); transform:translateY(-2px); }
.btn-outline{ border-color:var(--es-forest); color:var(--es-forest); background:transparent; }
.btn-outline:hover{ background:var(--es-forest); color:#fff; }
.btn-sun{ background:var(--es-sun); color:var(--es-forest); }
.btn-sun:hover{ filter:brightness(0.95); transform:translateY(-2px); }

/* ---------- Cards ---------- */
.card{ background:var(--es-white); border:1px solid var(--es-line); border-radius:20px; overflow:hidden; transition:transform .25s ease, box-shadow .25s ease; }
.card:hover{ transform:translateY(-6px); box-shadow:0 24px 48px -20px rgba(15,77,46,0.28); }

/* ---------- Reading progress ---------- */
#reading-progress-wrap{ position:sticky; top:64px; z-index:40; height:5px; background:var(--es-line); }
#reading-progress-bar{ height:100%; width:0%; background:linear-gradient(90deg,var(--es-forest),var(--es-leaf)); transition:width .1s linear; }

/* ---------- Hero organic blob ---------- */
.blob-bg{ position:absolute; inset:0; background-size:cover; background-position:center; }
.blob-overlay{ position:absolute; inset:0; background:linear-gradient(180deg, rgba(10,40,25,0.78) 0%, rgba(10,40,25,0.55) 55%, rgba(250,251,246,1) 100%); }

/* ---------- Footer ---------- */
#site-footer{ background:var(--es-forest); color:#EAF3EA; }
#site-footer a:hover{ color:var(--es-leaf-2); }
.footer-heading{ font-family:var(--font-display); font-size:15px; letter-spacing:.03em; color:var(--es-leaf-2); margin-bottom:14px; }

/* ---------- Testimonial carousel ---------- */
.testi-track{ display:flex; transition:transform .6s cubic-bezier(.65,0,.35,1); }
.testi-slide{ flex:0 0 100%; }

/* ---------- News card date badge ---------- */
.date-badge{ background:var(--es-white); border-radius:12px; padding:6px 10px; box-shadow:0 8px 20px -10px rgba(15,77,46,0.4); }

/* ---------- Zoomable image ---------- */
.zoomable{ cursor:zoom-in; }
#lightbox{ position:fixed; inset:0; background:rgba(10,25,17,0.92); display:none; align-items:center; justify-content:center; z-index:100; padding:24px; }
#lightbox.open{ display:flex; }
#lightbox img{ max-width:95vw; max-height:92vh; border-radius:10px; cursor:zoom-out; }

/* ---------- Accordion (AR viewer) buttons ---------- */
.ar-btn{ flex:1 1 calc(33.333% - 10px); min-width:140px; padding:12px 15px; background:var(--es-forest); color:#fff; border:none; border-radius:10px; cursor:pointer; font-size:13.5px; font-weight:700; transition:background-color .2s ease; box-shadow:0 6px 16px -8px rgba(0,0,0,.35); }
.ar-btn:hover{ background:var(--es-forest-2); }
.ar-btn.active{ background:#0A331E; box-shadow:inset 0 2px 6px rgba(0,0,0,.35); }
.ar-frame{ display:none; width:100%; aspect-ratio:16/10; border:2px solid var(--es-line); border-radius:14px; overflow:hidden; }
.ar-frame iframe{ width:100%; height:100%; border:none; }

/* ---------- Info box ---------- */
.info-box{ background:var(--es-bg-tint); border-left:4px solid var(--es-leaf); border-radius:12px; padding:16px 18px; }

/* ---------- Language / search ---------- */
.lang-btn{ font-weight:700; font-size:13px; padding:4px 8px; border-radius:8px; }
.lang-btn.active{ background:var(--es-bg-tint); color:var(--es-forest); }

/* mobile nav */
#mobile-menu{ display:none; }
#mobile-menu.open{ display:block; }

/* ---------- Latihan quiz-runner game ---------- */
.subject-pick{ border:2px solid var(--es-line); border-radius:20px; padding:26px; text-align:left; transition:all .2s ease; background:#fff; }
.subject-pick:hover{ border-color:var(--es-leaf); transform:translateY(-4px); box-shadow:0 20px 40px -18px rgba(15,77,46,0.3); }

#quiz-track{ position:relative; height:70px; margin-bottom:34px; }
.track-line{ position:absolute; top:50%; left:0; right:0; height:6px; background:var(--es-line); border-radius:6px; transform:translateY(-50%); }
.flags-wrap{ position:absolute; inset:0; }
.flag{ position:absolute; top:50%; transform:translate(-50%,-50%); font-size:14px; opacity:.55; }
.runner{ position:absolute; top:50%; transform:translateY(-50%); font-size:28px; transition:left .5s cubic-bezier(.65,0,.35,1); }
.runner.jump{ animation:runnerJump .5s ease; }
.runner.stumble{ animation:runnerStumble .4s ease; }
@keyframes runnerJump{ 0%{ transform:translateY(-50%);} 40%{ transform:translate(0,-140%) rotate(-8deg);} 100%{ transform:translateY(-50%);} }
@keyframes runnerStumble{ 0%,100%{ transform:translateY(-50%);} 30%{ transform:translate(-4px,-45%) rotate(-6deg);} 60%{ transform:translate(4px,-55%) rotate(6deg);} }

.quiz-opt{ display:flex; align-items:center; gap:12px; width:100%; text-align:left; padding:14px 16px; border:2px solid var(--es-line); border-radius:14px; font-size:14.5px; font-weight:600; color:var(--es-ink); background:#fff; transition:all .15s ease; }
.quiz-opt:hover:not(:disabled){ border-color:var(--es-leaf); background:var(--es-bg-tint); }
.quiz-opt-letter{ width:26px; height:26px; border-radius:50%; background:var(--es-bg-tint); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; color:var(--es-forest); flex-shrink:0; }
.quiz-opt-correct{ border-color:var(--es-forest) !important; background:#E5F3E4 !important; }
.quiz-opt-wrong{ border-color:#DC2626 !important; background:#FDECEC !important; }
.quiz-opt:disabled{ cursor:default; }

/* ========================================================
   Dropdown — JS-controlled open state (fixes "closes too fast")
   ======================================================== */
.dropdown-panel{ transition:opacity .18s ease, transform .18s ease; }
.dropdown-panel.open{ opacity:1; pointer-events:auto; transform:translateX(-50%) translateY(0); }

/* ========================================================
   Gallery — auto-rotating carousel with arrows
   ======================================================== */
.gallery-cat{ background:#fff; border:1px solid var(--es-line); border-radius:24px; overflow:hidden; margin-bottom:32px; }
.gallery-stage{ position:relative; width:100%; aspect-ratio:16/9; overflow:hidden; background:var(--es-bg-tint); }
.gallery-slide{ position:absolute; inset:0; opacity:0; transition:opacity .6s ease; }
.gallery-slide.active{ opacity:1; }
.gallery-slide img{ width:100%; height:100%; object-fit:cover; }
.gallery-arrow{ position:absolute; top:50%; transform:translateY(-50%); width:42px; height:42px; border-radius:50%; background:rgba(255,255,255,0.9); border:none; display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 8px 20px -8px rgba(15,77,46,0.5); transition:background .2s ease; z-index:5; }
.gallery-arrow:hover{ background:#fff; }
.gallery-arrow.prev{ left:14px; }
.gallery-arrow.next{ right:14px; }
.gallery-dots{ position:absolute; bottom:14px; left:0; right:0; display:flex; justify-content:center; gap:7px; z-index:5; }
.gallery-dot{ width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,0.55); border:none; cursor:pointer; padding:0; }
.gallery-dot.active{ background:#fff; width:22px; border-radius:5px; transition:all .25s ease; }
.gallery-cat-title{ padding:18px 22px; font-family:var(--font-display); font-size:19px; font-weight:600; color:var(--es-ink); border-bottom:1px solid var(--es-line); }

/* ========================================================
   Forum Diskusi
   ======================================================== */
.forum-tab{ padding:10px 20px; border-radius:999px; font-weight:700; font-size:14px; border:2px solid var(--es-line); background:#fff; color:var(--es-ink-soft); cursor:pointer; transition:all .2s ease; }
.forum-tab.active{ background:var(--es-forest); border-color:var(--es-forest); color:#fff; }
.forum-topic-btn{ display:block; width:100%; text-align:left; padding:16px 18px; border:2px solid var(--es-line); border-radius:16px; background:#fff; cursor:pointer; transition:all .2s ease; }
.forum-topic-btn:hover{ border-color:var(--es-leaf); }
.forum-topic-btn.active{ border-color:var(--es-forest); background:var(--es-bg-tint); }
.forum-comment{ border:1px solid var(--es-line); border-radius:14px; padding:14px 16px; background:#fff; }
.forum-comment .avatar{ width:34px; height:34px; border-radius:50%; background:var(--es-forest); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:13px; flex-shrink:0; }

/* ========================================================
   Perpustakaan — book cards
   ======================================================== */
.book-card{ background:#fff; border:1px solid var(--es-line); border-radius:16px; overflow:hidden; transition:transform .2s ease, box-shadow .2s ease; }
.book-card:hover{ transform:translateY(-5px); box-shadow:0 20px 40px -18px rgba(15,77,46,0.3); }
.book-card img{ aspect-ratio:3/4; width:100%; object-fit:cover; }

/* ========================================================
   Tentang Kami — team member cards
   ======================================================== */
.team-card img{ width:88px; height:88px; border-radius:50%; object-fit:cover; margin:0 auto; }

/* ========================================================
   Testimonial arrows (works alongside existing .testi-track)
   ======================================================== */
.testi-arrow{ width:40px; height:40px; border-radius:50%; background:#fff; border:1px solid var(--es-line); display:flex; align-items:center; justify-content:center; cursor:pointer; box-shadow:0 8px 20px -10px rgba(15,77,46,0.4); transition:background .2s ease; }
.testi-arrow:hover{ background:var(--es-bg-tint); }
