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

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-alt: #f4f3ef;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b68;
  --text-tertiary: #9a9a96;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --accent: #1a1a1a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --max-width: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0e;
    --surface: #1a1a18;
    --surface-alt: #1f1f1d;
    --text-primary: #f5f5f3;
    --text-secondary: #a8a8a4;
    --text-tertiary: #6b6b68;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #f5f5f3;
  }
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 1rem;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 2rem;
  transition: all 0.3s ease;
  background: transparent;
}

.navbar-scrolled {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-hidden {
  transform: translateY(-100%);
}

.navbar-brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.navbar-links {
  display: flex;
  gap: 24px;
}

.navbar-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

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

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

.section { margin-bottom: 4rem; }

.section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1.5rem;
}

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

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

/* ===== Hero ===== */
.hero {
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4rem;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 1.25rem;
}

.lead {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

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

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

/* ===== Sobre ===== */
.about-text {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 640px;
}

/* ===== Projetos ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1000px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .projects-grid { grid-template-columns: 1fr; }
}

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

.project:hover {
  border-color: var(--border-strong);
}

.project-info {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.project-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.project-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}

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

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

.project-desc {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-width: 640px;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 12px;
  padding: 5px 11px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ===== Galeria ===== */
.project-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.project-gallery img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
  transition: transform 0.2s ease;
  cursor: zoom-in;
}

.project-gallery img:first-child {
  grid-column: 1 / -1;
  height: 180px;
}

.project-gallery img:hover {
  transform: scale(1.02);
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lightbox-close:hover {
  opacity: 1;
}

/* ===== Stack ===== */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.stack-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.stack-list {
  list-style: none;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-secondary);
}

/* ===== Contato ===== */
.contact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem;
}

.contact h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.contact p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  max-width: 480px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== Responsivo ===== */
@media (max-width: 600px) {
  .container { padding: 4.5rem 1.25rem 2rem; }
  .section { margin-bottom: 3rem; }
  .hero { padding-bottom: 2rem; margin-bottom: 3rem; }
  .project { padding: 1.25rem; }
  .contact { padding: 1.5rem; }
  .navbar { padding: 12px 1.25rem; }
  .navbar-links { gap: 16px; }
  .navbar-links a { font-size: 12px; }
  .project-gallery { grid-template-columns: 1fr; }
  .project-gallery img:first-child { height: 160px; }
}
