/* ============================================
   Max Greenberg - Personal Site
   Light theme, sidebar navigation
   ============================================ */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-sidebar: #fafafa;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --tag-bg: #f1f5f9;
  --tag-text: #475569;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);

  /* Layout */
  --sidebar-width: 240px;
  --content-max-width: 900px;
  --content-padding: 80px;
}

/* ============ Reset ============ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ============ Sidebar ============ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 40px 24px;
  z-index: 100;
}

.sidebar-header {
  margin-bottom: 48px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--accent);
}

.nav-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: block;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.social-links a:hover {
  color: var(--text-primary);
}

/* ============ Mobile Header ============ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============ Content ============ */
.content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.section {
  display: none;
  padding: var(--content-padding);
  max-width: calc(var(--content-max-width) + var(--content-padding) * 2);
  min-height: 100vh;
}

.section.active {
  display: block;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 40px;
}

/* ============ Home Section ============ */
.section--home {
  display: none;
}

.section--home.active {
  display: flex;
  align-items: center;
}

.home-content {
  display: flex;
  align-items: center;
  gap: 60px;
  width: 100%;
}

.home-text {
  flex: 1;
}

.home-greeting {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.home-name {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.home-tagline {
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 24px;
}

.home-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 520px;
}

.home-cta {
  display: flex;
  gap: 12px;
}

.home-photo {
  flex-shrink: 0;
}

.headshot {
  width: 280px;
  height: 280px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: #333;
  color: var(--bg-primary);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

/* ============ About Section ============ */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  margin-top: 32px;
}

.about-narrative p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

.about-narrative strong {
  color: var(--text-primary);
  font-weight: 600;
}

.about-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.about-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.focus-list li,
.cert-list li {
  padding: 6px 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.focus-list li:last-child,
.cert-list li:last-child {
  border-bottom: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
}

/* ============ Projects Section ============ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.project-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  transition: all 0.2s;
}

.project-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: #d0d5dd;
}

.project-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.project-year {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.project-category {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}

.project-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.project-description {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 16px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.project-tags .tag {
  font-size: 0.78rem;
  padding: 3px 10px;
}

.project-links {
  display: flex;
  gap: 16px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
}

.project-link:hover {
  color: var(--accent-hover);
}

/* ============ Resume Section ============ */
.resume-download {
  margin-bottom: 48px;
}

.resume-timeline {
  position: relative;
  padding-left: 32px;
}

.resume-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
}

.timeline-item:last-child {
  margin-bottom: 48px;
}

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--accent);
}

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

.timeline-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.timeline-date {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-role {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 2px;
}

.timeline-location {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timeline-achievements {
  list-style: disc;
  padding-left: 20px;
}

.timeline-achievements li {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.resume-education {
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.resume-education h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.education-item {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.education-item strong {
  font-weight: 600;
}

.education-item span {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* ============ Contact Section ============ */
.section--contact {
  display: none;
}

.section--contact.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: all 0.2s;
  color: var(--text-primary);
}

.contact-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

.contact-card svg {
  color: var(--accent);
  margin-bottom: 12px;
}

.contact-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.contact-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.contact-location {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  :root {
    --content-padding: 48px;
  }

  .about-layout {
    grid-template-columns: 1fr;
  }

  .about-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
  }

  .about-card {
    margin-bottom: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --content-padding: 24px;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: var(--bg-primary);
    border-right: none;
    padding: 24px;
    z-index: 150;
  }

  .sidebar.open {
    display: flex;
  }

  .mobile-header {
    display: flex;
  }

  .content {
    margin-left: 0;
    padding-top: 60px;
  }

  .home-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 32px;
  }

  .home-name {
    font-size: 2.2rem;
  }

  .home-description {
    max-width: 100%;
  }

  .home-cta {
    justify-content: center;
  }

  .headshot {
    width: 200px;
    height: 200px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .timeline-header {
    flex-direction: column;
    gap: 2px;
  }

  .education-item {
    flex-direction: column;
    gap: 2px;
  }
}

/* ============ Animations ============ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.section.active {
  animation: fadeIn 0.3s ease-out;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
