/* =============================================================
   Franco Carrera - Portfolio
   Dark minimal theme, no frameworks
   ============================================================= */

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

:root {
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #1c2128;
  --border:        #30363d;
  --text-primary:  #e6edf3;
  --text-muted:    #8b949e;
  --accent:        #58a6ff;
  --accent-dim:    #1f6feb;
  --tag-bg:        #21262d;
  --tag-text:      #79c0ff;
  --max-width:     1100px;
  --radius:        8px;
  --glow: 0 0 20px rgba(88, 166, 255, 0.15);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

/* ---- Scroll progress bar ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 200;
  pointer-events: none;
}

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

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 5rem 0;
}

section + section {
  border-top: 1px solid var(--border);
}

/* ---- Section reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

.section-label::before {
  content: "$ ";
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
}

/* ---- Nav ---- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(13, 17, 23, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

.nav-brand {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

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

.nav-links a.active {
  color: var(--accent);
}

/* Hamburger - hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--text-muted);
  border-radius: 2px;
  transition: background-color 0.15s;
}

.nav-toggle:hover span {
  background-color: var(--text-primary);
}

/* ---- Hero ---- */
#hero {
  padding: 7rem 0 5rem;
  border-top: none;
}

.hero-eyebrow {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.hero-name {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

#heroTitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

#heroTitle .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background-color 0.15s;
}

.btn-primary {
  background-color: var(--accent-dim);
  color: #fff;
  border-color: var(--accent-dim);
}

.btn-primary:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover {
  background-color: var(--bg-card);
  border-color: var(--text-muted);
  text-decoration: none;
}

/* ---- About ---- */
#about .about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-stack h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.about-stack h3:first-child {
  margin-top: 0;
}

.stack-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stack-list li {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tag-text);
  background-color: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
}

/* ---- Projects ---- */
#projects .projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-4px);
  box-shadow: var(--glow);
}

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

.project-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #3fb950;
  background-color: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 1.25rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--tag-text);
  background-color: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
}

.project-card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.project-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.project-link-muted {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Certifications ---- */
#certifications .certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.cert-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: transform 0.2s;
}

.cert-card:hover {
  transform: translateY(-2px);
}

.cert-issuer {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.cert-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.cert-status {
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.cert-status.earned {
  color: #3fb950;
}

.cert-status.studying {
  color: #e3b341;
}

/* ---- Contact ---- */
#contact .contact-inner {
  max-width: 520px;
}

#contact p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

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

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Back to top ---- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, background-color 0.15s;
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--bg-secondary);
  color: var(--accent);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  section {
    padding: 3.5rem 0;
  }

  #hero {
    padding: 5rem 0 3.5rem;
  }

  #about .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

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

  #certifications .certs-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile nav */
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    display: block;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  #certifications .certs-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}
