/* --- Global Styles --- */
:root {
    --ign-red: #e62429;
    --nav-height: 3.5rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

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

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

body {
    background-color: #1a1a1a;
    color: white;
    overflow-x: hidden;
    min-height: 100dvh;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    padding-bottom: var(--safe-bottom);
}

img,
video {
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
}

/* --- Mobile Navigation --- */

.site-nav {
    padding-top: var(--safe-top);
}

.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.625rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-nav {
    border-top: 1px solid #1f2937;
    background: #000;
    padding: 0.5rem 1rem 0.75rem;
}

.mobile-nav-link {
    display: block;
    padding: 0.875rem 0.5rem;
    color: #d1d5db;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 1px solid #1f2937;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link.active,
.mobile-nav-link:hover {
    color: #fff;
}

.mobile-nav-link.active {
    color: var(--ign-red);
}

/* --- Search Modal --- */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(var(--safe-top) + 1rem) 1rem 1rem;
}

.search-modal.hidden {
    display: none;
}

.search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-modal__panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.search-modal__input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 16px;
    color: #fff;
    background: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.5rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.search-modal__input:focus {
    border-color: var(--ign-red);
    box-shadow: 0 0 0 2px rgba(230, 36, 41, 0.25);
}

.search-modal__btn {
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.search-modal__btn--primary {
    background: var(--ign-red);
    color: #fff;
}

.search-modal__btn--secondary {
    background: #374151;
    color: #e5e7eb;
}

/* --- Footer touch targets --- */

.site-footer a {
    display: inline-block;
    padding: 0.5rem 0.25rem;
    min-height: 2.75rem;
    line-height: 1.75rem;
}

/* --- Layout & Sections --- */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    .hero-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.article-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .article-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .article-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Hero Components --- */
.hero-main {
    grid-column: span 1;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

@media (min-width: 1024px) {
    .hero-main {
        grid-column: span 2;
    }
}

.hero-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-sub-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    height: 160px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .hero-sub-item {
        height: 190px;
    }
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, black, rgba(0,0,0,0.8), transparent);
}

@media (min-width: 640px) {
    .hero-overlay {
        padding: 1.5rem;
    }
}

.category-tag {
    color: var(--ign-red);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    background-color: rgba(69, 10, 10, 0.6);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
    display: inline-block;
}

/* --- Article Cards --- */
.article-card {
    display: flex;
    flex-direction: column;
}

.article-image-wrapper {
    width: 100%;
    height: 12rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
    background-color: #1f2937;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.article-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-card:hover .article-image-wrapper img {
    transform: scale(1.1);
}

/* --- Base Additions & Interactions --- */

.article-link {
    cursor: pointer;
    /* Add smooth transition for hover and active states */
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

/* Enhanced press effect for better tactile feedback */
.article-link:active {
    opacity: 0.75;
    transform: scale(0.99);
}

/* --- Navigation Links --- */

.nav-link {
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

/* Add a clean, animated underline effect for hover/active states */
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: #e62429; /* Matches ign-red */
    transition: width 0.3s ease-in-out;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* --- Article Details Typography Optimization --- */

.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.prose p {
    /* Slightly increased margin and added line-height for better readability */
    margin-bottom: 1.75rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
}

/* --- Logo Interaction --- */

.logo-text {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-text:hover {
    opacity: 0.85;
}

/* --- Mobile Typography & Spacing --- */

@media (max-width: 639px) {
    .hero-grid {
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .article-grid {
        gap: 1.5rem;
    }

    .article-image-wrapper {
        height: 10rem;
    }

    .prose p {
        font-size: 1rem;
        line-height: 1.75;
        margin-bottom: 1.25rem;
    }

    .legal-page h1 {
        font-size: 1.75rem;
        line-height: 1.25;
    }

    .article-body p {
        font-size: 1rem !important;
        line-height: 1.75 !important;
    }
}

/* Prevent iOS zoom on focused inputs (font-size >= 16px handled in modal) */

@supports (padding: max(0px)) {
    .site-nav .max-w-7xl {
        padding-left: max(1rem, var(--safe-left));
        padding-right: max(1rem, var(--safe-right));
    }
}