:root {
  --primary: #0E6B5C;
  --primary-dark: #09473D;
  --primary-light: #E6F5EE;
  --surface: #F1F4F2;
  --card-bg: #FFFFFF;
  --text-main: #12261F;
  --text-muted: #566A63;
  --border-color: #E2E8F0;
  --accent-green: #0E7A55;
  --accent-red: #B83A2E;
  --leaf-transition: 0.78s cubic-bezier(0.25, 0.9, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--surface);
  color: var(--text-main);
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Viewport & 3D Book Frame
   ========================================================================== */
.viewport {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  perspective: 2600px;
  -webkit-perspective: 2600px;
  position: relative;
  box-sizing: border-box;
}

/* Zoom Container (Pusat Pembesaran 3D & Dobel Klik) */
.zoom-container {
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: scale(1);
  transform-origin: center center;
  will-change: transform;
}

.zoom-container.is-zoomed {
  cursor: zoom-out;
}

/* 3D Book Frame - Fleksibel Mengisi Ruang Layar */
.book {
  position: relative;
  width: min(94vw, calc((100vh - 84px) * 1.48));
  height: min(calc(100vh - 84px), calc(94vw / 1.48));
  max-width: 1400px;
  max-height: 880px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow:
    -3px 2px 0 -1px #E2E8F0,
    3px 2px 0 -1px #E2E8F0,
    -6px 4px 0 -2px #ECEEEF,
    6px 4px 0 -2px #ECEEEF,
    0 20px 50px rgba(18, 38, 31, 0.12);
  user-select: none;
  transition: transform var(--leaf-transition), box-shadow var(--leaf-transition);
}

/* State Awal: Sampul Depan Tertutup (Satu Tampilan Tunggal Terpusat) */
.book.is-closed-start {
  transform: translateX(-25%);
  box-shadow: none;
  background: transparent;
}

.book.is-closed-start .book-spine-crease {
  opacity: 0;
  pointer-events: none;
}

.book.is-closed-start #leaf1 .page-front {
  display: block !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 45px rgba(18, 38, 31, 0.14);
  border-left: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book.is-closed-start #leaf1 .page-back {
  display: none !important;
}

@media (hover: hover) and (min-width: 769px) {

    .book.is-closed-start #leaf1:hover .page-front {
      box-shadow: 0 24px 55px rgba(18, 38, 31, 0.22);
    }
  }

  /* State Akhir: Sampul Belakang Tertutup (Satu Tampilan Tunggal Terpusat) */
  .book.is-closed-end {
    transform: translateX(25%);
    box-shadow: none;
    background: transparent;
  }

  .book.is-closed-end .book-spine-crease {
    opacity: 0;
    pointer-events: none;
  }

  .book.is-closed-end #leaf4 .page-front {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  .book.is-closed-end #leaf4 .page-back {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 45px rgba(18, 38, 31, 0.14);
    border-right: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  @media (hover: hover) and (min-width: 769px) {

      .book.is-closed-end #leaf4:hover .page-back {
        box-shadow: 0 24px 55px rgba(18, 38, 31, 0.22);
      }
    }

    /* Spine Center Crease (Garis Lipatan Tengah Alami) */
    .book-spine-crease {
      position: absolute;
      top: 0;
      bottom: 0;
      left: calc(50% - 15px);
      width: 30px;
      background: linear-gradient(to right,
          rgba(0, 0, 0, 0.01) 0%,
          rgba(0, 0, 0, 0.05) 35%,
          rgba(0, 0, 0, 0.12) 50%,
          rgba(0, 0, 0, 0.05) 65%,
          rgba(0, 0, 0, 0.01) 100%);
      z-index: 100;
      pointer-events: none;
      transition: opacity var(--leaf-transition);
    }

    /* ==========================================================================
   3D Flipping Leaf (Lembaran Buku)
   ========================================================================== */
    .leaf {
      position: absolute;
      top: 0;
      right: 0;
      width: 50%;
      height: 100%;
      transform-origin: left center;
      transform-style: preserve-3d;
      -webkit-transform-style: preserve-3d;
      transition: transform var(--leaf-transition);
      cursor: pointer;
    }


      .leaf.flipping .page-front,
      .leaf.flipping .page-back {
        box-shadow: 0 24px 48px rgba(18, 38, 31, 0.22);
      }

      .page-face {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        box-sizing: border-box;
      }

      .page-front {
        transform: rotateY(0deg) translateZ(1.5px);
        -webkit-transform: rotateY(0deg) translateZ(1.5px);
        border-radius: 0 14px 14px 0;
        border-left: 1px solid rgba(0, 0, 0, 0.06);
        background-color: var(--card-bg);
        transition: border-radius var(--leaf-transition), box-shadow var(--leaf-transition);
      }

      .page-back {
        transform: rotateY(-180deg) translateZ(1.5px);
        -webkit-transform: rotateY(-180deg) translateZ(1.5px);
        border-radius: 14px 0 0 14px;
        border-right: 1px solid rgba(0, 0, 0, 0.06);
        background-color: var(--card-bg);
        transition: border-radius var(--leaf-transition), box-shadow var(--leaf-transition);
      }

      /* Sampul Depan Tunggal (#leaf1 .page-front) */
      #leaf1 .page-front {
        background: linear-gradient(145deg, #0E6B5C 0%, #09473D 100%);
        border-left: 1px solid rgba(0, 0, 0, 0.12);
        color: #FFFFFF;
      }

      /* Sampul Belakang Resmi (#leaf4 .page-back) */
      #leaf4 .page-back {
        background: linear-gradient(145deg, #09473D 0%, #0E6B5C 100%);
        color: #FFFFFF;
      }

      /* Inner Page Container */
      .page-inner {
        width: 100%;
        height: 100%;
        padding: clamp(22px, 3.8vh, 40px) clamp(20px, 2.8vw, 38px);
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
        position: relative;
        background-color: var(--card-bg);
        overflow-y: auto;
        border-radius: inherit;
      }

      /* Page Inner Fold Shading */
      .page-front .page-inner::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 20px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.04), transparent);
        pointer-events: none;
      }

      .page-back .page-inner::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        width: 20px;
        background: linear-gradient(to left, rgba(0, 0, 0, 0.04), transparent);
        pointer-events: none;
      }

      /* Cover Styling (Halaman Sampul) */
      .page-cover-inner {
        background: transparent !important;
        color: #FFFFFF;
        text-align: center;
        align-items: center;
        justify-content: space-between;
        padding: clamp(26px, 4.5vh, 48px) clamp(20px, 3vw, 40px);
      }

      .page-cover-inner::before {
        display: none !important;
      }

      .cover-badge {
        display: inline-block;
        background: rgba(255, 255, 255, 0.16);
        border: 1px solid rgba(255, 255, 255, 0.28);
        color: #FFFFFF;
        padding: 5px 16px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.8px;
      }

      .cover-main {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
      }

      .avatar-circle {
        width: 76px;
        height: 76px;
        background-color: #FFFFFF;
        color: var(--primary-dark);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        font-weight: 800;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
        margin-bottom: 8px;
      }

      .cover-name {
        font-size: clamp(22px, 2.3vw, 30px);
        font-weight: 800;
        color: #FFFFFF;
        line-height: 1.25;
      }

      .cover-role {
        font-size: clamp(12px, 1.1vw, 14px);
        color: #7ED6BC;
        font-weight: 600;
      }

      .cover-tagline {
        font-size: 11.5px;
        font-weight: 700;
        color: #D1EAE2;
        letter-spacing: 0.6px;
        margin-top: 2px;
        text-transform: uppercase;
      }

      .cover-summary {
        font-size: clamp(12.5px, 1.15vw, 14px);
        color: #D1EAE2;
        line-height: 1.6;
        max-width: 380px;
        margin: 6px auto 0;
      }

      .cover-pill-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: rgba(255, 255, 255, 0.16);
        color: #FFFFFF;
        border: 1px solid rgba(255, 255, 255, 0.35);
        padding: 8px 22px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
        transition: all 0.2s ease;
      }

      .cover-pill-btn:hover {
        background: rgba(255, 255, 255, 0.26);
        transform: translateY(-1px);
      }

      .cover-hint {
        font-size: 12px;
        font-weight: 600;
        color: #A3D4C4;
        padding: 8px 16px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: all 0.2s ease;
      }

      /* Page Header */
      .page-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 10px;
        margin-bottom: 14px;
      }

      .page-category {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--primary);
      }

      .page-num {
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
      }

      .page-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 12px;
      }

      .page-footer {
        font-size: 10.5px;
        color: var(--text-muted);
        text-align: center;
        border-top: 1px solid var(--border-color);
        padding-top: 8px;
        margin-top: 10px;
      }

      /* Fluid Scalable Typography */
      h1 {
        font-size: clamp(22px, 2.2vw, 28px);
        font-weight: 800;
        line-height: 1.25;
        color: var(--text-main);
      }

      h2 {
        font-size: clamp(16.5px, 1.7vw, 21px);
        font-weight: 800;
        color: var(--text-main);
      }

      h3 {
        font-size: 13.5px;
        font-weight: 700;
        color: var(--text-main);
      }

      p {
        font-size: 12.5px;
        color: var(--text-muted);
        line-height: 1.55;
      }

      /* Content Components */
      .stats-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin: 4px 0;
      }

      .stat-item {
        background-color: var(--surface);
        border: 1px solid var(--border-color);
        padding: 10px 8px;
        border-radius: 10px;
        text-align: center;
      }

      .stat-value {
        font-size: clamp(16px, 1.6vw, 19px);
        font-weight: 800;
        color: var(--primary);
        font-variant-numeric: tabular-nums;
      }

      .stat-label {
        font-size: 10.5px;
        color: var(--text-muted);
        margin-top: 2px;
        font-weight: 600;
      }

      .card-box {
        background-color: var(--surface);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 12px 14px;
      }

      .pill-tag {
        display: inline-block;
        background-color: var(--surface);
        color: var(--primary);
        border: 1px solid var(--border-color);
        padding: 4px 10px;
        border-radius: 6px;
        font-size: 11px;
        font-weight: 600;
        margin-right: 4px;
        margin-bottom: 6px;
      }

      .project-card {
        background-color: var(--surface);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 10px 12px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
      }

      .project-card:hover {
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(14, 107, 92, 0.08);
      }

      .project-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
      }

      .project-header h3 {
        font-size: 13px;
        font-weight: 700;
        margin: 0;
        color: var(--text-main);
      }

      .project-card p {
        font-size: 11px;
        line-height: 1.45;
        color: var(--text-muted);
        margin: 2px 0 4px 0;
      }

      .project-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
      }

      .project-tag {
        font-size: 9.5px;
        font-weight: 700;
        color: var(--primary);
        background-color: var(--primary-light);
        padding: 2px 7px;
        border-radius: 4px;
        white-space: nowrap;
      }

      .quote-box {
        font-style: italic;
        font-size: 12px;
        color: var(--text-main);
        line-height: 1.5;
        border-left: 3px solid var(--primary);
        padding-left: 10px;
        margin-bottom: 6px;
      }

      .quote-author {
        font-size: 11px;
        font-weight: 700;
        color: var(--primary);
        text-align: right;
      }

      .contact-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 270px;
        margin: 10px 0;
      }

      .btn-action {
        height: 42px;
        min-height: 42px;
        padding: 0 16px;
        font-size: 12px;
        font-weight: 700;
        border-radius: 10px;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        box-sizing: border-box;
        width: 100%;
        font-family: inherit;
        line-height: 1;
        border: 1.5px solid transparent;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
      }

      .btn-action svg {
        flex-shrink: 0;
      }

      .btn-action:active {
        transform: scale(0.985);
      }

      .btn-action:focus-visible {
        outline: 2px solid var(--accent-gold);
        outline-offset: 2px;
      }

      .btn-whatsapp {
        background-color: #25D366;
        color: #FFFFFF;
        border-color: #20BA5A;
      }

      .btn-whatsapp:hover {
        background-color: #20BA5A;
        border-color: #1DA851;
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
      }

      .btn-primary {
        background-color: var(--primary);
        color: #FFFFFF;
        border-color: var(--primary);
      }

      .btn-primary:hover {
        background-color: var(--primary-dark);
        border-color: var(--primary-dark);
        box-shadow: 0 4px 12px rgba(14, 107, 92, 0.25);
      }

      .btn-outline {
        background-color: #FFFFFF;
        color: var(--primary);
        border-color: var(--primary);
      }

      .btn-outline:hover {
        background-color: var(--primary-light);
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(14, 107, 92, 0.15);
      }

      /* Toast Notifikasi Interaksi */
      .toast-notification {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%) translateY(14px);
        background-color: #0E3B33;
        color: #FFFFFF;
        font-size: 12px;
        font-weight: 600;
        padding: 9px 18px;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(9, 71, 61, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.18);
        display: flex;
        align-items: center;
        gap: 8px;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
        z-index: 9999;
        max-width: 90vw;
        text-align: center;
      }

      .toast-notification.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
      }

      /* ==========================================================================
   Bottom Controls Toolbar
   ========================================================================== */
      .controls-toolbar {
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
        gap: 8px;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 6px 14px;
        border-radius: 999px;
        box-shadow: 0 4px 20px rgba(18, 38, 31, 0.08);
        border: 1px solid var(--border-color);
        z-index: 200;
        flex-shrink: 0;
      }

      .nav-btn,
      .btn-fullscreen,
      .btn-zoom,
      .btn-sound {
        height: 36px;
        padding: 0 14px;
        font-size: 12px;
        font-weight: 700;
        color: var(--primary);
        background-color: #FFFFFF;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: all 0.2s ease;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
      }

      .nav-btn:hover:not(:disabled),
      .btn-fullscreen:hover,
      .btn-zoom:hover,
      .btn-sound:hover {
        background-color: var(--primary);
        color: #FFFFFF;
        border-color: var(--primary);
      }

      .btn-zoom.active {
        background-color: var(--primary-dark);
        color: #FFFFFF;
        border-color: var(--primary-dark);
      }

      .btn-sound.is-muted {
        opacity: 0.65;
        background-color: #F8FAFC;
        color: var(--text-muted);
      }

      .nav-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        background-color: #F8FAFC;
        color: var(--text-muted);
      }

      .page-indicator {
        font-size: 12px;
        font-weight: 700;
        color: var(--text-main);
        min-width: 170px;
        text-align: center;
        white-space: nowrap;
      }

      /* ==========================================================================
   Mobile Responsive Adaptation: Single Page Card Mode (< 768px)
   ========================================================================== */
      @media (max-width: 768px) {
        body {
          padding: 0;
          justify-content: center;
        }

        .viewport {
          width: 100vw;
          height: 100vh;
          perspective: none;
          -webkit-perspective: none;
          padding: 12px 10px 72px;
          box-sizing: border-box;
        }

        .book {
          width: 100%;
          max-width: 420px;
          height: 100%;
          max-height: calc(100vh - 84px);
          transform: none !important;
          transform-style: flat;
          -webkit-transform-style: flat;
          background: transparent;
          box-shadow: none;
          border-radius: 16px;
        }

        .book.is-closed-start,
        .book.is-closed-end {
          transform: none !important;
        }

        .book-spine-crease {
          display: none !important;
        }

        /* Lembaran di-reset pada mode HP */
        .leaf {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          transform: none !important;
          transition: none !important;
          transform-style: flat;
          -webkit-transform-style: flat;
          cursor: default;
        }

        /* Setiap Muka Halaman Menjadi Kartu Tunggal */
        .page-face {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          transform: none !important;
          backface-visibility: visible !important;
          -webkit-backface-visibility: visible !important;
          border-radius: 16px !important;
          border: 1px solid var(--border-color);
          box-shadow: 0 10px 30px rgba(18, 38, 31, 0.08);
          opacity: 0;
          pointer-events: none;
          visibility: hidden;
          transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
          transform: translateX(24px) scale(0.98);
          z-index: 1;
        }

        .page-face.mobile-active {
          opacity: 1;
          pointer-events: auto;
          visibility: visible;
          transform: translateX(0) scale(1);
          z-index: 10;
        }

        .page-face.mobile-prev {
          opacity: 0;
          pointer-events: none;
          visibility: hidden;
          transform: translateX(-24px) scale(0.98);
          z-index: 5;
        }

        .page-inner::before {
          display: none !important;
        }

        .page-inner {
          padding: 22px 18px;
          overflow-y: auto;
          -webkit-overflow-scrolling: touch;
        }

        .page-cover-inner {
          padding: 30px 18px;
        }

        .btn-action {
          height: 44px;
          min-height: 44px;
        }

        .controls-toolbar {
          position: fixed;
          bottom: 10px;
          left: 50%;
          transform: translateX(-50%);
          width: calc(100vw - 20px);
          max-width: 440px;
          justify-content: space-between;
          padding: 5px 8px;
          gap: 4px;
        }

        .page-indicator {
          min-width: 90px;
          font-size: 11px;
        }

        .zoom-container {
          width: 100%;
          height: 100%;
          transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
        }

        .nav-btn,
        .btn-fullscreen,
        .btn-zoom,
        .btn-sound {
          height: 33px;
          padding: 0 8px;
          font-size: 11px;
        }

        @media (max-width: 480px) {
          #soundText,
          #zoomText,
          #fsText {
            display: none;
          }
          .btn-sound,
          .btn-zoom,
          .btn-fullscreen {
            padding: 0 10px;
          }
        }
      }