:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0d0d0b;
  --surface-2: #151511;
  --surface-3: #202018;
  --text: #fffaf0;
  --muted: #bbb4a3;
  --soft: #8e8777;
  --line: rgba(255, 255, 255, 0.12);
  --yellow: #ffe22c;
  --yellow-soft: rgba(255, 226, 44, 0.13);
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaf3;
  --surface: #ffffff;
  --surface-2: #f4f0df;
  --surface-3: #e9e1bf;
  --text: #11110e;
  --muted: #625d51;
  --soft: #837c6b;
  --line: rgba(17, 17, 14, 0.12);
  --yellow-soft: rgba(255, 226, 44, 0.28);
  --shadow: 0 24px 70px rgba(45, 37, 10, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(90deg, var(--yellow-soft), transparent 34%) 0 0 / 100% 540px no-repeat,
    linear-gradient(180deg, var(--bg), var(--surface) 58%, var(--bg));
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body {
  font-family: "IBM Plex Sans Arabic", Inter, system-ui, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
  content: "";
}

html[data-theme="light"] body::before {
  background:
    linear-gradient(90deg, rgba(17, 17, 14, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 17, 14, 0.035) 1px, transparent 1px);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  min-height: 74px;
  padding: 0.85rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand,
.top-nav,
.header-actions {
  display: flex;
  align-items: center;
}

.brand {
  width: fit-content;
  gap: 0.72rem;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 226, 44, 0.44);
  border-radius: var(--radius);
  background: #050505;
}

.brand-mark img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-word {
  font-size: 1.16rem;
  letter-spacing: -0.04em;
}

.brand-word span {
  color: var(--yellow);
}

.top-nav {
  justify-content: center;
  gap: 0.4rem;
  padding: 0.24rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.top-nav a,
.filter-tabs a {
  padding: 0.62rem 0.78rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.top-nav a:hover,
.filter-tabs a:hover {
  background: var(--yellow-soft);
  color: var(--text);
}

.header-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.lang-toggle,
.theme-toggle {
  display: inline-grid;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.theme-toggle {
  font-size: 1.12rem;
}

html[data-theme="dark"] .moon,
html[data-theme="light"] .sun {
  display: none;
}

.page-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2rem) 0 0;
}

.category-rail {
  position: sticky;
  top: 94px;
  align-self: start;
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.category-rail p {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

html[dir="rtl"] .category-rail p {
  letter-spacing: 0;
}

.category-rail a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.1rem 0.72rem;
  align-items: center;
  min-height: 58px;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.category-rail a:hover {
  border-color: rgba(255, 226, 44, 0.48);
}

.rail-icon {
  grid-row: span 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  background: var(--yellow);
  color: #11110e;
  font-size: 0.78rem;
  font-weight: 900;
}

.category-rail strong {
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-rail em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.content-column {
  min-width: 0;
}

.hero {
  padding: clamp(2.1rem, 5vw, 4.2rem) 0 clamp(1.4rem, 4vw, 2.6rem);
}

.stat-line {
  display: inline-flex;
  margin: 0 0 1.05rem;
  padding: 0.52rem 0.72rem;
  border: 1px solid rgba(255, 226, 44, 0.38);
  border-radius: var(--radius);
  color: var(--yellow);
  background: var(--yellow-soft);
  font-size: 0.82rem;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 1rem;
  font-size: clamp(3.4rem, 8.2vw, 7.15rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.86;
  text-wrap: balance;
}

html[dir="rtl"] h1 {
  letter-spacing: -0.018em;
  line-height: 1.05;
}

.hero-text {
  max-width: 710px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.24rem);
  font-weight: 600;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
  margin-top: 1.6rem;
}

.btn,
.tool-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.78rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn:hover,
.tool-action:hover {
  transform: translateY(-2px);
}

.btn.primary,
.tool-action:not(.muted) {
  border-color: transparent;
  background: var(--yellow);
  color: #11110e;
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.6rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.tool-section,
.value-section,
.site-footer {
  scroll-margin-top: 96px;
}

.tool-section {
  padding: clamp(1.8rem, 5vw, 3.6rem) 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

html[dir="rtl"] h2 {
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.section-heading p {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.65;
}

.section-heading > span {
  flex: none;
  padding: 0.52rem 0.66rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}

.tool-card {
  display: grid;
  min-height: 260px;
  align-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
}

.tool-card.is-live {
  background:
    linear-gradient(145deg, var(--yellow-soft), transparent 58%),
    var(--surface);
}

.tool-card:hover {
  background: color-mix(in srgb, var(--surface-2) 86%, var(--surface));
}

.tool-type {
  display: inline-flex;
  width: fit-content;
  padding: 0.38rem 0.52rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--yellow);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tool-card h3 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  letter-spacing: -0.035em;
}

.tool-card p,
.value-section p,
.site-footer p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.65;
}

.tool-action {
  width: fit-content;
  min-height: 40px;
  padding: 0.65rem 0.78rem;
}

.tool-action.muted {
  color: var(--muted);
  background: var(--surface-2);
}

.value-section {
  padding: clamp(2rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--line);
}

.value-copy {
  max-width: 720px;
  margin-bottom: 1rem;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.value-grid article {
  min-height: 170px;
  padding: 1rem;
  background: var(--surface);
}

.value-grid h3 {
  color: var(--yellow);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
}

.site-footer strong {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 1.2rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.site-footer nav a {
  padding: 0.6rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 800;
}

.site-footer nav a:hover {
  color: var(--text);
  border-color: rgba(255, 226, 44, 0.42);
}

.copyright {
  grid-column: 1 / -1;
  color: var(--soft);
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .top-nav {
    display: none;
  }

  .page-shell {
    grid-template-columns: 1fr;
  }

  .category-rail {
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 0.65rem;
    box-shadow: none;
  }

  .category-rail p {
    display: none;
  }

  .category-rail a {
    min-width: 210px;
  }

  .tool-grid,
  .value-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 66px;
    padding-inline: 0.85rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-mark img {
    width: 29px;
    height: 29px;
  }

  .brand-word {
    font-size: 1.05rem;
  }

  .lang-toggle,
  .theme-toggle {
    min-width: 38px;
    height: 38px;
  }

  .page-shell {
    width: min(100% - 1.15rem, 1320px);
    padding-top: 0.75rem;
  }

  .category-rail a {
    min-width: 180px;
  }

  .hero {
    padding: 1.65rem 0 1.2rem;
  }

  h1 {
    font-size: clamp(2.75rem, 13.8vw, 4rem);
  }

  html[dir="rtl"] h1 {
    font-size: clamp(2.35rem, 12vw, 3.45rem);
  }

  .hero-text {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .filter-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .filter-tabs a {
    flex: none;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .tool-grid,
  .value-grid,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 230px;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
