/* ============================================================
   print.css — Grafika Komputer
   Styling khusus untuk cetak / PDF
   ============================================================ */

@media print {

  /* ==========================================================
     1. RESET DASAR
     ========================================================== */
  * {
    background: transparent;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    background: #fff !important;
    font-size: 11pt;
    line-height: 1.5;
    font-family: 'Inter', Arial, sans-serif;
  }

  /* ==========================================================
     2. SEMBUNYIKAN ELEMEN INTERAKTIF NAVIGASI
     ========================================================== */
  nav,
  footer,
  .filter-btn,
  #themeToggle,
  #menuToggle,
  #mobileMenu,
  [data-print="hide"] {
    display: none !important;
  }

  /* ----------------------------------------------------------
     PENGECUALIAN: section yang di layar pakai .print:hidden
     (timeline, slider, flip card, kuis) tetap DICETAK.
     Selector "section.print:hidden" lebih spesifik daripada
     ".print:hidden" di atas, sehingga menang meski sama-sama
     pakai !important.
     ---------------------------------------------------------- */
  section.print\:hidden {
    display: block !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  /* ==========================================================
     3. ATUR MARGIN HALAMAN
     ========================================================== */
  @page {
    size: A4;
    margin: 2cm 1.5cm;
  }

  /* ==========================================================
     4. HERO / HEADER
     ========================================================== */
  header {
    background: #fff !important;
    color: #000 !important;
    padding: 0 0 1rem 0 !important;
    border-bottom: 2px solid #000;
    margin-bottom: 1.5rem;
  }

  header h1 {
    font-size: 20pt;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #000 !important;
  }

  header p {
    font-size: 10pt;
    color: #333 !important;
  }

  /* Sembunyikan tombol & badge di hero */
  header .inline-flex,
  header a {
    display: none !important;
  }

  /* ==========================================================
     5. SECTION & HEADING
     ========================================================== */
  section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1.5rem;
  }

  h2 {
    font-size: 16pt;
    font-weight: 700;
    border-bottom: 1px solid #999;
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
    page-break-after: avoid;
    break-after: avoid;
    color: #000 !important;
  }

  h3 {
    font-size: 13pt;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    page-break-after: avoid;
    break-after: avoid;
    color: #000 !important;
  }

  /* ==========================================================
     6. KARTU MODUL — UBAH JADI DAFTAR
     ========================================================== */
  #modulGrid {
    display: block !important;
  }

  .modul-card {
    display: block !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.4rem;
    page-break-inside: avoid;
    box-shadow: none !important;
    background: #fff !important;
  }

  .modul-card::before,
  .modul-card::after {
    display: none !important;
  }

  .modul-card h3 {
    font-size: 11pt;
    margin: 0;
  }

  .modul-card p {
    font-size: 9pt;
    margin: 0.2rem 0 0 0;
    color: #333 !important;
  }

  /* Tampilkan URL link saat dicetak */
  .modul-card a::after {
    content: ' (' attr(href) ')';
    font-size: 8pt;
    color: #666 !important;
  }

  /* ==========================================================
     7. TABEL
     ========================================================== */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  th,
  td {
    border: 1px solid #999 !important;
    padding: 4px 6px;
    text-align: left;
    color: #000 !important;
  }

  th {
    background: #eee !important;
    font-weight: 600;
  }

  /* ==========================================================
     8. LINK
     ========================================================== */
  a {
    text-decoration: none;
    color: #000 !important;
  }

  a[href^="http"]::after {
    content: ' <' attr(href) '>';
    font-size: 8pt;
    color: #555 !important;
    word-break: break-all;
  }

  /* ==========================================================
     9. DAFTAR & LIST
     ========================================================== */
  ul,
  ol {
    padding-left: 1.2rem;
  }

  li {
    margin-bottom: 0.2rem;
  }

  /* ==========================================================
     10. CALL OUT / CATATAN
     ========================================================== */
  .callout {
    border: 1px solid #999 !important;
    border-left: 4px solid #000 !important;
    background: #f9f9f9 !important;
    padding: 0.5rem 0.75rem;
    page-break-inside: avoid;
  }

  /* ==========================================================
     11. CODE BLOCK
     ========================================================== */
  pre,
  code {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ccc;
    font-size: 8pt;
  }

  /* ==========================================================
     12. PAGE BREAK UTILITY
     ========================================================== */
  .page-break {
    page-break-before: always;
    break-before: page;
  }

  .avoid-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ==========================================================
     13. FOOTER CETAK
     ========================================================== */
  body::after {
    content: 'Grafika Komputer — Politeknik Maroira Indonesia — Program Studi Multimedia';
    display: block;
    text-align: center;
    font-size: 8pt;
    color: #666;
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ccc;
  }

  /* ==========================================================
     14. SECTION INTERAKTIF — PERBAIKAN AGAR LAYAK CETAK
     ========================================================== */

  /* ---------- 14a. TIMELINE (section 2) ---------- */
  .timeline-item { display: none !important; }

  #timelineDetail {
    display: block !important;
    min-height: 0 !important;
    border: 1px solid #999 !important;
    background: #f9f9f9 !important;
    padding: 10px 14px !important;
    font-size: 10pt;
  }
  #timelineDetail * { color: #000 !important; }

  /* ---------- 14b. SLIDER RASTER–VEKTOR (section 3) ---------- */
  #rasterSlider,
  label[for="rasterSlider"] {
    display: none !important;
  }

  .comparison-viewport {
    height: auto !important;
    min-height: 140px;
    border: 1px solid #999 !important;
    background: #fff !important;
  }
  #rasterImg,
  #vectorImg {
    transform: none !important;   /* buang efek zoom dari JS */
    max-height: 160px !important;
  }

    /* ---------- 14c. FLIP CARD (section 4) ---------- */

  /* Container: matikan perspective & fixed height */
  .flip-card {
    height: auto !important;
    perspective: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    display: block !important;
  }

  /* Inner: matikan semua transform & 3D */
  .flip-card .flip-card-inner {
    position: static !important;
    height: auto !important;
    transform: none !important;
    -webkit-transform: none !important;
    transform-style: flat !important;
    display: block !important;
  }

  /* Front & back: jadikan kartu statis biasa, tidak bertumpuk */
  .flip-card .flip-card-front,
  .flip-card .flip-card-back {
    position: static !important;
    inset: auto !important;
    height: auto !important;

    /* KUNCI: netralkan semua transform & backface */
    transform: none !important;
    -webkit-transform: none !important;
    rotate: none !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;

    display: block !important;
    padding: 8px 10px !important;
    margin-bottom: 6px !important;
    background: #fff !important;
    border: 1px solid #999 !important;
    border-radius: 6px !important;
    color: #000 !important;
    box-shadow: none !important;
    text-align: left !important;
  }

  /* Pastikan isi kartu juga tidak punya transform */
  .flip-card .flip-card-front *,
  .flip-card .flip-card-back * {
    color: #000 !important;
    transform: none !important;
    -webkit-transform: none !important;
    rotate: none !important;
  }

  /* Opsional: sembunyikan sisi depan, hanya tampilkan belakang
     (belakang isinya lebih informatif untuk cetak).
     Kalau mau dua-duanya tercetak, hapus rule ini. */
  /* .flip-card .flip-card-front { display: none !important; } */

  /* ---------- 14d. KUIS DRAG & DROP (section 5) ---------- */
  #dragPool,
  #cekKlasifikasi,
  #resetKlasifikasi,
  #dragHint,
  #buttonHint,
  #modeToggle {
    display: none !important;
  }

  .drop-zone {
    min-height: 0 !important;
    border: 1px solid #999 !important;
    background: #fff !important;
  }
}