/* =============================================
   Nicolas Iannone — CV / Personal Site
   Clean, Apple-inspired — Light & Dark Mode
   ============================================= */

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

:root {
  /* Light mode (default) */
  --bg: #ffffff;
  --bg-secondary: #f5f5f7;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --border: #d2d2d7;
  --accent: #1d1d1f;
  --card-bg: #ffffff;
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --divider: #e5e5e7;
  --hover-bg: #f5f5f7;
  --toggle-bg: #e5e5e7;
  --toggle-dot: #1d1d1f;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-secondary: #111111;
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --border: #333336;
  --accent: #f5f5f7;
  --card-bg: #1c1c1e;
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --divider: #2c2c2e;
  --hover-bg: #1c1c1e;
  --toggle-bg: #333336;
  --toggle-dot: #f5f5f7;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

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

a:hover {
  opacity: 0.7;
}

/* --- Layout --- */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 80px 0;
}

@media (max-width: 768px) {
  section {
    padding: 56px 0;
  }
}

/* --- Header / Nav --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  transition: background-color 0.3s ease;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

[data-theme="dark"] header {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] header,
:root:not([data-theme="dark"]) header {
  background: rgba(255, 255, 255, 0.8);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-primary);
  opacity: 1;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 28px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--text-primary);
  position: absolute;
  left: 0;
  transition: all 0.3s ease;
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 9px; }
.nav-toggle span:nth-child(3) { top: 18px; }

.nav-toggle.active span:nth-child(1) {
  top: 9px;
  transform: rotate(45deg);
}

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

.nav-toggle.active span:nth-child(3) {
  top: 9px;
  transform: rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    border-bottom: 1px solid var(--divider);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 99;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .nav-links a {
    font-size: 16px;
  }
}

/* --- Theme Toggle --- */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--toggle-bg);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--toggle-dot);
  border-radius: 50%;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

[data-theme="dark"] .theme-toggle::after {
  transform: translateX(20px);
}

.theme-toggle-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
}

.theme-toggle .sun {
  left: 6px;
}

.theme-toggle .moon {
  right: 6px;
}

/* --- Hero --- */
.hero {
  padding-top: 140px;
  padding-bottom: 80px;
}

.hero-centered {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 24px;
  max-width: 800px;
}

.hero p {
  font-size: clamp(18px, 2.5vw, 24px);
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 700px;
  font-weight: 400;
}

/* --- Download Button --- */
.download-btn {
  display: inline-block;
  margin-top: 28px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--bg);
  background: var(--text-primary);
  border-radius: 8px;
  transition: opacity 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.download-btn:hover {
  opacity: 0.85;
}

/* --- Section Headers --- */
.section-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 700;
  margin-bottom: 16px;
}

.section-intro {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 680px;
  margin-bottom: 48px;
}

.section-divider {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin-bottom: 48px;
}

/* --- Experience & Education Grid --- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 160px 160px 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--divider);
  align-items: start;
}

.timeline-entry:last-child {
  border-bottom: 1px solid var(--divider);
}

.timeline-date {
  font-size: 14px;
  color: var(--text-tertiary);
  padding-top: 2px;
}

.timeline-org {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 1px;
}

.timeline-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.timeline-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.timeline-content .detail {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--text-primary);
  color: var(--bg);
  vertical-align: middle;
  margin-left: 8px;
  position: relative;
  top: -1px;
}

@media (max-width: 768px) {
  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 24px 0;
  }

  .timeline-date {
    font-size: 13px;
  }

  .timeline-org {
    font-size: 14px;
  }

  .timeline-content {
    margin-top: 8px;
  }
}

/* --- About --- */
.about-content {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 680px;
}

.about-content p + p {
  margin-top: 16px;
}

/* --- Contact / CTA --- */
.contact {
  background: var(--bg-secondary);
  transition: background-color 0.3s ease;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 60px;
  align-items: center;
}

.contact h2 {
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.03em;
}

.contact-text {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 480px;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-links a {
  font-size: 15px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.contact-links a:hover {
  color: var(--text-primary);
  opacity: 1;
}

.contact-links .link-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  min-width: 50px;
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
}

.profile-photo:hover {
  filter: grayscale(0%);
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .profile-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    order: -1;
  }

  .contact-links {
    align-items: center;
  }
}

/* --- Footer --- */
footer {
  padding: 24px 0;
  border-top: 1px solid var(--divider);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-links a:hover {
  color: var(--text-primary);
  opacity: 1;
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* --- Transitions --- */
section, .timeline-entry, .contact, footer {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
