/* =====================================================
   Ali Jafar — Academic Personal Website v2
   Palette: Dark warm background + gold accent
   Fonts: Source Serif 4 (headings) + Inter (body)
   ===================================================== */

:root {
    /* Light Theme */
    --bg-main:      #f9f6ef;
    --bg-alt:       #f2ede1;
    --bg-card:      #ffffff;
    --text-main:    #1c1810;
    --text-muted:   #5c5340;
    --text-light:   #897d68;
    --accent:       #9a6b1a;
    --accent-hover: #7a5210;
    --accent-light: rgba(154,107,26,0.10);
    --border:       #ddd5c0;
    --border-light: #ede8da;
    --header-bg:    #1a1510;
    --header-text:  #e8dfc8;
    --gold:         #d4aa40;
    --gold-hover:   #ebb84e;
    --gold-dim:     #a88228;
    --tab-active:   #d4aa40;
}

[data-theme="dark"] {
    --bg-main:      #1c1a14;
    --bg-alt:       #242018;
    --bg-card:      #2a261d;
    --text-main:    #e8dfc8;
    --text-muted:   #9a917a;
    --text-light:   #6e6655;
    --accent:       #e8c55a;
    --accent-hover: #f5d97a;
    --accent-light: rgba(232,197,90,0.12);
    --border:       #3a3426;
    --border-light: #302c22;
    --header-bg:    #130f0b;
    --header-text:  #e8dfc8;
    --gold:         #e8c55a;
    --gold-hover:   #f5d97a;
    --gold-dim:     #b89840;
    --tab-active:   #e8c55a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.7;
    transition: background-color 0.25s, color 0.25s;
}

h1, h2, h3, h4, h5 {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--text-main);
    font-weight: 600;
    line-height: 1.3;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
p { margin-bottom: 0.9rem; color: var(--text-muted); }
ul { padding-left: 1.3rem; }
li { margin-bottom: 0.4rem; color: var(--text-muted); }

/* =====================================================
   SITE HEADER
   ===================================================== */
.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 2px solid var(--gold-dim);
}

.header-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 1.5rem 2rem 1.1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-identity {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid var(--gold-dim);
    flex-shrink: 0;
    background: #4a4a4a;
}

.header-text h1 {
    font-size: 1.65rem;
    color: #f0e8d0;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.1rem;
}

.header-title {
    font-size: 0.88rem;
    color: rgba(232,223,200,0.70);
    margin-bottom: 0.05rem;
    font-family: 'Inter', sans-serif;
}

.header-sub {
    font-size: 0.83rem;
    color: rgba(232,223,200,0.50);
    margin-bottom: 0.6rem;
    font-family: 'Inter', sans-serif;
}

.header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.header-links a {
    font-size: 0.8rem;
    color: rgba(201,168,76,0.85);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.58rem;
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 3px;
    transition: all 0.18s;
    font-family: 'Inter', sans-serif;
}

.header-links a:hover {
    background: rgba(201,168,76,0.12);
    color: var(--gold);
    border-color: rgba(201,168,76,0.55);
    text-decoration: none;
}

.header-controls { flex-shrink: 0; padding-top: 0.2rem; }

.theme-toggle {
    background: rgba(201,168,76,0.08);
    border: 1px solid rgba(201,168,76,0.25);
    color: rgba(201,168,76,0.75);
    width: 33px;
    height: 33px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.theme-toggle:hover {
    background: rgba(201,168,76,0.18);
    color: var(--gold);
}

/* Tab Navigation */
.tab-nav {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(201,168,76,0.12);
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(232,223,200,0.55);
    font-family: 'Inter', sans-serif;
    font-size: 0.855rem;
    font-weight: 500;
    padding: 0.65rem 1.15rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.18s;
    letter-spacing: 0.01em;
}

.tab-btn:hover {
    color: rgba(232,223,200,0.85);
    background: rgba(201,168,76,0.06);
}

.tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: rgba(201,168,76,0.07);
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.main-content {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 2rem;
}

.tab-panel { display: none; padding: 2.5rem 0 3.5rem; }
.tab-panel.active { display: block; }

/* =====================================================
   SECTION HEADERS
   ===================================================== */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
    margin-bottom: 1.8rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.93rem;
    margin-bottom: 1.8rem;
    margin-top: -1rem;
}

.subsection { margin-bottom: 2.6rem; }

.subsection-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: 'Inter', sans-serif;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
}

.subsection-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* =====================================================
   ABOUT — Two-column
   ===================================================== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
}

.about-bio h2 { margin-bottom: 1.1rem; }
.about-bio p { font-size: 0.96rem; }

/* Gold accent line under bio heading */
.about-bio h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: var(--gold);
    margin-top: 0.6rem;
}

/* Highlights row */
.highlights-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-top: 1.5rem;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--gold-dim);
    border-radius: 3px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.hl-label { font-size: 1rem; flex-shrink: 0; }

/* About sidebar info blocks */
.about-sidebar-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.info-block {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}
.info-block:first-child { padding-top: 0; }
.info-block:last-child { border-bottom: none; }

.info-block h3 {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--gold);
    font-family: 'Inter', sans-serif;
    margin-bottom: 0.65rem;
}

.info-row { margin-bottom: 0.4rem; }

.info-row-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-main);
    margin-bottom: 0.15rem;
    flex-wrap: wrap;
}

.info-date {
    font-size: 0.81rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.info-row-sub {
    font-size: 0.86rem;
    color: var(--text-muted);
}

/* Plain list */
.plain-list { list-style: none; padding: 0; }
.plain-list li {
    padding: 0.2rem 0;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
    margin-bottom: 0;
}
.plain-list li:last-child { border-bottom: none; }

/* Contact list */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.contact-list div { display: flex; align-items: center; gap: 0.5rem; }
.contact-list i { color: var(--gold); width: 14px; text-align: center; flex-shrink: 0; }
.contact-list a { color: var(--accent); }
.contact-list a:hover { text-decoration: underline; }

/* =====================================================
   CONTACT FORM
   ===================================================== */
.contact-form-wrap {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-top: 3px solid var(--gold-dim);
    border-radius: 4px;
    padding: 1.8rem 2rem;
    margin-top: 2rem;
}

.contact-form-wrap h3 {
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
    color: var(--text-main);
}

.contact-form-wrap > p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.4rem;
}

.cf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.cf-field { display: flex; flex-direction: column; gap: 0.3rem; }
.cf-field label {
    font-size: 0.79rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Inter', sans-serif;
}

.cf-field input,
.cf-field select,
.cf-field textarea {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0.6rem 0.8rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: var(--text-main);
    width: 100%;
    transition: border-color 0.18s;
    outline: none;
}

.cf-field input:focus,
.cf-field select:focus,
.cf-field textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(201,168,76,0.12);
}

.cf-field textarea { resize: vertical; min-height: 110px; }

.cf-full { grid-column: 1 / -1; }

.cf-submit {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-gold {
    background: var(--gold);
    color: #1a1510;
    border: none;
    border-radius: 3px;
    padding: 0.65rem 1.6rem;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: all 0.18s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-gold:hover {
    background: var(--gold-hover);
    transform: translateY(-1px);
}

.cf-note {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

.cf-success {
    display: none;
    padding: 0.75rem 1rem;
    background: rgba(201,168,76,0.12);
    border: 1px solid var(--gold-dim);
    border-radius: 3px;
    font-size: 0.88rem;
    color: var(--gold);
    margin-top: 0.75rem;
}

/* =====================================================
   PUBLICATIONS
   ===================================================== */
.pub-entry {
    display: flex;
    gap: 1rem;
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border-light);
}
.pub-entry:first-child { border-top: 1px solid var(--border-light); }

.pub-number {
    font-family: 'Source Serif 4', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    min-width: 26px;
    padding-top: 0.1rem;
}

.pub-body { flex: 1; }

.pub-title {
    font-family: 'Source Serif 4', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.28rem;
    line-height: 1.4;
}

.pub-authors {
    font-size: 0.89rem;
    color: var(--text-muted);
    margin-bottom: 0.18rem;
}

.pub-venue {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.pub-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.pub-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--gold-dim);
    border-radius: 3px;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}
.pub-link:hover {
    background: var(--gold);
    color: #1a1510;
    text-decoration: none;
    border-color: var(--gold);
}

/* PDF embed */
.pdf-embed {
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-alt);
}
.pdf-embed iframe {
    display: block;
    width: 100%;
    height: 600px;
    border: none;
}

/* =====================================================
   EXPERIENCE ENTRIES
   ===================================================== */
.exp-entry {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border-light);
}
.exp-entry:first-child { border-top: 1px solid var(--border-light); }

.exp-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.22rem;
}

.exp-meta strong {
    font-family: 'Source Serif 4', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.exp-date {
    font-size: 0.82rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.exp-where {
    font-size: 0.87rem;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
}

.exp-list { padding-left: 1.15rem; margin-top: 0.25rem; }
.exp-list li {
    font-size: 0.89rem;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
}

/* =====================================================
   PROJECTS — rectangular list entries
   ===================================================== */
.proj-entry {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border-light);
}
.proj-entry:first-child { border-top: 1px solid var(--border-light); }

.proj-meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.proj-badge {
    display: inline-block;
    font-size: 0.73rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: 2px;
    letter-spacing: 0.02em;
    font-family: 'Inter', sans-serif;
}

.badge-award   { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid var(--gold-dim); }
.badge-research { background: rgba(91,130,200,0.12); color: #6b9fd4; border: 1px solid rgba(91,130,200,0.25); }
.badge-system  { background: rgba(80,170,120,0.10); color: #60b882; border: 1px solid rgba(80,170,120,0.22); }

[data-theme="dark"] .badge-award   { background: rgba(201,168,76,0.12); }
[data-theme="dark"] .badge-research { background: rgba(91,130,200,0.10); }
[data-theme="dark"] .badge-system  { background: rgba(80,170,120,0.08); }

.proj-tech {
    font-size: 0.78rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
}

.proj-date {
    font-size: 0.78rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    margin-left: auto;
}

.proj-title {
    font-family: 'Source Serif 4', serif;
    font-size: 1.03rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.12rem;
}

.proj-sub {
    font-size: 0.86rem;
    color: var(--text-light);
    margin-bottom: 0.45rem;
    font-style: italic;
}

.proj-desc {
    font-size: 0.89rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    line-height: 1.6;
    max-width: 820px;
}

.proj-links { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.proj-link {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--accent);
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}
.proj-link:hover {
    background: var(--gold);
    color: #1a1510;
    border-color: var(--gold);
    text-decoration: none;
}

/* =====================================================
   CERTIFICATES
   ===================================================== */
.cert-featured {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1.8rem;
    align-items: start;
    padding: 1.4rem 1.6rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold-dim);
    border-radius: 3px;
}

.cert-featured-img img {
    width: 100%;
    border-radius: 3px;
    border: 1px solid var(--border);
    display: block;
}

.cert-entry {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 1rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--border-light);
    align-items: start;
}
.cert-entry:first-child { border-top: 1px solid var(--border-light); }

.cert-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-bottom: 0.28rem;
    grid-column: 1 / -1;
}

.cert-title {
    font-family: 'Source Serif 4', serif;
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.12rem;
}

.cert-org { font-size: 0.83rem; color: var(--text-light); }

.cert-date {
    font-size: 0.78rem;
    color: var(--text-light);
    font-family: 'Inter', sans-serif;
    margin-left: auto;
}

.cert-thumb {
    grid-row: 2 / 5;
    grid-column: 2;
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
    background: var(--bg-alt);
}
.cert-thumb iframe {
    display: block;
    width: 100%;
    height: 170px;
    border: none;
}
.cert-thumb img {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: contain;
    background: var(--bg-alt);
}

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    background: var(--header-bg);
    border-top: 1px solid rgba(201,168,76,0.2);
    padding: 1.2rem 2rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.81rem;
    color: rgba(232,223,200,0.45);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-inner a { color: rgba(201,168,76,0.65); }
.footer-inner a:hover { color: var(--gold); text-decoration: underline; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-sidebar-info { border-top: 1px solid var(--border); padding-top: 1.5rem; }
    .cert-featured { grid-template-columns: 1fr; }
    .cert-entry { grid-template-columns: 1fr; }
    .cert-thumb { grid-row: auto; grid-column: auto; }
    .cert-thumb iframe, .cert-thumb img { height: 210px; }
    .cf-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .header-inner { flex-direction: column; gap: 1rem; padding: 1.2rem 1.2rem 0.8rem; }
    .header-controls { position: absolute; top: 1.1rem; right: 1.2rem; }
    .tab-nav { padding: 0 1rem; overflow-x: auto; }
    .tab-btn { font-size: 0.8rem; padding: 0.6rem 0.85rem; white-space: nowrap; }
    .main-content { padding: 0 1.2rem; }
    .highlights-row { grid-template-columns: 1fr; }
    .pub-entry { flex-direction: column; gap: 0.3rem; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .header-identity { flex-direction: column; align-items: flex-start; gap: 0.85rem; }
    .profile-img { width: 90px; height: 90px; }
}
