/* Features page v2 — every selector is scoped under .fx- so nothing leaks into other pages. */

/* The site's style.css sets `html, body { overflow: auto }`, which turns <body> into its own scroll box and
   silently disables position:sticky. Undo it only on the page that contains .fx-page. */
html:has(.fx-page) { overflow: visible; }

.fx-page {
  --fx-gold: #caa85a;
  --fx-orange: #f39c12;
  --fx-text: #e4ddd1;
  --fx-muted: #b3a998;
  --fx-panel: rgba(16, 13, 11, 0.82);
  --fx-panel-2: rgba(28, 23, 19, 0.88);
  --fx-line: rgba(202, 168, 90, 0.22);
  --fx-soon: #8cc3e0;
  --fx-top: calc(var(--rp-header-h, 72px) + 14px); /* below the site's fixed header */
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(1240px, 100% - 32px);
  margin: 0 auto 64px;
  color: var(--fx-text);
  font-family: inherit;
}
.fx-page *, .fx-page *::before, .fx-page *::after { box-sizing: border-box; }

.fx-page { padding-top: 8px; }
.fx-page .fx-title {
  margin: 0;
  text-align: center;
  color: var(--fx-gold);
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0 2px #000, 0 0 8px #000, 0 2px 16px rgba(0, 0, 0, 0.9);
}

.fx-page .fx-intro {
  max-width: 760px;
  margin: 10px auto 20px;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(16, 13, 11, 0.6);
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--fx-text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Search */
.fx-search { max-width: 560px; margin: 0 auto 26px; }
.fx-search input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 1px solid var(--fx-line);
  border-radius: 999px;
  background: var(--fx-panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23caa85a' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center;
  color: var(--fx-text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.fx-search input::placeholder { color: var(--fx-muted); }
.fx-search input:focus { border-color: var(--fx-gold); box-shadow: 0 0 0 3px rgba(202, 168, 90, 0.2); }

/* Layout */
.fx-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }

/* Category navigation */
.fx-nav {
  position: sticky;
  top: var(--fx-top);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  max-height: calc(100vh - var(--fx-top) - 16px);
  overflow-y: auto;
  border: 1px solid var(--fx-line);
  border-radius: 12px;
  background: var(--fx-panel);
  backdrop-filter: blur(4px);
}
.fx-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--fx-text);
  text-decoration: none;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  transition: background .2s, color .2s;
}
.fx-nav-item img { width: 28px; height: 28px; flex: none; object-fit: contain; }
.fx-nav-name { flex: 1; min-width: 0; }
.fx-nav-count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fx-muted);
  font-family: var(--rp-body, 'Alegreya Sans', sans-serif);
  font-size: 0.78rem;
  text-align: center;
}
.fx-nav-new { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--fx-orange); box-shadow: 0 0 8px var(--fx-orange); }
.fx-nav-item:hover { background: rgba(202, 168, 90, 0.12); color: #fff; }
.fx-nav-item.is-active { background: linear-gradient(90deg, rgba(243, 156, 18, 0.9), rgba(202, 120, 30, 0.75)); color: #fff; }
.fx-nav-item.is-active .fx-nav-count { background: rgba(0, 0, 0, 0.25); color: #fff; }
.fx-nav-item:focus-visible, .fx-card-head:focus-visible { outline: 2px solid var(--fx-gold); outline-offset: 2px; }

/* Category panel */
.fx-cat { margin-bottom: 40px; scroll-margin-top: 140px; }
.fx-page.fx-js .fx-cat { display: none; margin-bottom: 0; }
.fx-page.fx-js .fx-cat.is-active { display: block; animation: fx-in .25s ease-out; }
.fx-cat-title, .fx-results h2 {
  margin: 0 0 8px;
  color: var(--fx-gold);
  font-family: 'Cinzel', serif;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  letter-spacing: 0.02em;
  text-shadow: 0 0 2px #000, 0 0 6px #000, 0 2px 14px rgba(0, 0, 0, 0.9);
}
.fx-cat-intro { margin: 0 0 16px; padding: 12px 16px; border-radius: 10px; background: var(--fx-panel); color: var(--fx-text); line-height: 1.6; }

/* Cards */
.fx-card {
  margin-bottom: 10px;
  border: 1px solid var(--fx-line);
  border-radius: 10px;
  background: var(--fx-panel);
  overflow: hidden;
  transition: border-color .2s;
}
.fx-card.is-open { border-color: rgba(202, 168, 90, 0.4); }
.fx-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: var(--fx-panel-2);
  color: var(--fx-gold);
  font-family: 'Cinzel', serif;
  font-size: 1.02rem;
  text-align: left;
  cursor: pointer;
}
.fx-card-head:hover { background: rgba(48, 38, 28, 0.92); }
.fx-card-title { flex: 1; min-width: 0; }
.fx-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--rp-body, 'Alegreya Sans', sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fx-badge--new { background: var(--fx-orange); color: #1a1208; }
.fx-badge--soon { border: 1px solid var(--fx-soon); color: var(--fx-soon); }
.fx-chevron { flex: none; width: 10px; height: 10px; border-right: 2px solid var(--fx-gold); border-bottom: 2px solid var(--fx-gold); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.fx-card.is-open .fx-chevron { transform: rotate(225deg); }
.fx-card-body { padding: 14px 16px 6px; }
.fx-page.fx-js .fx-card:not(.is-open) .fx-card-body { display: none; }
.fx-page:not(.fx-js) .fx-chevron { display: none; }

.fx-card-img { margin: 0 0 14px; }
.fx-card-img img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.fx-how { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--fx-orange); background: rgba(243, 156, 18, 0.08); color: var(--fx-text); font-size: 0.95rem; }
.fx-how strong { color: var(--fx-orange); font-weight: 600; }

.fx-items { list-style: none; margin: 0 0 10px; padding: 0; }
.fx-items li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--fx-text);
  font-size: 0.97rem;
  line-height: 1.55;
}
.fx-items li span { min-width: 0; overflow-wrap: anywhere; }
.fx-item-icon { width: 32px; height: 32px; flex: none; object-fit: contain; border-radius: 4px; }
.fx-items a { color: var(--fx-gold); text-decoration: underline; text-underline-offset: 2px; }
.fx-items a:hover { color: var(--fx-orange); }
.fx-items strong { color: #fff; }

.fx-section { margin: 4px 0 12px; padding-left: 12px; border-left: 2px solid var(--fx-line); }
.fx-section h4 { margin: 4px 0 8px; color: var(--fx-gold); font-family: 'Cinzel', serif; font-size: 0.95rem; letter-spacing: 0.03em; }

/* Search results */
.fx-result-cat { margin: 14px 0 6px; color: var(--fx-muted); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.fx-empty { padding: 24px; border: 1px dashed var(--fx-line); border-radius: 10px; background: var(--fx-panel); color: var(--fx-muted); text-align: center; }

/* Lightbox (sits outside .fx-page, so its z-index beats the site navbar's 9999) */
.fx-lightbox:focus { outline: none; }
.fx-card-img img:focus-visible { outline: 2px solid var(--fx-gold); outline-offset: 3px; }
.fx-lightbox { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, 0.88); cursor: zoom-out; }
.fx-lightbox[hidden] { display: none; }
.fx-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }

@keyframes fx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tablet & phone: the category list becomes a sticky, sideways-scrolling chip row */
@media (max-width: 900px) {
  .fx-page { --fx-top: var(--rp-header-h, 64px); width: calc(100% - 24px); }
  .fx-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .fx-nav {
    z-index: 5;
    flex-direction: row;
    gap: 6px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    border-radius: 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .fx-nav::-webkit-scrollbar { display: none; }
  .fx-nav-item { flex: none; padding: 7px 12px; border: 1px solid var(--fx-line); border-radius: 999px; font-size: 0.85rem; white-space: nowrap; }
  .fx-nav-item img { width: 20px; height: 20px; }
  .fx-nav-count { min-width: 0; padding: 0 6px; font-size: 0.7rem; }
  .fx-nav-new { width: 6px; height: 6px; }
}
@media (max-width: 480px) {
  .fx-page .fx-intro { font-size: 0.98rem; }
  .fx-card-head { padding: 12px; font-size: 0.95rem; }
  .fx-card-body { padding: 12px 12px 4px; }
  .fx-items li { gap: 10px; padding: 8px 10px; font-size: 0.93rem; }
  .fx-item-icon { width: 26px; height: 26px; }
  .fx-section { padding-left: 8px; }
}

/* Right-to-left (Arabic) */
html[dir="rtl"] .fx-search input { padding: 12px 42px 12px 16px; background-position: right 16px center; }
html[dir="rtl"] .fx-nav-item.is-active { background: linear-gradient(270deg, rgba(243, 156, 18, 0.9), rgba(202, 120, 30, 0.75)); }
html[dir="rtl"] .fx-card-head { text-align: right; }
html[dir="rtl"] .fx-chevron { margin-right: 0; margin-left: 4px; }
html[dir="rtl"] .fx-how { border-left: 0; border-right: 3px solid var(--fx-orange); }
html[dir="rtl"] .fx-section { padding-left: 0; padding-right: 12px; border-left: 0; border-right: 2px solid var(--fx-line); }
html[dir="rtl"] .fx-page, html[dir="rtl"] .fx-page * { letter-spacing: 0 !important; }
@media (max-width: 480px) { html[dir="rtl"] .fx-section { padding-right: 8px; } }

@media (prefers-reduced-motion: reduce) {
  .fx-page *, .fx-page *::before, .fx-page *::after { animation: none !important; transition: none !important; }
}
