/**
 * Alexander Ocsa - System Software Engineer
 * Aesthetic: Digital Editorial / Neo-Brutalist
 * Typography: Syne (Headings) + DM Sans (Body)
 * Theme: High Contrast, Bold, Atmospheric
 */

:root {
  /* Typography */
  --font-heading: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Dark Theme (Default) - Deep Void */
  --bg-primary: #050505;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --text-primary: #EAEAEA;
  --text-secondary: #A0A0A0;
  --accent-primary: #5D3FD3;
  /* Electric Indigo */
  --accent-secondary: #9D8CFF;
  --accent-tertiary: #FFFFFF;
  --border-color: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(20, 20, 20, 0.6);
  --card-border: rgba(255, 255, 255, 0.08);
  --gradient-overlay: radial-gradient(circle at 50% 0%, rgba(93, 63, 211, 0.15), transparent 70%);

  /* Spacing & Layout */
  --container-width: 1100px;
  --header-height: 80px;
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 24px;

  /* Animation */
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --transition-fast: 0.2s var(--ease-out-expo);
  --transition-medium: 0.6s var(--ease-out-expo);
  --transition-slow: 1.2s var(--ease-out-expo);
}

/* Light Theme - Warm Editorial */
body.light-mode {
  --bg-primary: #F5F2EB;
  /* Warm Cream */
  --bg-secondary: #EBE7DE;
  --bg-tertiary: #E0DCD3;
  --text-primary: #1C1C1E;
  /* Deep Charcoal */
  --text-secondary: #59595E;
  --accent-primary: #FF4D00;
  /* Vibrant Orange */
  --accent-secondary: #FF8534;
  --accent-tertiary: #1C1C1E;
  --border-color: rgba(28, 28, 30, 0.1);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(28, 28, 30, 0.06);
  --gradient-overlay: radial-gradient(circle at 50% 0%, rgba(255, 77, 0, 0.08), transparent 60%);
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.5s ease;
  overflow-x: hidden;
}

/* Atmospheric Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-overlay);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}

/* Grain Texture */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(3.5rem, 8vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

/* Layout */
main {
  position: relative;
  z-index: 2;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 3rem 0;
  opacity: 0;
  /* For scroll reveal */
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

section.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(5, 5, 5, 0.7);
  /* Dark mode default */
  border-bottom: 1px solid var(--border-color);
  transition: border-color 0.5s ease;
}

body.light-mode header {
  background: rgba(245, 242, 235, 0.8);
  /* Light mode default */
}

.header-container {
  max-width: var(--container-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  /* Right align nav */
}

nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

nav a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out-expo);
}

nav a:hover {
  color: var(--text-primary);
}

nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Theme Toggle */
#themeToggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: 1rem;
}

#themeToggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: rotate(15deg);
}

/* Hero Section */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-height);
  text-align: center;
}

.hero-content {
  max-width: 900px;
}

.hero-title {
  line-height: 0.9;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeUp 1s var(--ease-out-expo) forwards;
  opacity: 0;
  transform: translateY(20px);
}

.hero-subtitle {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--accent-primary);
  margin-bottom: 2rem;
  display: block;
  animation: fadeUp 1s var(--ease-out-expo) 0.2s forwards;
  opacity: 0;
  transform: translateY(20px);
}

.hero-description {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto 3rem;
  animation: fadeUp 1s var(--ease-out-expo) 0.4s forwards;
  opacity: 0;
  transform: translateY(20px);
}

.hero-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  animation: fadeUp 1s var(--ease-out-expo) 0.6s forwards;
  opacity: 0;
  transform: translateY(20px);
}

.hero-link {
  padding: 1rem 2rem;
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-family: var(--font-heading);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.hero-link:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  /* Always white text on hover for contrast */
  transform: translateY(-2px);
}

/* About Section */
.about-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.about-list li {
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast);
}

.about-list li:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.about-list strong {
  color: var(--accent-primary);
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

/* Timeline (Work & Education) */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  border-left: 1px solid var(--border-color);
  padding-left: 2rem;
  margin-left: 1rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.35rem;
  /* Adjust based on padding/border width */
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  transition: background 0.3s ease;
}

.timeline-item:hover::before {
  background: var(--accent-primary);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-company h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.company-location {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.timeline-date {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.timeline-role {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.timeline-details {
  padding-left: 1rem;
  list-style-type: disc;
}

.timeline-details li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Skills */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-badge {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.skill-badge:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--transition-medium);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-primary);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.project-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.project-period {
  font-size: 0.8rem;
  font-family: var(--font-heading);
  color: var(--text-secondary);
}

.project-description {
  flex-grow: 1;
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
}

/* Contact */
.contact-content-center {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.icon-dock {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-radius: 50px;
  display: inline-flex;
  border: 1px solid var(--border-color);
}

.dock-icon {
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  padding: 0.5rem;
  border-radius: 50%;
}

.dock-icon:hover {
  color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.1);
}

.dock-separator {
  width: 1px;
  background: var(--border-color);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

/* Mobile Menu */
#mobileMenuToggle {
  display: none;
  /* Hidden by default on desktop */
}

#mobileMenu {
  display: none !important;
}

@media (max-width: 768px) {
  #desktopNav {
    display: none;
  }

  #mobileMenuToggle {
    display: block;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
  }

  .header-container {
    justify-content: space-between;
  }

  #mobileMenu {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);
    z-index: 200;
    padding: 2rem;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out-expo);
    display: flex !important;
    flex-direction: column;
  }

  #mobileMenu.open {
    transform: translateX(0);
  }

  .mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
  }

  .mobile-menu nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .mobile-menu nav a {
    font-size: 2rem;
    font-weight: 700;
  }

  .mobile-menu-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
  }

  #themeToggleMobile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: none;
    border: 1px solid var(--border-color);
    padding: 1rem;
    width: 100%;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-heading);
    cursor: pointer;
  }
}

/* Keyframes */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Back to Top */
#toTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  /* JS toggles this */
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 90;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

#toTop:hover {
  transform: translateY(-4px);
}