/* =============================================
   ROOT VARIABLES – Blue & White Theme
   ============================================= */
:root {
    --blue-dark:    #003a75;
    --blue-mid:     #004080;
    --blue-light:   #0066cc;
    --blue-accent:  #0088ff;
    --bg-page:      #f0f6ff;
    --white:        #ffffff;
    --text-dark:    #1a1a2e;
    --text-mid:     #444466;
    --text-light:   #667799;
    --border:       #c5d8f5;
    --speed:        0.3s;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; }

/* =============================================
   PUNTLAND FLAG BAR
   ============================================= */
.flag-bar {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 36px;
    position: sticky;
    top: 0;
    z-index: 200;
}

.flag-stripe {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-blue  { background-color: #4ab8ff; }
.flag-white { background-color: #ffffff; position: relative; }
.flag-green { background-color: #009933; }

.flag-star {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    line-height: 1;
    color: #4ab8ff;
    text-shadow: 0 0 6px rgba(0,0,0,0.15);
    /* The star sits on the white stripe; top blue colour applied */
}

/* =============================================
   NAVBAR
   ============================================= */
.navbar {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
    color: var(--white);
    padding: 0.5rem 0;
    position: sticky;
    top: 36px;
    z-index: 190;
    box-shadow: 0 4px 20px rgba(0, 64, 128, 0.4);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* ---- LOGO ---- */
.nav-logo { display: flex; align-items: center; }

.logo-image {
    height: 110px;
    max-width: 320px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
}

.logo-fallback {
    display: none;
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 3px;
    border: 2px solid rgba(255,255,255,0.4);
    padding: 6px 16px;
    border-radius: 6px;
}

/* ---- RIGHT SIDE ---- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-date {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
}

/* =============================================
   LANGUAGE SWITCHER  (custom – no Google widget)
   ============================================= */
.lang-switcher {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    padding: 7px 14px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: background var(--speed), border-color var(--speed);
    white-space: nowrap;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.6);
}

.lang-btn .chevron {
    transition: transform var(--speed);
}

.lang-btn.open .chevron {
    transform: rotate(180deg);
}

.lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,64,128,0.25);
    overflow: hidden;
    min-width: 160px;
    z-index: 300;
    animation: dropIn 0.2s ease;
}

.lang-menu.open {
    display: block;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-dark);
    text-align: left;
    transition: background var(--speed);
}

.lang-option:hover {
    background: var(--bg-page);
}

.lang-option.active {
    background: #e8f0ff;
    color: var(--blue-mid);
    font-weight: 600;
}

.lang-flag { font-size: 1.2rem; }

/* =============================================
   HERO
   ============================================= */
.hero-section {
    background: var(--white);
    border-bottom: 4px solid var(--blue-mid);
    padding: 3rem 24px 2.5rem;
    text-align: center;
}

.newspaper-title {
    font-size: clamp(2rem, 5vw, 3.8rem);
    color: var(--blue-dark);
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.newspaper-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 400;
}

/* =============================================
   MAIN CONTAINER
   ============================================= */
.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 24px 4rem;
}

/* =============================================
   FEATURED ARTICLE
   ============================================= */
.featured-article {
    display: grid;
    grid-template-columns: 3fr 2fr;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,64,128,0.12);
    margin-bottom: 3rem;
    cursor: pointer;
    transition: transform var(--speed), box-shadow var(--speed);
}

.featured-article:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0,64,128,0.2);
}

.featured-image-wrapper {
    position: relative;
    min-height: 420px;
    overflow: hidden;
}

.featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    display: block;
}

.featured-article:hover .featured-img { transform: scale(1.05); }

.featured-text {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.2rem;
}

.featured-text h2 {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--blue-dark);
    line-height: 1.25;
}

.featured-text .excerpt {
    font-size: 1rem;
    color: var(--text-mid);
    flex-grow: 1;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--blue-light);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: gap var(--speed), color var(--speed);
}

.featured-article:hover .read-more {
    color: var(--blue-dark);
    gap: 12px;
}

/* =============================================
   CATEGORY BADGES
   ============================================= */
.category-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--blue-mid);
    color: var(--white);
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 5;
}

.category-badge.small {
    padding: 4px 10px;
    font-size: 0.72rem;
}

/* Badge inside modal header (not absolute) */
.category-badge.inline {
    position: static;
    display: inline-block;
    margin-bottom: 0.75rem;
}

/* =============================================
   NEWS GRID
   ============================================= */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.news-card {
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,64,128,0.08);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform var(--speed), box-shadow var(--speed);
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0,64,128,0.18);
}

.card-image-wrapper {
    position: relative;
    height: 210px;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s ease;
}

.news-card:hover .card-image-wrapper img { transform: scale(1.06); }

.card-content {
    padding: 1.4rem 1.5rem 1.6rem;
    flex-grow: 1;
}

.card-content h3 {
    font-size: 1.05rem;
    color: var(--blue-dark);
    margin-bottom: 0.6rem;
    line-height: 1.35;
}

.card-content p {
    font-size: 0.9rem;
    color: var(--text-mid);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
    background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 100%);
    color: var(--white);
    padding: 4rem 24px 2rem;
    text-align: center;
}

.footer h2 {
    color: #a8d4ff;
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.footer p {
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.footer-bottom {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
}

/* =============================================
   MODALS
   ============================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 30, 80, 0.75);
    backdrop-filter: blur(6px);
    overflow-y: auto;
    padding: 40px 20px;
    /* Fade animation state */
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal.visible {
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    max-width: 820px;
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,30,80,0.5);
    position: relative;
    transform: translateY(30px);
    transition: transform 0.3s ease;
}

.modal.visible .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.15);
    color: var(--white);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background var(--speed), color var(--speed);
}

.close-btn:hover {
    background: var(--blue-light);
    color: var(--white);
}

.modal-header {
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
    padding: 2rem 2.5rem 1.8rem;
    color: var(--white);
}

.modal-header .category-badge.inline {
    background: rgba(255,255,255,0.2);
    color: var(--white);
}

.modal-header h2 {
    font-size: clamp(1.3rem, 3vw, 2rem);
    color: var(--white);
    line-height: 1.25;
}

.modal-img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    display: block;
}

.modal-body {
    padding: 2rem 2.5rem 2.5rem;
}

.modal-body p {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-dark);
    margin-bottom: 1.2rem;
}

.modal-body p:last-child { margin-bottom: 0; }

/* =============================================
   RTL SUPPORT (Arabic)
   ============================================= */
body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .nav-container  { flex-direction: row-reverse; }
body[dir="rtl"] .nav-right      { flex-direction: row-reverse; }
body[dir="rtl"] .lang-menu      { right: auto; left: 0; }
body[dir="rtl"] .category-badge { left: auto; right: 16px; }
body[dir="rtl"] .featured-article { direction: rtl; }
body[dir="rtl"] .close-btn      { right: auto; left: 18px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .featured-article { grid-template-columns: 1fr; }
    .featured-image-wrapper { min-height: 280px; }
}

@media (max-width: 640px) {
    .news-grid { grid-template-columns: 1fr; }
    /* Keep navbar always horizontal - never wrap or stack */
    .nav-container { flex-wrap: nowrap; gap: 8px; }
    .nav-right { flex-wrap: nowrap; gap: 10px; }
    .nav-date { display: none; }
    .logo-image { height: 90px; max-width: 200px; }
    .modal-header { padding: 1.5rem; }
    .modal-body { padding: 1.5rem; }
}
