/* Tulisan Berangkai Custom Styling */

@layer base {
  body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  }
}

/* ============================================================
   UNIVERSAL MOBILE RESPONSIVENESS & FLUID CONTAINMENT
   Guarantees no element, header, card, or content crops on mobile
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

/* Ensure all flex, grid, and block containers never exceed viewport */
header, nav, main, section, article, footer,
.max-w-7xl, .style-card, .tool-card {
  min-width: 0;
  max-width: 100%;
}

/* Responsive media & graphics */
img, canvas, svg, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Hide scrollbars on swipeable containers */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

/* Card subtle tactile hover effect & safe text wrapping */
.style-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}

.style-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.dark .style-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.tool-card {
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Universal safe text wrapping for long Unicode, decorative symbols and titles */
p, h1, h2, h3, h4, span {
  overflow-wrap: anywhere;
}

/* Active Filter Pill styling */
.filter-btn.active {
  background-color: #f59e0b !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Navigation Dropdown Active & Forced Open State */
.nav-forced-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

/* Favorite Star Button Animation */
.fav-btn {
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fav-btn:hover {
  transform: scale(1.2);
}

.fav-btn:active {
  transform: scale(0.9);
}

/* Alphabet Card Glow */
.alphabet-card {
  transition: all 0.18s ease-in-out;
  min-width: 0;
  max-width: 100%;
}

.alphabet-card:hover {
  transform: translateY(-2px);
  border-color: #f59e0b;
}

/* Responsive Touch & Mobile Layout Optimizations (< 640px) */
@media (max-width: 639px) {
  /* Prevent iOS auto-zoom on input focus */
  textarea, input, select {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  /* Compact header paddings on mobile */
  header .max-w-7xl {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
  }

  /* Standalone All Tools button compact styling on small screens */
  #navAllToolsBtn {
    padding: 0.375rem 0.625rem !important;
    font-size: 0.6875rem !important;
    gap: 0.25rem !important;
  }

  /* Header action buttons compact dimensions */
  #themeToggleBtn, #mobileMenuBtn {
    width: 2.125rem !important;
    height: 2.125rem !important;
  }

  /* Compact card action footer on mobile */
  .style-card .copy-btn {
    padding: 0.375rem 0.625rem !important;
    font-size: 0.6875rem !important;
  }

  /* Smooth horizontal scrolling for tables */
  .table-responsive-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
  }
}

/* Print Stylesheet for high quality physical worksheets */
@media print {
  body * {
    visibility: hidden;
  }
  #previewCanvas, #previewCanvas * {
    visibility: visible;
  }
  #previewCanvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw !important;
    height: auto !important;
  }
}