/* ===== Base sizing / typography ===== */
:root { --base-font: 17px; }
@media (min-width: 768px) { :root { --base-font: 18px; } }

html { font-size: var(--base-font); }
body { line-height: 1.65; }

/* Gently upscale common Tailwind text utilities */
.text-sm   { font-size: 0.98rem !important; line-height: 1.55rem !important; }
.text-base { font-size: 1.10rem !important; line-height: 1.75rem !important; }
.text-lg   { font-size: 1.25rem !important; line-height: 1.9rem  !important; }
.text-xl   { font-size: 1.35rem !important; line-height: 2.0rem  !important; }

/* Headings: slightly larger & smoother tracking */
h1, .text-3xl, .text-4xl, .text-5xl { letter-spacing: -0.01em; }
.text-3xl { font-size: 2.125rem !important; line-height: 1.2 !important; }
.text-4xl { font-size: 2.5rem   !important; line-height: 1.2 !important; }
.text-5xl { font-size: 3.25rem  !important; line-height: 1.15 !important; }

/* Buttons/inputs: a touch more padding for balance */
.px-6.py-3 { padding-left: 1.6rem !important; padding-right: 1.6rem !important; padding-top: 0.85rem !important; padding-bottom: 0.85rem !important; }
input, select, textarea { font-size: 1.05rem !important; }

/* Arabic page: friendlier Arabic font stack (safe fallbacks) */
html[lang="ar"] {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}
/* Non-AR pages: clean system stack */
html:not([lang="ar"]) {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* Utility / custom components */
.asterisk { font-size: 14px; color: red; }
.card-hover { transition: all .18s ease; }
.card-hover:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 30px 80px -10px rgba(0,0,0,.8); }
.glass { background: radial-gradient(circle at 0% 0%, rgba(29,78,216,.12) 0%, rgba(0,0,0,0) 70%), rgba(17,24,39,.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ===== Toolbox / logos grid ===== */
#toolbox { padding-top: 48px; padding-bottom: 48px; }
.logo-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  justify-items: center;
  align-items: center;
  margin: 24px;
}
.logo-grid img {
  max-width: 100px;
  max-height: 100px;
  transition: transform .2s, opacity .2s;
  opacity: .85;
}
.logo-grid img:hover { transform: scale(1.1); opacity: 1; }

.hidden {
  display: none;
}

.message-box {
  background: #43a981;
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
  text-align: center;
}

/* --- Prevent horizontal overflow on mobile --- */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

/* Fix Tailwind utility overflows (custom widths) */
[class*="w-["] {
  max-width: 100%;
}

/* === Back to top button === */
.to-top{
  position: fixed;
  right: 16px;           /* flips automatically with RTL below */
  bottom: 20px;
  z-index: 120;
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.10);
  color: #fff;
  box-shadow: 0 10px 30px rgba(2,8,23,.25);
  cursor: pointer;

  opacity: 0; 
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease, border-color .15s ease;
}
.to-top:hover{ background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }
.to-top:focus-visible{ outline: 3px solid var(--ring, rgba(47,122,254,.35)); outline-offset: 2px; }

/* Visible state toggled by JS */
.to-top.show{ opacity: 1; pointer-events: auto; transform: translateY(0); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .to-top{ transition: none; }
}

/* RTL: pin to left instead of right */
.rtl .to-top{ right: auto; left: 16px; }
