/* ==============================================
   ISLAMIC MINIMALIST PORTFOLIO DESIGN
   ============================================== */

:root {
    --primary-color: #1f4d3d;
    --primary-light: #2d6a4f;
    --primary-dark: #1a3a2f;
    --secondary-color: #d4af37;
    --accent-color: #e8b843;
    
    --bg-light: #fcfbf7;
    --bg-secondary: #f5f3ed;
    --bg-tertiary: #efefea;
    
    --text-primary: #1a1917;
    --text-secondary: #54524f;
    --text-light: #7a7771;
    
    --border-color: #e8e4dd;
    --divider-color: #ddd9d0;
    
    --shadow-sm: 0 1px 2px rgba(31, 77, 61, 0.05);
    --shadow-md: 0 4px 8px rgba(31, 77, 61, 0.08);
    --shadow-lg: 0 8px 16px rgba(31, 77, 61, 0.12);
    --shadow-xl: 0 16px 32px rgba(31, 77, 61, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease-out;
}

body.dark-mode {
    --bg-light: #0d0c0a;
    --bg-secondary: #14130f;
    --bg-tertiary: #1a1915;
    --text-primary: #f5f3ed;
    --text-secondary: #d4d0c9;
    --text-light: #9a9591;
    --border-color: #2a2620;
    --divider-color: #3a3632;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.8;
    transition: var(--transition);
    letter-spacing: 0.3px;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

/* ============================================
   NAVIGATION
   ============================================ */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(252, 251, 247, 0.98);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

body.dark-mode .navbar {
    background: rgba(13, 12, 10, 0.98);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.5rem;
    animation: spin 20s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo:hover {
    color: var(--secondary-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    flex-grow: 1;
    justify-content: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--secondary-color);
    border-radius: 1px;
}

.theme-toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.theme-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    margin-top: 70px;
    min-height: calc(100vh - 70px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
}

.hero-content {
    animation: slideInRight 0.8s ease-out 0.2s both;
    z-index: 2;
}

.hero-badge {
    display: inline-block;
    background: var(--bg-secondary);
    border: 1px solid var(--secondary-color);
    color: var(--primary-color);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: clamp(2.25rem, 6.5vw, 5rem);
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    font-weight: 800;
    line-height: 1.02;
    text-align: right;
    display: block;
    font-family: 'IBM Plex Sans Arabic', 'IBM Plex Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Keep hero on a single line on larger viewports, allow wrapping on small screens */
.hero-title {
    white-space: nowrap;
    overflow-wrap: normal;
}

.hero-line {
    display: block;
    transform-origin: right center;
}

.hero-line + .hero-line {
    margin-top: 0.15rem;
}

.highlight-text {
    color: var(--secondary-color);
    position: relative;
    padding: 0.12rem 0.5rem;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(212,175,55,0.08), rgba(31,77,61,0.03));
    display: inline-block;
}

.highlight-text::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 0.2rem;
    left: 0.2rem;
    height: 6px;
    background: rgba(212,175,55,0.12);
    border-radius: 6px;
    z-index: -1;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
    font-family: 'IBM Plex Arabic', sans-serif;
    font-size: 1rem;
    min-height: 48px;
}

.cta-button.primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.cta-button.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.cta-button.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.cta-button.secondary:hover {
    background: var(--primary-color);
    color: white;
}

.cta-button:active {
    transform: translateY(0);
}

.hero-decorative {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 60%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(31, 77, 61, 0.05) 0%, transparent 50%);
    z-index: 1;
    pointer-events: none;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   APPS SECTION
   ============================================ */

.apps-section {
    padding: 6rem 2rem;
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: clamp(1.8rem, 5vw, 3rem);
}

/* Tighter spacing for section titles to improve visual rhythm */
.section-header h2,
.about-section h2,
.contact-section h2 {
    line-height: 1.12;
    margin-bottom: 0.6rem;
    letter-spacing: -0.28px;
}

.app-title {
    margin-bottom: 0.25rem;
    line-height: 1.1;
}

.section-header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.app-card {
    background: var(--bg-light);
    border-radius: 0.75rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--transition);
    overflow: hidden;
    position: relative;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease-out;
}

.app-card:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.app-title {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 700;
    flex-grow: 1;
}

.app-badge {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.app-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.app-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    border-radius: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.feature-tag:hover {
    border-color: var(--secondary-color);
    color: var(--primary-color);
}

.view-btn {
    align-self: flex-start;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.95rem;
    font-family: 'IBM Plex Arabic', sans-serif;
}

.view-btn:hover {
    background: var(--secondary-color);
    transform: translateX(-4px);
}

.view-btn:active {
    transform: translateX(-2px);
}

/* App icon & Play Store button */
.app-meta {
    margin-left: 0.75rem;
    display: flex;
    align-items: center;
}

.app-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    font-size: 1.6rem;
    background: linear-gradient(135deg, rgba(212,175,55,0.08), rgba(31,77,61,0.04));
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.app-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 12px;
}

.play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    color: #1a1917;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 700;
    border: none;
    transition: var(--transition-fast);
}

.play-btn:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   MODAL GALLERY
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    transition: opacity 0.3s ease-out;
    padding: 2rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    position: relative;
    background: var(--bg-light);
    border-radius: 1rem;
    padding: 2.5rem;
    max-width: 700px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--bg-secondary);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    line-height: 1;
}

.modal-close:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.gallery-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.gallery-image {
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
    max-height: 500px;
    object-fit: contain;
    background: var(--bg-secondary);
}

.gallery-nav {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
}

.gallery-nav:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.gallery-nav.prev {
    order: -1;
}

.gallery-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.indicator:hover {
    background: var(--text-light);
}

.indicator.active {
    background: var(--primary-color);
    width: 28px;
    border-radius: 4px;
}

/* ============================================
   ABOUT SECTION
   ============================================ */

.about-section {
    padding: 6rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.about-section h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.about-section > p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Specific lead paragraph styling: centered with extra bottom spacing */
.about-lead {
    text-align: center;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 4rem;
    font-size: 1.06rem;
    color: var(--text-secondary);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.about-card {
    padding: 2.5rem 2rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.about-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.05), transparent);
    border-radius: 0.75rem;
    pointer-events: none;
}

.about-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--secondary-color);
}

.about-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.about-card h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ============================================
   CONTACT SECTION
   ============================================ */

.contact-section {
    padding: 6rem 2rem;
    background: var(--primary-color);
    color: white;
    text-align: center;
}

.contact-section h2 {
    color: white;
    margin-bottom: 1rem;
}

.contact-section > p {
    font-size: 1.1rem;
    margin-bottom: 3rem;
    opacity: 0.95;
    color: rgba(255, 255, 255, 0.9);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: var(--transition-fast);
    border: 2px solid rgba(255, 255, 255, 0.3);
    font-family: 'IBM Plex Arabic', sans-serif;
    min-height: 48px;
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
    transform: translateY(-2px);
}

.contact-icon {
    font-size: 1.2rem;
}

/* Center contact lead paragraph and add bottom spacing */
.contact-lead {
    text-align: center;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 3rem;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.95);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 3rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1.5rem;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-links {
        gap: 1.5rem;
        font-size: 0.9rem;
        order: 3;
        width: 100%;
        justify-content: space-around;
        margin-top: 0.5rem;
    }

    .theme-toggle {
        margin-left: 0;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 100px;
        min-height: auto;
        padding: 2rem 1rem;
    }

    /* Allow hero title to wrap on small screens */
    .hero-title {
        white-space: normal;
        font-size: clamp(1.6rem, 5.5vw, 2.6rem);
        line-height: 1.12;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .cta-button {
        width: 100%;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }

    .contact-btn {
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
        border-radius: 0.75rem;
    }

    .gallery-container {
        gap: 0.5rem;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.5rem 1rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .logo-icon {
        font-size: 1.2rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.85rem;
    }

    .apps-section,
    .about-section,
    .contact-section {
        padding: 3rem 1rem;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .app-card {
        padding: 1.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-badge {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        --bg-light: #0d0c0a;
        --bg-secondary: #14130f;
        --bg-tertiary: #1a1915;
        --text-primary: #f5f3ed;
        --text-secondary: #d4d0c9;
    }
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

@media print {
    .navbar,
    .theme-toggle,
    .contact-btn,
    .view-btn,
    .modal {
        display: none;
    }
}
