/* ============ Design Tokens ============ */
:root {
  --bg: #09101a;
  --surface: rgba(255,255,255,.04);
  --surface-2: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.08);
  --fg: #e8eefc;
  --muted: #8b9dc3;
  --primary: #2563eb;
  --primary-fg: #fff;
  --accent: #38bdf8;
  --whatsapp: var(--accent);
  --gradient-brand: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  --radius: 16px;
  --radius-lg: 24px;
  --wrap: 1152px;
  --font-display: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* ============ Reset ============ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: var(--font-display); line-height: 1.15; }
a { color: inherit; text-decoration: none; }
ul,ol { list-style: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ============ Utilities ============ */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media(min-width:640px){ .wrap { padding: 0 24px; } }

.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0; }
.skip { position:absolute;left:-9999px; }
.skip:focus { left:12px;top:12px;background:var(--primary);padding:8px 14px;border-radius:8px;z-index:99;color:#fff; }

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.surface-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ============ Header ============ */
.site-header {
  position: fixed; inset-inline: 0; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(9,16,26,.80);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.header-inner {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center; gap: 12px;
  padding-block: 12px;
}
.brand { min-width: 0; }
.brand-name {
  display: block; font-family: var(--font-display);
  font-size: 1rem; font-weight: 800; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-name .dot { color: var(--primary); }
@media(min-width:640px){ .brand-name { font-size: 1.125rem; } }
.brand-sub {
  display: block; font-size: .6875rem;
  text-transform: uppercase; letter-spacing: .18em; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
@media(min-width:640px){ .header-actions { gap: 16px; } }
.nav-desktop { display: none; align-items: center; gap: 24px; }
.nav-desktop a { font-size: .875rem; font-weight: 500; color: var(--fg); transition: color .15s; }
.nav-desktop a:hover { color: var(--primary); }
@media(min-width:768px){ .nav-desktop { display: flex; } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; font-weight: 500;
  height: 32px; border-radius: 6px; padding: 0 12px; font-size: .75rem;
  border: 1px solid rgba(59,130,246,.5);
  background: transparent; color: var(--fg);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--primary); color: var(--primary-fg); }
.icon-btn-wa { border-color: rgba(56,189,248,.5); color: var(--whatsapp); }
.icon-btn-wa:hover { background: var(--whatsapp); color: var(--bg); }
.icon-btn .label { display: none; }
@media(min-width:640px){ .icon-btn .label { display: inline; } }

.nav-toggle {
  display: inline-flex; flex-direction: column; gap: 5px; justify-content: center;
  width: 40px; height: 40px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--fg); border-radius: 2px; }
@media(min-width:768px){ .nav-toggle { display: none; } }

.nav-mobile { display: grid; gap: 4px; padding: 10px 16px 18px; border-top: 1px solid var(--border); }
.nav-mobile[hidden] { display: none; }
.nav-mobile a { padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .9rem; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: rgba(59,130,246,.9); }
.btn-primary.glow {
  box-shadow:
    0 0 20px -4px rgba(59,130,246,.55),
    0 0 40px -8px rgba(59,130,246,.3);
}
.btn-outline { border-color: rgba(59,130,246,.5); background: transparent; color: var(--fg); }
.btn-outline:hover { background: var(--primary); color: var(--primary-fg); }

.btn-expand {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 20px; border-radius: 999px; border: none;
  background: var(--surface-2); color: var(--fg);
  font-size: .875rem; font-weight: 500;
  transition: background .15s;
  margin-top: 16px; align-self: flex-start;
}
.btn-expand:hover { background: rgba(255,255,255,.05); }
.btn-expand .icon { transition: transform .2s; }
.btn-expand[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; padding: 112px 16px 64px; }
@media(min-width:640px){ .hero { padding: 144px 24px 96px; } }

.hero-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.hero-orb-1 { width: 288px; height: 288px; left: -96px; top: -96px; background: rgba(59,130,246,.25); filter: blur(110px); }
.hero-orb-2 { width: 256px; height: 256px; right: -80px; top: 160px; background: rgba(52,211,153,.20); filter: blur(110px); }

.hero-content { max-width: 56rem; margin: 0 auto; text-align: center; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 999px;
  background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3);
  font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; color: var(--primary);
}
@media(min-width:640px){ .badge { font-size: .75rem; } }
.badge .icon { width: 14px; height: 14px; }

.hero h1 {
  margin-top: 24px;
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
}
.hero h1 span {
  background: var(--gradient-brand);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hero .lead {
  margin: 20px auto 0; max-width: 42rem;
  font-size: 1rem; color: var(--muted);
}
@media(min-width:640px){ .hero .lead { font-size: 1.125rem; } }

.hero-actions {
  display: flex; flex-direction: column;
  align-items: stretch; justify-content: center;
  gap: 12px; margin-top: 32px;
}
@media(min-width:640px){ .hero-actions { flex-direction: row; align-items: center; } }

.stats {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 12px; max-width: 56rem; margin: 56px auto 0;
}
@media(min-width:640px){ .stats { gap: 16px; } }
@media(min-width:1024px){ .stats { grid-template-columns: repeat(4,1fr); } }

.stat { border-radius: var(--radius); padding: 20px 16px; text-align: center; }
@media(min-width:640px){ .stat { padding: 20px; } }
.stat-value { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; }
@media(min-width:640px){ .stat-value { font-size: 1.5rem; } }
.stat-label { margin-top: 4px; font-size: .75rem; line-height: 1.4; color: var(--muted); }
@media(min-width:640px){ .stat-label { font-size: .875rem; } }

/* ============ Sections ============ */
.section { padding: 64px 16px; }
@media(min-width:640px){ .section { padding: 96px 24px; } }
.section-border {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.015);
}
.section-inner { max-width: var(--wrap); margin: 0 auto; }

.section-header { max-width: 42rem; margin: 0 auto; text-align: center; }
.eyebrow {
  font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .2em; color: var(--accent);
}
.section-title {
  margin-top: 12px; font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 800;
}
.section-sub { margin-top: 12px; font-size: .875rem; color: var(--muted); }
@media(min-width:640px){ .section-sub { font-size: 1rem; } }

.grid { display: grid; gap: 16px; }
@media(min-width:640px){ .grid-2 { grid-template-columns: repeat(2,1fr); } }
@media(min-width:768px){ .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media(min-width:1024px){ .grid-3 { grid-template-columns: repeat(3,1fr); } }
@media(min-width:960px){ .grid-4 { grid-template-columns: repeat(4,1fr); } }
@media(min-width:640px){ .grid-4 { grid-template-columns: repeat(2,1fr); } }

/* ============ Journey ============ */
.journey-list { margin-top: 48px; }
@media(max-width: 640px) {
  .journey-list {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-inline: -16px;
    padding-inline: 16px;
  }
  .journey-list::-webkit-scrollbar {
    display: none;
  }
  .journey-list li {
    flex: 0 0 85%;
    scroll-snap-align: center;
  }
}

.journey-list li { border-radius: var(--radius); padding: 24px; position: relative; }
.step-num {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}
.journey-list h3 { margin-top: 4px; font-size: 1.125rem; font-weight: 700; }
.journey-list p { margin-top: 8px; font-size: .875rem; line-height: 1.7; color: var(--muted); }

/* ============ Skills ============ */
.skill { display: flex; flex-direction: column; border-radius: var(--radius); padding: 20px; }
@media(min-width:640px){ .skill { padding: 24px; } }
.skill-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; }
.skill-head h3 {
  font-size: 1.125rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.skill-level { font-family: var(--font-display); font-size: .875rem; font-weight: 700; color: var(--primary); flex-shrink: 0; }

.bar { height: 6px; width: 100%; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.bar-fill {
  height: 100%; border-radius: 999px;
  background: var(--primary); background-image: var(--gradient-brand);
  transition: width .7s;
}
.bar-group { margin-top: 12px; }

.skill-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  font-size: .6875rem; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--muted);
}

.subskills { margin-top: 20px; display: grid; gap: 12px; }
.sub-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; font-size: .75rem; margin-bottom: 6px;
}
.sub-row span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--fg);
}
.sub-row em { font-style: normal; color: var(--muted); flex-shrink: 0; }

.skill-desc {
  overflow: hidden; font-size: .875rem; line-height: 1.7; color: var(--muted);
  max-height: 0; opacity: 0;
  transition: max-height .3s ease, opacity .3s ease, margin .3s ease;
  margin-top: 0;
}
.skill-desc.open { max-height: 200px; opacity: 1; margin-top: 12px; }

/* ============ Carousel / Projects ============ */
.carousel-section {
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.015);
}
.carousel-region { margin-top: 48px; position: relative; }
.carousel-viewport { overflow: hidden; touch-action: pan-y; }
.carousel-track {
  display: flex; margin-left: -12px;
  transition: transform .35s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.carousel-track:active {
  cursor: grabbing;
}
@media(min-width:640px){ .carousel-track { margin-left: -16px; } }

.slide { min-width: 0; flex: 0 0 86%; padding-left: 12px; }
@media(min-width:640px){ .slide { flex-basis: 50%; padding-left: 16px; } }
@media(min-width:1024px){ .slide { flex-basis: 33.333%; } }

.project {
  display: flex; flex-direction: column; height: 100%;
  border-radius: var(--radius); padding: 20px;
}
@media(min-width:640px){ .project { padding: 24px; } }

.chapter {
  font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em; color: var(--accent);
}
.project h3 { margin-top: 12px; font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; }
@media(min-width:640px){ .project h3 { font-size: 1.25rem; } }
.project-resumo { margin-top: 12px; flex: 1; font-size: .875rem; line-height: 1.7; color: var(--muted); }
.project-tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.stack-label {
  font-size: .6875rem; font-weight: 500; padding: 2px 10px;
  border-radius: 999px; background: rgba(59,130,246,.15); color: var(--primary);
}
.project-metrics { margin-top: 20px; display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.project-metric {
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.18);
  padding: 10px 12px;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.project-metric:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(37, 99, 235, 0.12);
}
.project-metric p {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.project-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  width: 100%;
  align-items: center;
}
.project-actions .btn-expand,
.project-actions .project-fallback {
  margin-top: 0 !important;
}
.btn-github-case {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.btn-github-case:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}
.project-fallback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
}

.carousel-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }
.carousel-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(59,130,246,.4);
  background: var(--surface-2); color: var(--fg);
  transition: background .15s, color .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.carousel-btn:hover { background: var(--primary); color: var(--primary-fg); }
.carousel-btn .icon { width: 16px; height: 16px; }

/* ============ Contact ============ */
.contact-card {
  max-width: 56rem; margin: 0 auto;
  border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center;
}
@media(min-width:640px){ .contact-card { padding: 48px; } }
.contact-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 800;
}
.contact-card .lead { margin: 16px auto 0; max-width: 36rem; font-size: .875rem; color: var(--muted); }
@media(min-width:640px){ .contact-card .lead { font-size: 1rem; } }
.contact-card .hero-actions { margin-top: 32px; }

/* ============ Footer ============ */
.site-footer { border-top: 1px solid var(--border); padding: 32px 16px; text-align: center; }
@media(min-width:640px){ .site-footer { padding: 32px 24px; } }
.site-footer p { font-size: .875rem; color: var(--muted); }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
@media(min-width:720px){ .modal { align-items: center; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,7,15,.75); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; width: min(680px, 100%); max-height: 88vh; overflow-y: auto;
  background: #0f1a2e; border: 1px solid var(--border);
  border-radius: 22px 22px 0 0; padding: 26px 22px 32px;
}
@media(min-width:720px){ .modal-card { border-radius: 22px; padding: 30px; } }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--fg); font-size: 1.4rem;
  display: grid; place-items: center;
}
.modal-card h3 { font-size: 1.3rem; }
.modal-card h4 {
  margin-top: 22px; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .14em; color: var(--accent);
}
.modal-card > p { color: var(--muted); font-size: .93rem; margin-top: 8px; }
.bullets { padding-left: 20px; list-style: disc; display: grid; gap: 8px; }
.bullets li { color: var(--muted); font-size: .93rem; }
.modal-metrics { display: grid; gap: 12px; margin-top: 12px; }
@media(min-width:560px){ .modal-metrics { grid-template-columns: repeat(2,1fr); } }
.modal-metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px;
}
.modal-metric strong { display: block; font-family: var(--font-display); color: #fff; }
.modal-metric span { font-size: .82rem; color: var(--muted); }
body.modal-open { overflow: hidden; }

/* ============ Floating Contacts ============ */
.floating {
  position: fixed; bottom: 16px; right: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 12px;
}
@media(min-width:640px){ .floating { bottom: 24px; right: 24px; } }
.fab {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  transition: transform .15s; border: none;
}
.fab:hover { transform: translateY(-2px); }
.fab .icon { width: 20px; height: 20px; }
.fab-email {
  background: var(--primary); color: var(--primary-fg);
  box-shadow: 0 0 20px -4px rgba(59,130,246,.55), 0 0 40px -8px rgba(59,130,246,.3);
}
.fab-wa {
  background: var(--whatsapp);
  color: var(--primary-fg);
  box-shadow: 0 0 20px -4px rgba(56,189,248,.55), 0 0 40px -8px rgba(56,189,248,.3);
}

/* ============ Reduced Motion ============ */
@media(prefers-reduced-motion: reduce){
  html { scroll-behavior: auto; }
  .carousel-track { transition: none; }
  .btn:hover, .fab:hover { transform: none; }
  .skill-desc { transition: none; }
  .bar-fill { transition: none; }
}
