/* ==========================================================================
   Base Variables & Theme Definitions (Tech & Cloud Focus)
   ========================================================================== */

:root {
    --color-bg: #FFFFFF;
    --color-text: #0F172A; 
    --color-accent: #0284C7; 
    --color-accent-hover: #0369A1; 
    --color-bg-contrast: #F1F5F9; 
    
    --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; 
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0F172A; 
        --color-text: #F8FAFC; 
        --color-accent: #38BDF8; 
        --color-accent-hover: #7DD3FC; 
        --color-bg-contrast: #1E293B; 
    }
}

[data-theme="light"] {
    --color-bg: #FFFFFF;
    --color-text: #0F172A; 
    --color-accent: #0284C7; 
    --color-accent-hover: #0369A1; 
    --color-bg-contrast: #F1F5F9;
}

[data-theme="dark"] {
    --color-bg: #0F172A;
    --color-text: #F8FAFC; 
    --color-accent: #38BDF8; 
    --color-accent-hover: #7DD3FC; 
    --color-bg-contrast: #1E293B;
}

/* ==========================================================================
   Global Resets & Typography
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-padding-top: 110px; scroll-behavior: smooth; }

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

h1, h2, h3 {
    font-family: var(--font-heading);
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1.5rem; max-width: 70ch; }

a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s ease;
}

a:hover, a:focus { color: var(--color-accent-hover); }

::selection { background-color: var(--color-accent); color: #FFFFFF; }
::-moz-selection { background-color: var(--color-accent); color: #FFFFFF; }

/* ==========================================================================
   Layout & Structure
   ========================================================================== */
.container { width: 90%; max-width: 1000px; margin: 0 auto; }
.section { padding: 4rem 0; }
.bg-contrast {
    background-color: var(--color-bg-contrast);
    border-radius: 8px; 
    padding: 3rem 2rem;
    margin: 2rem auto;
    width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--color-bg-contrast);
    position: sticky;
    top: 0;
    background-color: var(--color-bg);
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); 
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.branding h1 { margin-bottom: 0.2rem; }
.branding p { margin-bottom: 0; font-size: 1.1rem; color: var(--color-accent); font-weight: 500; }

.primary-navigation ul { list-style: none; display: flex; gap: 1.5rem; }
.primary-navigation a {
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}
.primary-navigation a:hover { border-bottom-color: var(--color-accent); }

/* ==========================================================================
   Buttons & Theme Toggle
   ========================================================================== */
.button {
    display: inline-block;
    background-color: var(--color-accent);
    color: #FFFFFF !important; 
    border: 2px solid var(--color-accent);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px; 
    text-decoration: none;
    transition: all 0.2s ease;
}
.button:hover, .button:focus {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    transform: translateY(-1px); 
}
.button:disabled { opacity: 0.7; cursor: not-allowed; }

.header-actions { display: flex; align-items: center; gap: 1rem; }
.theme-toggle {
    background: transparent;
    border: 1px solid var(--color-bg-contrast);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text);
    transition: background-color 0.2s;
}
.theme-toggle:hover { background-color: var(--color-bg-contrast); }
.theme-toggle svg { width: 20px; height: 20px; }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .icon-sun { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-moon { display: none; } }

/* ==========================================================================
   Typography Classes & Lists
   ========================================================================== */
.keyword-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.keyword-list li {
    background-color: var(--color-bg-contrast);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font-mono); 
    border: 1px solid rgba(0,0,0,0.05);
}

.bibliography-list { list-style: none; padding-left: 0; margin-top: 1.5rem; }
.bibliography-list li {
    margin-bottom: 1.5rem;
    padding-left: 2.5rem; 
    text-indent: -2.5rem; 
    line-height: 1.6;
}
.bibliography-list a { word-break: break-all; font-weight: normal; }

/* Privacy Utility Classes */
.privacy-list-item { margin-bottom: 0.5rem; }
.optional-label { opacity: 0.7; font-weight: normal; font-size: 0.9em; }
.required-asterisk { color: var(--color-accent); }

/* ==========================================================================
   Modals & Forms
   ========================================================================== */
.modal {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background-color: var(--color-bg);
    color: var(--color-text);
    max-width: 600px;
    width: 90%;
    margin: auto;
    padding: 0;
}
.modal::backdrop { background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px); }
.modal-content { display: flex; flex-direction: column; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-bg-contrast);
}
.modal-header h2 { margin: 0; }
.close-button {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text);
    line-height: 1;
}
.modal-body { padding: 1.5rem; }

.form-group { margin-bottom: 1.25rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.title-group { flex: 1 1 140px; max-width: 160px; }
.name-group { flex: 2 1 180px; }

label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
input[type="text"], input[type="email"], textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
.honeypot-field { display: none !important; }

.form-status-container { margin-bottom: 1rem; }
.status-success { color: #10B981; font-weight: 600; }
.status-error { color: #EF4444; font-weight: 600; }

/* ==========================================================================
   404 Page Specific Styles
   ========================================================================== */
.error-branding { text-decoration: none; color: inherit; display: block; }
.error-branding-title { font-family: var(--font-heading); font-size: 2.5rem; font-weight: bold; line-height: 1.2; text-wrap: balance; }
.error-main { text-align: center; min-height: 50vh; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.error-code { font-size: 5rem; color: var(--color-accent); margin-bottom: 0; }
.error-text { max-width: 500px; margin: 1rem auto 2.5rem; }

/* ==========================================================================
   Component Layouts (About, Footer)
   ========================================================================== */
.skip-link {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--color-accent);
    color: white;
    padding: 8px 16px;
    z-index: 1000;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    transition: transform 0.3s ease;
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

/* About Section Profile Layout */
.about-top {
    display: flex;
    flex-direction: column-reverse; 
    gap: 3rem;
    align-items: center;
}

@media (min-width: 768px) {
    .about-top {
        flex-direction: row; 
        align-items: flex-start; 
        justify-content: space-between;
    }
    .about-content { flex: 1; padding-right: 2rem; }
    .about-image { flex-shrink: 0; margin: 0; }
}

.pronouns { font-size: 1.2rem; font-weight: normal; color: var(--color-text); opacity: 0.85; }
.profile-photo {
    border-radius: 50%;
    object-fit: cover;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.about-extras {
    display: grid;
    grid-template-columns: 1fr; /* Defaults to 1 stacked column for mobile */
    gap: 3rem; 
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--color-bg-contrast);
    width: 100%;
}

/* Forces an asymmetrical split on desktop: Education gets more room */
@media (min-width: 768px) {
    .about-extras {
        grid-template-columns: 1fr 1fr;
        gap: 4rem; 
    }
}
.extra-block h3 { font-size: 1.1rem; color: var(--color-accent); margin-bottom: 1rem; }
.minimal-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.minimal-list li { display: flex; flex-direction: column; font-size: 0.95rem; }
.minimal-list li span { font-size: 0.85rem; opacity: 0.8; }

.site-footer { border-top: 1px solid var(--color-bg-contrast); padding: 2rem 0; margin-top: 4rem; }
.footer-container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-size: 0.9rem; }
.profile-links { list-style: none; display: flex; gap: 1rem; flex-wrap: wrap;}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */
.mobile-menu-toggle { display: none; }
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        background: transparent;
        border: 1px solid var(--color-text);
        color: var(--color-text);
        padding: 0.5rem 1rem;
        border-radius: 4px;
        cursor: pointer;
    }
    .primary-navigation { display: none; width: 100%; }
    .primary-navigation[aria-expanded="true"] { display: block; padding-top: 1rem; }
    .primary-navigation ul { flex-direction: column; gap: 0; }
    .primary-navigation a {
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid var(--color-bg-contrast);
    }
}

/* ==========================================================================
   1-Page Academic Resume Layout (Print)
   ========================================================================== */
@media print {
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    font-size: 10pt; 
    line-height: 1.3; 
  }

  * {
    background-color: transparent !important; 
    color: #000000 !important; 
    border-color: #000000 !important; 
    -webkit-print-color-adjust: exact !important; 
    print-color-adjust: exact !important;
  }

  .mobile-menu-toggle, .theme-toggle, .primary-navigation, .skip-link,
  #contact, .button, dialog, .footer-legal nav, .form-status-container,
  .about-image, .profile-photo { display: none !important; }

  .container { width: 100%; max-width: none; margin: 0; }
  .section { padding: 0.5rem 0 1rem 0 !important; margin: 0 !important; }
  
  .about-top { display: block; }
  .about-content { padding-right: 0; }

  h1 { font-size: 18pt; margin-bottom: 0.2rem; }
  h2 { 
    font-size: 13pt; padding-bottom: 0.1rem; margin-bottom: 0.4rem; 
    border-bottom: 1px solid #000000; display: block; width: 100%;
  }
  h3 { font-size: 11pt; margin-bottom: 0.2rem; margin-top: 0.4rem; }
  p { margin-bottom: 0.5rem; max-width: none; }

  .site-header { position: static; box-shadow: none; border-bottom: none; padding: 0 0 0.5rem 0; margin-bottom: 0.5rem; }

  .keyword-list { display: flex; flex-wrap: wrap; gap: 0 0.4rem; margin-top: 0.2rem; }
  .keyword-list li { padding: 0; border: none !important; font-size: 10pt; font-family: var(--font-ui); font-weight: normal; }
  .keyword-list li:not(:last-child)::after { content: ","; }

  .bibliography-list { margin-top: 0.5rem; }
  .bibliography-list li { margin-bottom: 0.5rem; }

  a { text-decoration: none; font-weight: normal; font-style: normal; }
  a[href^="http"]:not(.bibliography-list a)::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }

  .section, .bibliography-list li, .extra-block {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}