/* ==========================================================================
   Hand-written component styles.
   These exist because the Tailwind CDN build only scans class names used
   directly in HTML — it can't process `@apply` inside a plain <style> tag.
   Values here mirror the Tailwind classes they replace so the design stays
   consistent if you later migrate to a full Tailwind build with @apply.
   ========================================================================== */

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

/* ---------- RTL layout polish (Arabic / Kurdish Badini) ---------- */
[dir="rtl"] .dropdown-panel {
    left: auto;
    right: 0;
}
[dir="rtl"] [data-mobile-dropdown-menu] {
    padding-left: 0;
    padding-right: 1rem;
}

/* Dropdown anchored to the right edge of its trigger (e.g. the language
   switcher, which sits at the far end of the nav) — opens toward the
   reading direction instead of running off the edge of the viewport. */
.dropdown-panel-end {
    left: auto;
    right: 0;
}
[dir="rtl"] .dropdown-panel-end {
    left: 0;
    right: auto;
}

html {
    scroll-behavior: smooth;
    /* Bumps the base rem size so every Tailwind utility (padding, gaps,
       font sizes, icon sizes, and even max-w-7xl containers) scales up
       proportionally site-wide, without editing every class by hand. */
    font-size: 115%;
}

@media (min-width: 1536px) {
    html {
        /* A touch larger again on very wide/desktop screens so the layout
           fills the viewport instead of leaving large empty side margins. */
        font-size: 125%;
    }
}

/* Custom scrollbar (optional, purely cosmetic) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgb(203 213 225);
    border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
    background-color: rgb(51 65 85);
}

/* Fallback for line-clamp on older Tailwind CDN builds */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Nav links ---------- */
.nav-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(55 65 81);
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}
.nav-link:hover {
    background-color: rgb(243 244 246);
    color: rgb(37 99 235);
}
.dark .nav-link {
    color: rgb(209 213 219);
}
.dark .nav-link:hover {
    background-color: rgb(31 41 55);
    color: rgb(96 165 250);
}

/* ---------- Mobile links ---------- */
.mobile-link {
    display: block;
    padding: 0.625rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgb(55 65 81);
}
.mobile-link:hover {
    background-color: rgb(243 244 246);
}
.dark .mobile-link {
    color: rgb(209 213 219);
}
.dark .mobile-link:hover {
    background-color: rgb(31 41 55);
}

/* ---------- Icon buttons (search / theme / discord / hamburger) ---------- */
.icon-btn {
    display: inline-flex;
    height: 2.5rem;
    width: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: rgb(75 85 99);
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}
.icon-btn:hover {
    background-color: rgb(243 244 246);
    color: rgb(17 24 39);
}
.dark .icon-btn {
    color: rgb(209 213 219);
}
.dark .icon-btn:hover {
    background-color: rgb(31 41 55);
    color: white;
}

/* ---------- Dropdown menus (desktop) ---------- */
.dropdown-panel {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    z-index: 50;
    width: 12rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(229 231 235);
    background-color: white;
    box-shadow:
        0 20px 25px -5px rgb(0 0 0 / 0.1),
        0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.dropdown-panel.open {
    display: block;
}
.dark .dropdown-panel {
    border-color: rgb(31 41 55);
    background-color: rgb(17 24 39);
}

.dropdown-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: rgb(55 65 81);
}
.dropdown-item:hover {
    background-color: rgb(243 244 246);
    color: rgb(37 99 235);
}
.dark .dropdown-item {
    color: rgb(209 213 219);
}
.dark .dropdown-item:hover {
    background-color: rgb(31 41 55);
    color: rgb(96 165 250);
}

/* ---------- Game cards ---------- */
.game-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 0.75rem;
    background-color: rgb(243 244 246);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    border: 1px solid rgb(229 231 235);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}
.game-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 25px -5px rgb(0 0 0 / 0.15),
        0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.game-card:hover img {
    transform: scale(1.1);
}
.dark .game-card {
    background-color: rgb(31 41 55);
    border-color: rgb(31 41 55);
}

/* Top-left PC / Windows platform badge */
.platform-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.4rem;
    border-radius: 0.375rem;
    background-color: rgb(0 0 0 / 0.65);
    color: white;
    backdrop-filter: blur(4px);
}

/* Top-right build/version tag */
.build-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    background-color: rgb(37 99 235 / 0.9);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* Inline (non-absolute) variants of the badges, used on the game detail page */
.platform-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border-radius: 0.375rem;
    background-color: rgb(17 24 39 / 0.85);
    color: white;
}
.build-badge-inline {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 0.375rem;
    background-color: rgb(37 99 235 / 0.9);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Bottom gradient title overlay */
.card-title-overlay {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 0.75rem 0.6rem 0.6rem;
    padding-top: 2rem;
    background: linear-gradient(
        to top,
        rgb(0 0 0 / 0.9),
        rgb(0 0 0 / 0.35) 70%,
        transparent
    );
}

/* ---------- Active nav state ---------- */
.nav-link[aria-current="page"],
.mobile-link[aria-current="page"] {
    color: rgb(37 99 235);
    background-color: rgb(239 246 255);
}
.dark .nav-link[aria-current="page"],
.dark .mobile-link[aria-current="page"] {
    color: rgb(96 165 250);
    background-color: rgb(30 41 59);
}

/* ---------- Small caret button used to open a nav dropdown ---------- */
.dropdown-caret-btn {
    display: inline-flex;
    height: 2.5rem;
    width: 1.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: rgb(107 114 128);
    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}
.dropdown-caret-btn:hover {
    background-color: rgb(243 244 246);
    color: rgb(37 99 235);
}
.dark .dropdown-caret-btn {
    color: rgb(156 163 175);
}
.dark .dropdown-caret-btn:hover {
    background-color: rgb(31 41 55);
    color: rgb(96 165 250);
}

/* ---------- Category tiles (categories.html) ---------- */
.category-tile {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(229 231 235);
    background-color: white;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}
.category-tile:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 15px -3px rgb(0 0 0 / 0.1),
        0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: rgb(191 219 254);
}
.dark .category-tile {
    border-color: rgb(31 41 55);
    background-color: rgb(17 24 39);
}
.dark .category-tile:hover {
    border-color: rgb(30 58 138);
}

/* ---------- Category chips (game detail page) ---------- */
.category-chip {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: rgb(239 246 255);
    color: rgb(37 99 235);
}
.dark .category-chip {
    background-color: rgb(30 58 138 / 0.4);
    color: rgb(96 165 250);
}

/* ---------- FAQ accordion ---------- */
.faq-item {
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
    background-color: white;
    padding: 0;
}
.dark .faq-item {
    border-color: rgb(31 41 55);
    background-color: rgb(17 24 39);
}
.faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: 1rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.faq-item summary::-webkit-details-marker {
    display: none;
}
.faq-item summary .faq-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.faq-item[open] summary .faq-chevron {
    transform: rotate(180deg);
}
.faq-item .faq-body {
    padding: 0 1.25rem 1.25rem;
    color: rgb(75 85 99);
    font-size: 0.9rem;
    line-height: 1.6;
}
.dark .faq-item .faq-body {
    color: rgb(209 213 219);
}

/* ---------- Search results dropdown ---------- */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgb(243 244 246);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background-color: rgb(243 244 246);
}
.dark .search-result-item {
    border-color: rgb(31 41 55);
}
.dark .search-result-item:hover {
    background-color: rgb(31 41 55);
}

/* ---------- Simple page hero ---------- */
.page-hero {
    border-bottom: 1px solid rgb(229 231 235);
    background-color: white;
}
.dark .page-hero {
    border-color: rgb(31 41 55);
    background-color: rgb(17 24 39);
}
