/* Home – Mobile-first, utility-light styles */

.home-page { background: var(--bg-primary); }

/* Container utility (fallback if not present in main.css) */
.container { max-width: 72rem; margin-inline: auto; padding-inline: var(--space-4); }

/* Hero Section - Refined */
.hero { 
    padding: var(--space-16) 0; 
    background: linear-gradient(180deg, var(--white) 0%, var(--bg-secondary) 100%);
    position: relative;
}

.hero .container { display: grid; align-items: center; }
.hero__body { text-align: center; max-width: 48rem; margin: 0 auto; }

.hero__title { 
    font-size: var(--font-size-3xl); 
    line-height: var(--line-height-tight); 
    font-weight: 800; 
    color: var(--text-primary); 
    margin: 0 0 var(--space-4); 
    text-align: center;
    letter-spacing: -0.025em;
}

.hero__subtitle { 
    color: var(--text-secondary); 
    margin: 0 0 var(--space-8); 
    text-align: center;
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    max-width: 36rem;
    margin-inline: auto;
}

/* Search input - Refined */
.input { 
    display: flex; 
    border: 2px solid var(--gray-200); 
    border-radius: var(--radius-xl); 
    overflow: hidden; 
    background: var(--white); 
    box-shadow: var(--shadow-md);
    transition: var(--transition-all);
}

.input:focus-within {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.input__field { 
    flex: 1; 
    border: 0; 
    padding: var(--space-4) var(--space-5); 
    font-size: var(--font-size-base); 
    background: transparent; 
    min-height: 52px;
}

.input__field:focus { outline: none; }

.input__action { 
    border: 0; 
    background: var(--bg-gradient); 
    color: #fff; 
    padding: 0 var(--space-6); 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    transition: var(--transition-all);
    min-width: 56px;
}

.input__action:hover { 
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

/* Language Flags - Refined */
.hero__flags { margin: var(--space-8) 0; display: flex; justify-content: center; }

.flags-container { 
    display: flex; 
    gap: var(--space-3); 
    align-items: center;
    padding: var(--space-2);
    background: var(--gray-100);
    border-radius: var(--radius-full);
}

.flag-link { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: var(--space-2); 
    border-radius: 50%; 
    transition: var(--transition-all); 
    text-decoration: none;
    border: 2px solid transparent;
}

.flag-link:hover { 
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md); 
    background: var(--white);
}

.flag-link.active { 
    box-shadow: var(--shadow-primary);
    background: var(--white);
    border-color: var(--primary-color);
}

.hero-flag { 
    border-radius: 50%; 
    object-fit: cover; 
    transition: var(--transition-all); 
}

.flag-link:hover .hero-flag { transform: scale(1.05); }

/* Buttons - Using Brand System */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
    padding: 0.875rem 1.75rem; 
    border-radius: var(--radius-xl); 
    text-decoration: none; 
    font-weight: 600; 
    border: 2px solid transparent; 
    transition: var(--transition-all); 
    min-height: 48px;
    font-size: var(--font-size-sm);
}

.btn--primary { 
    background: var(--bg-gradient); 
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.btn--primary:hover { 
    transform: translateY(-2px); 
    box-shadow: var(--shadow-primary-lg);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
}

.btn--neutral { 
    background: var(--white); 
    color: var(--text-secondary); 
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.btn--neutral:hover { 
    background: var(--gray-50); 
    border-color: var(--gray-300);
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md);
}

.btn--outline { 
    background: transparent; 
    color: var(--primary-color); 
    border: 2px solid var(--primary-color); 
}

.btn--outline:hover { 
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.hero__actions { 
    margin-top: var(--space-8); 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: var(--space-3); 
}

.hero__search {
    margin-bottom: var(--space-4);
    max-width: 32rem;
    margin-inline: auto;
}

/* Section - Refined */
.section { 
    padding: var(--space-16) 0; 
    background: var(--white); 
}

.section--muted { 
    background: var(--bg-secondary); 
}

.section__title { 
    text-align: center; 
    color: var(--text-primary); 
    font-weight: 800; 
    font-size: var(--font-size-2xl); 
    margin: 0 0 var(--space-2);
    letter-spacing: -0.025em;
}

.section__subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-base);
    margin: 0 0 var(--space-8);
    max-width: 32rem;
    margin-inline: auto;
}

.section__footer { text-align: center; margin-top: var(--space-10); }

/* Cards list - Refined */
.cards { 
    list-style: none; 
    padding: 0; 
    margin: var(--space-10) 0 0; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: var(--space-4); 
    align-items: stretch; 
}

.cards__item { display: flex; }

.card { 
    display: flex; 
    flex-direction: column; 
    background: var(--white); 
    border: 1px solid var(--gray-200); 
    border-radius: var(--radius-xl); 
    padding: var(--space-6); 
    text-decoration: none; 
    color: inherit; 
    box-shadow: var(--shadow-sm); 
    transition: var(--transition-all); 
    text-align: center; 
    height: 100%; 
}

.card:hover { 
    transform: translateY(-4px); 
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.card__icon { 
    width: 64px; 
    height: 64px; 
    margin: 0 auto var(--space-4); 
    border-radius: var(--radius-xl); 
    display: grid; 
    place-items: center; 
    background: var(--bg-gradient); 
    color: #fff; 
    font-size: 1.5rem;
    box-shadow: var(--shadow-primary);
}

.card__title { 
    margin: 0 0 var(--space-2); 
    font-size: var(--font-size-lg); 
    color: var(--text-primary); 
    font-weight: 700; 
    text-align: center; 
}

.card__text { 
    margin: 0; 
    color: var(--text-muted); 
    text-align: center;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

.card__spacer { margin-top: auto; }

/* Grids - Refined */
.grid { 
    list-style: none; 
    padding: 0; 
    margin: var(--space-10) 0 0; 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: var(--space-4); 
    align-items: stretch; 
}

.grid--products { grid-template-columns: 1fr 1fr; }
.grid__item { display: flex; }

/* Product media - Refined */
.product { 
    display: block; 
    text-decoration: none; 
    color: inherit; 
    border-radius: var(--radius-xl); 
    overflow: hidden; 
    border: 1px solid var(--gray-200); 
    box-shadow: var(--shadow-sm);
    transition: var(--transition-all);
    width: 100%;
}

.product:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.product__media { 
    aspect-ratio: 3/4; 
    position: relative; 
    overflow: hidden;
    background: var(--gray-100);
}

.product__media img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: var(--transition-slow); 
    display: block; 
}

.product:hover .product__media img { transform: scale(1.05); }

/* Tiles (categories/subjects) - Refined */
.tile { 
    display: flex; 
    flex-direction: column; 
    background: var(--white); 
    border: 1px solid var(--gray-200); 
    border-radius: var(--radius-xl); 
    padding: var(--space-5); 
    text-decoration: none; 
    color: inherit; 
    box-shadow: var(--shadow-sm); 
    transition: var(--transition-all); 
    text-align: center; 
    width: 100%; 
    min-height: 180px; 
}

.tile:hover { 
    transform: translateY(-4px); 
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.tile__icon { 
    width: 52px; 
    height: 52px; 
    margin: 0 auto var(--space-4); 
    border-radius: var(--radius-lg); 
    display: grid; 
    place-items: center; 
    color: #fff; 
    font-size: 1.25rem; 
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.tile__title { 
    margin: 0 0 var(--space-2); 
    font-size: var(--font-size-base); 
    font-weight: 700; 
    color: var(--text-primary); 
    flex-shrink: 0; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    line-height: 1.4; 
    min-height: 2.8em; 
    text-align: center; 
}

.tile__text { 
    margin: 0; 
    color: var(--text-muted); 
    flex: 1; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    font-size: var(--font-size-sm); 
    line-height: 1.5; 
    min-height: 3em; 
    text-align: center; 
}

.tile__spacer { margin-top: auto; }

/* Focus styles */
.btn:focus, .input__action:focus, .input__field:focus, .card:focus, .tile:focus { 
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.25); 
}

/* Larger screens */
@media (min-width: 480px) {
    .hero__title { font-size: var(--font-size-4xl); }
    .hero__subtitle { font-size: var(--font-size-lg); }
}

@media (min-width: 768px) {
    .hero { padding: var(--space-20) 0; }
    .hero__title { font-size: 2.5rem; }
    .hero__actions { grid-template-columns: repeat(3, max-content); justify-content: center; }
    .cards { grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }
    .grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
    .grid--products { grid-template-columns: repeat(4, 1fr); }
    .section__title { font-size: var(--font-size-3xl); }
    .tile { min-height: 200px; }
}

@media (min-width: 1024px) {
    .hero__title { font-size: 3rem; }
    .grid--products { grid-template-columns: repeat(5, 1fr); }
    .grid { grid-template-columns: repeat(4, 1fr); }
}

/* RTL Support - Ensure centering works properly in RTL mode */
[dir="rtl"] .hero__body,
[dir="rtl"] .hero__title,
[dir="rtl"] .hero__subtitle {
    text-align: center !important;
}

[dir="rtl"] .card,
[dir="rtl"] .card__title,
[dir="rtl"] .card__text {
    text-align: center !important;
}

[dir="rtl"] .section__title {
    text-align: center !important;
}

[dir="rtl"] .tile,
[dir="rtl"] .tile__title,
[dir="rtl"] .tile__text {
    text-align: center !important;
}