/* Google Fonts import link (Merriweather for headlines and Raleway for text) */

@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,opsz,wght@0,18..144,300..900;1,18..144,300..900&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap');


/* CSS variables */

:root {
    --primary-font: "Merriweather", serif;
    --secondary-font: "Raleway", sans-serif;
    --primary-color: #1A1A1A;  /* eerie black */
    --secondary-color: #2A2A2A;  /* jet */
    --text-color: #999999;  /* battleship gray */
    --headline-color: #FFB700;  /* selective yellow */
}


/* Global styles */

body {
    background-color: var(--primary-color);
    font-family: var(--secondary-font);
}


h1, h2, h3 {
    color: var(--headline-color);
    font-family: var(--primary-font);
}


p {
    color: var(--text-color);
    font-family: var(--secondary-font);
    line-height: 1.6;
}


/* Navbar styling */

.navbar-brand i {
    margin-right: 1.5rem; 
}


.nav-link {
    transition: color 0.3s ease;
}


/* Footer styling */

.footer-dark {
    background-color: var(--primary-color);
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}


.footer-text {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 400;
}


.footer-link {
    color: var(--headline-color);  
    text-decoration: none;
    transition: all 0.3s ease;
}


.footer-link:hover {
    text-decoration: underline;     
}


.footer-dark .author {
    font-size: 1.2rem;
    font-weight: 500;
    color: #ffffff;
}


/* Navbar and footer borders */

#navbar, #footer {
    border: 2px solid var(--text-color);
    border-radius: 7px;
    position: relative;
    z-index: 1;  
    background-color: #000; 
}


/* Sidebars with calligraphy art from the Kiswah */

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 40px;
    background-image: url(../images/kiswah-kaaba.webp);
    background-repeat: repeat-y;
    background-size: cover;
    opacity: 0.75;
    z-index: 0;
}


.sidebar-left { 
    left: 0; 
}


.sidebar-right { 
    right: 0; 
}


/* Main element centered */

.page-wrap, main {
    margin-left: 45px;   
    margin-right: 45px;   
    max-width: 900px;     
    margin-inline: auto;  
    padding: 20px;
    text-align: center;   
}


/* Styling of the background information and game instruction blocks */

.background-information,
.game-instructions {
    background-color: #222222;      
    border-radius: 15px;            
    padding: 25px;                  
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5); 
    max-width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}


.background-information {
    text-align: left;
}


.game-instructions {
    text-align: left; 
}


.background-information:hover,
.game-instructions:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
}


/* Spacing for columns */

.row.justify-content-center > .col-xl-6 {
    margin-bottom: 20px;
}

/* Styling of lists inside main element */

.background-information li,
.game-instructions li {
    color: var(--text-color);
    list-style: none;
    margin-bottom: 1rem;
}

.background-information li i,
.game-instructions li i {
    margin-right: 0.6rem;
}


/* Styling of game-level div and buttons*/

#game-levels-container {
    background-color: #222222;
    border: 2px solid var(--text-color);
    border-radius: 10px;
    padding: 25px;
}


#button-headline {
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}


#game-levels-container .btn-warning {
    transition: background-color 0.3s ease, color 0.3s ease, font-weight 0.3s ease;
}

#game-levels-container .btn-warning:hover {
    
    font-weight: 700;
    background-color: #e6a700;
    color: #000;
}


/* Game background container */

.game-background {
    position: relative;
    background-image: url(../images/kaaba-background.webp);
    background-size: cover;
    background-position: center;
    min-height: 120vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 40px;
    border-radius: 15px;
    margin: 20px auto;
    max-width: 1200px;
}


.game-background .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6); 
  border-radius: 15px;
  z-index: 1;
  pointer-events: none;
}

/* Base styling */
.card-grid {
    display: grid;
    gap: 20px; /* Increased from 15px for better spacing */
    width: 90%;
    max-width: 900px; /* Increased from 800px */
    z-index: 2;
    position: relative;
    padding: 20px;
}

/* Level-specific grid layouts */
.card-grid[data-level="easy"] {
    grid-template-columns: repeat(4, 1fr); /* 4x2 = 8 cards (4 pairs) */
}

.card-grid[data-level="medium"] {
    grid-template-columns: repeat(4, 1fr); /* 4x3 = 12 cards (6 pairs) */
}

.card-grid[data-level="challenging"] {
    grid-template-columns: repeat(4, 1fr); /* 4x4 = 16 cards (8 pairs) */
}

/* Card styling for flipping */
.card {
    perspective: 1000px;
    width: 100%;
    height: 160px; /* Increased from 140px for bigger cards */
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #ccc;
    border-radius: 10px;
    text-align: center;
    padding: 12px; /* Increased from 10px */
    box-sizing: border-box;
}

.card-front {
    background: #2c3e50;
    color: #fff;
    font-size: 28px; /* Increased from 24px */
}

.card-back {
    background: #fefefe;
    color: #333;
    transform: rotateY(180deg);
}

.card-back span {
    display: block;
    margin: 6px 0; /* Increased from 5px */
}

.card-back span[dir="rtl"] {
    font-size: 20px; /* Increased from 18px */
    font-weight: 600;
}


/* Responsive typography */

@media (max-width: 768px) {
    .footer-text { font-size: 1rem; }
}


/* Responsive sidebars */

@media (max-width: 768px) {
    .sidebar { width: 20px; }
    .page-wrap, main {
        margin-left: 25px;
        margin-right: 25px;
    }
}


/* Arabic text display (left to right) */

[dir="rtl"] {
    font-size: 1.2em;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px; /* Slightly increased from 10px */
        padding: 15px;
    }
    
    .card {
        height: 140px; /* Increased from 120px */
    }
    
    .card-front {
        font-size: 22px; /* Increased mobile font size */
    }
    
    .card-back {
        font-size: 15px; /* Increased from 14px */
    }
    
    .card-back span[dir="rtl"] {
        font-size: 17px; /* Increased mobile Arabic font size */
    }
}


/* Scoreboard styling */

#scoreboard {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px; /* space between counters and game */
}

.game-background {
    position: relative;
}


/* Game reset effect */

.flash {
    background-color: #fff7e6;
    transition: background-color 0.3s ease;
} 


/* Styling for links on links.html */

.link-list {
    text-align: left;
    padding-left: 1rem;
}

.link-list li {
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.link-list li i {
    color: var(--text-color);
    font-size: 1.2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.link-list .link-content {
    display: flex;
    flex-direction: column;
}

.link-list span {
    color: var(--text-color);
    display: block; 
    margin-bottom: 0.5rem;
}

.link-list li a {
    color: var(--headline-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.link-list li a:hover {
    text-decoration: underline;
    opacity: 0.8;
}


@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
        padding: 10px;
    }
    
    .card {
        height: 120px;
    }
}