@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");
/* Free Tools Hub — shared styles
   Mobile-first, RTL-aware, light/dark via prefers-color-scheme.
   Palette matches www.abdallaelmorsi.net (accent #5b6cff, Ubuntu font). */

:root {
  --accent: #22d3ee;
  --accent2: #6d6bff;
  --accent-ink: #060608;
  --bg: #060608;
  --card: #131320;
  --text: #f4f4f7;
  --text-mute: #c4c4d2;
  --border: rgba(255, 255, 255, 0.1);
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
  --max-w: 1080px;
  --font: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  overflow-x: hidden;
}

[dir="rtl"] body { font-family: var(--font); }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.1rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-header .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.site-header .brand:hover { text-decoration: none; opacity: 0.85; }
.site-header nav a {
  color: var(--text-mute);
  margin-inline-start: 1rem;
  font-size: 0.92rem;
}
.site-header nav a:first-child { margin-inline-start: 0; }

/* Main */
main { padding: 1.75rem 0 3rem; }

h1 { font-size: 1.65rem; margin: 0 0 0.5rem; line-height: 1.3; }
h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.lede { color: var(--text-mute); font-size: 1.02rem; }

/* Cards / tool grid */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin: 1rem 0 2rem;
}
@media (min-width: 620px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}

.tool-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(20, 22, 30, 0.14);
  border-color: var(--accent);
  text-decoration: none;
}
.tool-card h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.tool-card p { margin: 0; color: var(--text-mute); font-size: 0.9rem; }

.category { margin-bottom: 1rem; }
.category-empty {
  color: var(--text-mute);
  font-size: 0.9rem;
  font-style: italic;
}

/* Collapsible hub category groups */
details.category { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 0; overflow: hidden; }
details.category > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  user-select: none;
}
details.category > summary h2 { margin: 0; font-size: 1.1rem; }

/* Hub smart search */
.tool-search-wrap { position: relative; margin: 0 0 1.5rem; }
#tool-search {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
}
#tool-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tool-search-results {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 22, 30, 0.18);
  max-height: 60vh;
  overflow-y: auto;
}
.tool-search-results a {
  display: block;
  padding: 0.65rem 1rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.tool-search-results a:last-child { border-bottom: none; }
.tool-search-results a:hover, .tool-search-results a.active { background: var(--accent); color: var(--accent-ink); }
.tool-search-results .tsr-title { font-weight: 600; }
.tool-search-results .tsr-desc { font-size: 0.85rem; opacity: 0.85; margin-top: 0.1rem; }
.tool-search-results .tsr-empty { padding: 0.75rem 1rem; color: var(--text-mute); }

/* IQ test matrix puzzles */
.iq-matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  max-width: 300px;
  margin: 0.75rem 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
}
.iq-matrix-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 60px;
}
.iq-matrix-blank { font-size: 1.5rem; font-weight: 700; color: var(--text-mute); }
.iq-matrix-options { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.iq-matrix-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  font-weight: 400;
}
.iq-matrix-option:has(input:checked) { border-color: var(--accent); background: rgba(91,108,255,0.08); }

/* Universal converter dropzone */
.uc-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--card);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.uc-dropzone:hover, .uc-dropzone.uc-dragover { border-color: var(--accent); background: rgba(91,108,255,0.06); }
.uc-dropzone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* Mushaf-style Quran page view. A fixed height was tried to keep the
   prev/next controls from moving between pages, but it backfired:
   most pages don't have enough text to fill the tallest page's
   height, leaving a visible dead-space gap before the controls. Back
   to natural content-based sizing (small min-height just so a 1-ayah
   page doesn't look jarringly collapsed) — the nav buttons are kept
   from wrapping instead by giving them their own dedicated row below
   (see .mushaf-nav-row), not by fixing this box's size. */
.mushaf-page-frame {
  border-radius: 12px;
  padding: 1.25rem 0.5rem;
  overflow: hidden;
  position: relative;
  min-height: 12rem;
  margin-inline-start: auto;
  margin-inline-end: auto;
  max-width: 42rem;
}
.mushaf-page-content {
  transition: transform 0.28s ease, opacity 0.28s ease;
  --mushaf-font-size: 1rem;
}
.mushaf-page-content.slide-out-left { transform: translateX(-30px); opacity: 0; }
.mushaf-page-content.slide-out-right { transform: translateX(30px); opacity: 0; }
.mushaf-page-content .mushaf-surah-header {
  text-align: center;
  font-weight: 700;
  font-size: calc(var(--mushaf-font-size) * 1.15);
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
}
.mushaf-page-content .mushaf-surah-header:first-child { margin-top: 0; }
.mushaf-page-content .mushaf-ayah-ar {
  font-size: var(--mushaf-font-size);
  line-height: 2.4;
  text-align: justify;
  text-align-last: center;
}
.mushaf-page-content .mushaf-ayah-en {
  color: var(--text-mute);
  font-size: calc(var(--mushaf-font-size) * 0.95);
  margin: 0.3rem 0 1rem;
}
.mushaf-ayah-num {
  display: inline-block;
  font-size: 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 1.6em;
  height: 1.6em;
  line-height: 1.5em;
  text-align: center;
  margin: 0 0.15em;
  color: var(--accent);
}
.mushaf-controls {
  margin-top: 1rem;
}
/* Previous/Next always share one row (flex:1 each rather than
   flex-wrap) so neither button ever gets pushed onto its own line on
   narrow screens, per direct feedback that it was happening. */
.mushaf-nav-row {
  display: flex;
  gap: 0.5rem;
}
.mushaf-nav-row button {
  flex: 1;
  margin-top: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  white-space: nowrap;
}
.mushaf-page-jump-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.mushaf-font-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.mushaf-font-controls button {
  width: 2.2rem;
  padding: 0.3rem 0;
}

/* Timezone world map (real SVG regions) + world clocks */
.tz-world-map {
  margin: 1rem 0 1rem;
  background: linear-gradient(180deg, rgba(91,108,255,0.06), rgba(91,108,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
}
.tz-map-region {
  fill: var(--card);
  stroke: var(--accent);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.12s ease;
}
.tz-map-region:hover { fill: var(--accent); }
.tz-region-zones {
  margin: 0.75rem 0 1.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.tz-zone-btn { font-size: 0.85rem; }

.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.analog-clock-wrap { text-align: center; }
.analog-clock-wrap .city-label { font-size: 0.85rem; font-weight: 600; margin-top: 0.4rem; }
.analog-clock-wrap .digital-label { font-size: 0.78rem; color: var(--text-mute); }
.analog-clock { display: block; margin: 0 auto; }
.clock-face { fill: var(--card); stroke: var(--border); stroke-width: 2; }
.clock-hand { stroke-linecap: round; transform-origin: 50px 50px; }
.hand-hour { stroke: var(--text); stroke-width: 4; }
.hand-minute { stroke: var(--text); stroke-width: 3; }
.hand-second { stroke: var(--accent); stroke-width: 1.5; }
.clock-center { fill: var(--accent); }
.clock-tick { stroke: var(--text-mute); stroke-width: 1.5; }
details.category > summary::-webkit-details-marker { display: none; }
details.category > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0.55em;
  height: 0.55em;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-inline-end: 0.2rem;
}
details.category[open] > summary::before { transform: rotate(-135deg); }
details.category > summary .cat-count { font-weight: 400; font-size: 0.85rem; color: var(--text-mute); }
details.category > .tool-grid { margin: 0; padding: 0 1.1rem 1.1rem; }

/* Tool app card (calculator container) — "floating card" treatment,
   applied site-wide via this shared class so every tool picks it up
   automatically. */
.tool-app {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(20, 22, 30, 0.10), 0 2px 8px rgba(20, 22, 30, 0.06);
  padding: 1.5rem;
  margin: 1.25rem 0;
}

/* Soft accent-colored glow behind the top of every tool page. The
   first version of this (a fixed 60rem-wide element centered with
   left:50%+translateX(-50%)) was removed after it caused a right-side
   whitespace/margin issue on some pages. This version is rebuilt to
   be provably incapable of causing that class of bug: it's inset with
   left:0/right:0 so its width is always exactly equal to main's own
   width (cannot ever be wider than its container, by construction,
   regardless of viewport size), and `overflow: hidden` on main itself
   is a second, independent guarantee that nothing inside it —
   this or anything else — can ever expand the page's scrollable
   width. */
main#main {
  position: relative;
  overflow: hidden;
}
main#main::before {
  content: "";
  position: absolute;
  top: -1.5rem;
  left: 0;
  right: 0;
  height: 13rem;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0.35rem; }
label:first-child { margin-top: 0; }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button, .btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  margin-top: 1rem;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
button:hover, .btn:hover { opacity: 0.92; text-decoration: none; }
button:active { transform: translateY(1px); }

.result {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  display: none;
}
.result.show { display: block; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.92rem; }
th, td { text-align: start; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-mute); font-weight: 600; }

.error { color: #d1453b; font-size: 0.88rem; margin-top: 0.4rem; }

/* FAQ */
.faq details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
  background: var(--card);
}
.faq summary {
  font-weight: 600;
  cursor: pointer;
}
.faq p { margin: 0.6rem 0 0; color: var(--text-mute); }

.sources { font-size: 0.85rem; color: var(--text-mute); }
.sources a { color: var(--text-mute); text-decoration: underline; }

.adslot {
  min-height: 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-mute);
  font-size: 0.85rem;
}
.site-footer a { color: var(--text-mute); }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-inline-end: 0.4rem;
}

/* Language switch — styled like a light/dark theme toggle, with a flag
   for each language. Deliberately kept LTR (via dir="ltr" on the
   element) so it looks and behaves the same regardless of page
   direction. */
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 66px;
  height: 30px;
  border-radius: 999px;
  background: var(--border);
  border: none;
  padding: 0;
  margin: 0;
  margin-inline-start: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.lang-switch-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  box-sizing: border-box;
}
.lang-flag {
  font-size: 13px;
  line-height: 1;
  opacity: 0.55;
  position: relative;
  z-index: 1;
}
.lang-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s ease;
  z-index: 2;
}
.lang-switch[data-lang="ar"] .lang-switch-thumb { transform: translateX(36px); }
.lang-switch:hover .lang-switch-thumb { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--accent); }

.skip-link {
  position: absolute;
  top: 0;
  inset-inline-start: 0.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 1rem;
  z-index: 100;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0.5rem); }


/* ===== 2026-09-26 site-matching redesign ===== */
html { color-scheme: dark; }
body {
  background: radial-gradient(1200px 500px at 50% -10%, rgba(109,107,255,.16), transparent 60%), var(--bg);
  background-attachment: fixed;
}
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(6,6,8,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: .55rem; padding-bottom: .55rem; max-width: 1180px; }
.site-header .brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); flex: 0 0 auto; }
.site-header .brand img { width: 38px; height: 38px; object-fit: contain; }
.site-header .brand:hover { opacity: 1; text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: .3rem; margin-inline-start: auto; flex-wrap: wrap; }
.site-header nav a { margin: 0; padding: .5rem .95rem; border-radius: 100px; color: var(--text); font-size: .92rem; font-weight: 500; transition: background .15s, color .15s; }
.site-header nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.site-header nav a.active { background: rgba(34,211,238,.14); color: var(--accent); }
.site-header nav a.hl { border: 1px solid rgba(34,211,238,.45); color: var(--accent); }
@media (max-width: 720px) {
  .site-header .container { gap: .4rem; }
  .site-header nav { width: 100%; margin: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { white-space: nowrap; padding: .45rem .8rem; }
}
h1, h2, h3 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.lede { color: var(--text-mute); }
a { color: var(--accent); }

/* tool tiles with icons */
.tool-card { display: flex; gap: .95rem; align-items: flex-start; border-radius: 18px; padding: 1.05rem 1.1rem; background: var(--card); position: relative; overflow: hidden; }
.tool-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(109,107,255,.10), rgba(34,211,238,.06)); opacity: 0; transition: opacity .2s; pointer-events: none; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(34,211,238,.25); }
.tool-card:hover::after { opacity: 1; }
.tool-card:active { transform: translateY(-1px) scale(.995); }
.tool-card:focus-visible, .it-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-card > div.tc { min-width: 0; }
.ti { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(109,107,255,.28), rgba(34,211,238,.2)); }
.ti svg { width: 24px; height: 24px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-card h3 { color: var(--text); }
.tool-card p { color: var(--text-mute); }
details.category { background: transparent; border: 1px solid var(--border); border-radius: 20px; }
details.category > summary { padding: 1.1rem 1.3rem; background: rgba(255,255,255,.03); }
details.category > summary h2 { font-size: 1.25rem; }
details.category[open] > summary { border-bottom: 1px solid var(--border); }
details.category .tool-grid { padding: 1rem 1.1rem 0; }
.cat-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(34,211,238,.14); margin-inline-end: .7rem; vertical-align: middle; }
.cat-icon svg { width: 19px; height: 19px; stroke: var(--accent); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

/* featured IT banner */
.it-banner { display: flex; align-items: center; gap: 1.1rem; border: 1px solid rgba(34,211,238,.5); border-radius: 20px; padding: 1.2rem 1.4rem; margin: 1.2rem 0 1.6rem; text-decoration: none; background: linear-gradient(120deg, rgba(109,107,255,.22), rgba(34,211,238,.12)); color: var(--text); transition: transform .15s, box-shadow .15s; }
.it-banner:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.4); text-decoration: none; }
.it-banner .ti { width: 56px; height: 56px; border-radius: 16px; }
.it-banner .ti svg { width: 30px; height: 30px; }
.it-banner strong { display: block; font-size: 1.2rem; margin-bottom: .15rem; color: var(--text); }
.it-banner span.tx { color: var(--text-mute); }
.it-banner .go { margin-inline-start: auto; font-weight: 700; color: var(--accent); white-space: nowrap; }
@media (max-width: 620px) { .it-banner { flex-wrap: wrap; } .it-banner .go { margin-inline-start: 0; } }
.it-toc a { background: rgba(255,255,255,.04); color: var(--text); }
.it-toc a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.site-footer { border-top: 1px solid var(--border); background: rgba(255,255,255,.02); }
.site-footer a { color: var(--accent); }
details.category > summary { display: flex; align-items: center; }
details.category > summary .cat-icon { flex: 0 0 auto; }
