/* CSS Variables for Light/Dark Theming */
:root {
    --bg-primary: #ffffff;
    --bg-alt: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    --radius: 6px;
    --font: 'Inter', sans-serif;
    --icon-color: #475569;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --footer-text: #94a3b8;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-alt: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --icon-color: #94a3b8;
    --nav-bg: rgba(15, 23, 42, 0.85);
    --footer-text: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition-duration: 0.01ms !important; }
}

body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Utilities */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.section-padding { padding: 80px 0; }
.bg-alt { background-color: var(--bg-alt); transition: background-color 0.25s ease; }

/* Typography */
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; }
.subtitle {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.section-header h2 { font-size: 2rem; margin-bottom: 1rem; }
.section-header.center-align { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Header & Nav */
#header {
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    display: flex;
    align-items: center;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
}
.logo-dot { color: var(--accent); }

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--accent); }

.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-primary); }

/* Theme Toggle */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-color);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.theme-btn:hover, .theme-btn:focus-visible {
    background: var(--bg-alt);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Hero */
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.hero-content { order: 0; }
.hero-image-wrapper { order: 1; text-align: right; }

.hero-img {
    width: 100%;
    max-width: 350px;
    height: auto;
    aspect-ratio: 1/1;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
}
.hero-intro { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.hero-intro strong { color: var(--text-primary); }
.hero h1 { font-size: 3rem; line-height: 1.1; margin-bottom: 0.25rem; }
.hero-sub { font-size: 1.25rem; color: var(--text-secondary); font-weight: 400; margin-bottom: 1.5rem; }
.hero-desc { font-size: 1.1rem; color: var(--text-secondary); max-width: 500px; margin-bottom: 2rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
}
.btn-primary { background: var(--text-primary); color: var(--bg-primary); }
.btn-primary:hover, .btn-primary:focus-visible { background: #1e293b; transform: translateY(-1px); }
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn-primary:focus-visible { background: #334155; }

.btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover, .btn-secondary:focus-visible { background: var(--bg-alt); border-color: var(--accent); }

.btn-icon { padding: 0.75rem; border-radius: 50%; background: transparent; border-color: var(--border); color: var(--text-primary); width: 44px; height: 44px; }
.btn-icon:hover, .btn-icon:focus-visible { background: var(--bg-alt); border-color: var(--accent); }

.btn-small { padding: 0.4rem 1rem; font-size: 0.875rem; }
.btn-small.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-small.btn-outline:hover, .btn-small.btn-outline:focus-visible { background: var(--bg-alt); color: var(--text-primary); }
.full-width { width: 100%; }

.hero-buttons { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* About */
.about-content p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 2rem; max-width: 700px; }
.about-details { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.detail-item { display: flex; flex-direction: column; }
.detail-item .label { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.detail-item .value { color: var(--text-secondary); font-size: 0.95rem; }

/* SKILLS - Updated with Real Icons */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem 5rem;
    margin-top: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.skill-category h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.skill-list li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease;
}

.skill-list li i {
    font-size: 1.1rem; /* 17.6px roughly */
}

.skill-list li:hover {
    color: var(--text-primary);
}

/* PROJECTS - Updated Hierarchy & Icons */
.projects-grid { display: flex; flex-direction: column; gap: 4rem; margin-top: 3rem; }
.project-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: box-shadow 0.2s, background-color 0.25s ease, border-color 0.25s ease;
}
.project-card:hover { box-shadow: var(--shadow); }
.project-card.alt-layout { direction: rtl; }
.project-card.alt-layout .project-content { direction: ltr; text-align: left; }

.section-desc {
    color: var(--text-secondary);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.project-image-wrapper {
    background: var(--bg-alt);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 250px;
    overflow: hidden;
    transition: background-color 0.25s ease;
}
.project-image-wrapper img { max-width: 100%; max-height: 100%; object-fit: contain; }

.project-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.project-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--accent);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
    max-width: 90%;
}

.project-tech-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tech-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 0.1rem;
}

.tech-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
}

.tech-items span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    padding: 0;
}

.tech-items i { font-size: 1.1rem; }

.project-links { display: flex; gap: 0.75rem; }
.project-links .btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
}
.project-links .btn-primary:hover { background: var(--accent-hover); }

/* Journey */
.timeline { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.timeline-item { display: flex; gap: 1.5rem; position: relative; padding-left: 0.5rem; }
.timeline-dot {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    position: relative;
}
.timeline-dot::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 5px;
    width: 2px;
    height: 100%;
    background: var(--border);
}
.timeline-item:last-child .timeline-dot::after { display: none; }
.timeline-content .timeline-date { font-size: 0.875rem; color: var(--text-light); font-weight: 500; }
.timeline-content h3 { font-size: 1.1rem; margin-bottom: 0.1rem; color: var(--text-primary); }
.timeline-content p { color: var(--text-secondary); font-size: 0.95rem; }

/* Contact */
.contact-wrapper { max-width: 500px; margin: 0 auto; margin-top: 2rem; }
.contact-socials { display: flex; justify-content: center; gap: 2rem; margin-bottom: 2rem; }
.contact-socials a { color: var(--text-secondary); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 0.5rem; transition: color 0.2s; }
.contact-socials a:hover, .contact-socials a:focus-visible { color: var(--accent); }

.contact-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; }
.form-group input, .form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s, background-color 0.25s ease, color 0.25s ease;
    width: 100%;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-light); }
.error-msg { color: #dc2626; font-size: 0.875rem; margin-top: 0.25rem; min-height: 1.2rem; }

#responseMessage { margin-top: 0.5rem; padding: 0.75rem; border-radius: var(--radius); text-align: center; font-size: 0.95rem; }
#responseMessage.hidden { display: none; }
#responseMessage.success { background: #dcfce7; color: #166534; }
[data-theme="dark"] #responseMessage.success { background: #14532d; color: #86efac; }
#responseMessage.error { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] #responseMessage.error { background: #450a0a; color: #fca5a5; }

.hidden { display: none !important; }

/* Footer */
footer { background: var(--bg-alt); color: var(--footer-text); padding: 40px 0; text-align: center; border-top: 1px solid var(--border); transition: background-color 0.25s ease, border-color 0.25s ease; }
.footer-links { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--text-secondary); font-size: 1.2rem; transition: color 0.2s; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--accent); }

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; gap: 2rem; }
    .hero-image-wrapper { order: -1; text-align: center; }
    .hero-img { max-width: 200px; }
    .hero-desc { margin-left: auto; margin-right: auto; max-width: 100%; }
    .hero-buttons { justify-content: center; }
    .about-details { grid-template-columns: 1fr; }
    .build-grid { grid-template-columns: 1fr; text-align: center; }
    .build-item p { max-width: 100%; }
    .projects-grid { gap: 2rem; }
    .project-card { grid-template-columns: 1fr; padding: 1.5rem; text-align: center; }
    .project-card.alt-layout { direction: ltr; }
    .project-image-wrapper { height: 180px; padding: 0.5rem; margin-bottom: 1rem; }
    .project-links { justify-content: center; }
    .project-desc { max-width: 100%; }
    .project-tech-row { justify-content: center; }
    .tech-label { width: 100%; text-align: center; padding-top: 0; margin-bottom: 0.2rem; }
    .tech-items { justify-content: center; }
    .timeline-item { padding-left: 0; }
    .contact-socials { flex-direction: column; align-items: center; gap: 1rem; }
    .skills-grid { grid-template-columns: 1fr; gap: 2.5rem; text-align: left; }
    .skill-category h3 { justify-content: flex-start; }
}

@media (max-width: 600px) {
    .section-padding { padding: 60px 0; }
    .hero h1 { font-size: 2.5rem; }
    .hero-img { max-width: 160px; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--bg-primary);
        padding: 2rem;
        border-bottom: 1px solid var(--border);
        gap: 1.5rem;
        align-items: center;
        box-shadow: var(--shadow);
    }
    .nav-links.active { display: flex; }
    .menu-toggle { display: block; }
}