:root {
  --brand: #f97316;
  --brand-ink: #1c1410;
  --hero: #ea580c;
  --accent: #c2410c;
  --accent-soft: #fff1e6;
  --bg: #ffffff;
  --surface: #f5f3f1;
  --text: #1c1917;
  --muted: #78716c;
  --line: #ece7e2;
  --focus: #f97316;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -12px rgb(0 0 0 / 0.18);
  --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.05), 0 18px 40px -16px rgb(0 0 0 / 0.28);
  --radius: 18px;
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #fb923c;
    --accent-soft: #2c1a0e;
    --bg: #141210;
    --surface: #221e1b;
    --text: #f5f1ed;
    --muted: #a8a29e;
    --line: #2e2925;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.3), 0 18px 40px -16px rgb(0 0 0 / 0.8);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- Arabic ---------- */

/* Latin names stay in Plus Jakarta Sans; Arabic glyphs fall through to Plex Arabic. */
:lang(ar) body,
body:lang(ar) {
  font-family: "Plus Jakarta Sans", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, sans-serif;
}

/* Letter-spacing breaks Arabic joining, and the script needs more line height. */
:lang(ar) .eyebrow,
:lang(ar) .hero h1,
:lang(ar) .section-head h2,
:lang(ar) .card-title,
:lang(ar) .lang a {
  letter-spacing: 0;
}

:lang(ar) .hero h1 {
  font-weight: 700;
  line-height: 1.3;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

/* White ring, plus a hairline outside it so the ring still shows on the white top bar. */
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line);
}

.search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin-inline-start: auto;
}

.search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 16px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.2;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 44px;
  padding-block: 0;
  padding-inline: 44px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus-visible {
  outline: none;
  border-color: var(--brand);
  background: var(--bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
}

/* ---------- Language switch ---------- */

.lang {
  display: flex;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
}

.lang a {
  min-width: 40px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.lang a:hover {
  color: var(--text);
}

.lang a[aria-current="page"] {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}

/* ---------- Hero ---------- */

/* One shade deeper than the logo orange so white text reaches 3.6:1 (AA for large text). */
.hero {
  position: relative;
  background: var(--hero);
  color: #fff;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) var(--gutter) clamp(48px, 7vw, 80px);
}

/* Small text can't meet contrast in white on orange, so it sits in a white pill. */
.eyebrow {
  display: inline-block;
  margin: 0 0 16px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  color: #9a3412;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-wave {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: clamp(28px, 4vw, 64px);
  fill: var(--bg);
}

/* ---------- Grid ---------- */

.content {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.count {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 32px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Card ---------- */

.card[hidden] {
  display: none;
}

.card-link {
  display: block;
  border-radius: var(--radius);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card-logo {
  position: absolute;
  inset-inline-start: 12px;
  bottom: 12px;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
}

.card-body {
  padding: 12px 4px 0;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.card-tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  .card-link:hover .card-media {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
  }

  .card-link:hover .card-cover {
    transform: scale(1.04);
  }

  .card-link:hover .card-title {
    color: var(--accent);
  }
}

.card-link:active .card-media {
  transform: scale(0.985);
}

.empty {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

/* ---------- Footer ---------- */

.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .lang {
    margin-inline-start: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
