:root {
  --bg: #0a1220;
  --bg-alt: #0f1830;
  --surface: #131c30;
  --header-bg: rgba(10, 18, 32, 0.85);
  --border: #223350;
  --text: #f2f5fa;
  --text-muted: #a9b4c8;
  --accent: #2f93f0;
  --accent-strong: #0b7de6;
  --on-accent: #08101c;
  --focus: #7ec2fb;
  --thumb-bg: #f4f5f7;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 14px;
  --max-width: 1080px;
}

:root[data-theme="light"] {
  --bg: #e6f0fc;
  --bg-alt: #d5e5f8;
  --surface: #f5f9ff;
  --header-bg: rgba(230, 240, 252, 0.88);
  --border: #b9d0ee;
  --text: #0a1423;
  --text-muted: #3a4d68;
  --accent: #0a63c0;
  --accent-strong: #084e97;
  --on-accent: #ffffff;
  --focus: #0a63c0;
  --thumb-bg: #ffffff;
}

body {
  transition: background-color 0.2s ease, color 0.2s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  z-index: 200;
}

.skip-link:focus {
  left: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Header / Nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  color: var(--text);
}

.logo-mark {
  height: 34px;
  width: auto;
  display: block;
}

.logo-text {
  white-space: nowrap;
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 32px;
  margin: 0;
  padding: 0;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--text);
}

.nav-link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun {
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

/* Hero */

.hero {
  --text: #f2f5fa;
  --text-muted: #c3cde0;
  --accent: #2f93f0;
  --accent-strong: #0b7de6;
  --on-accent: #08101c;
  --focus: #7ec2fb;

  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: calc(100svh - 77px);
  display: flex;
  align-items: flex-end;
  color: var(--text);
  background: #050b16;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(60% 70% at 78% 22%, rgba(47, 147, 240, 0.35), transparent 70%),
    radial-gradient(50% 60% at 15% 90%, rgba(11, 125, 230, 0.22), transparent 70%),
    linear-gradient(160deg, #0a1a33 0%, #050b16 70%);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% center;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(5, 11, 22, 0.95) 0%, rgba(5, 11, 22, 0.35) 45%, rgba(5, 11, 22, 0) 100%),
    linear-gradient(to right, rgba(5, 11, 22, 0.9) 0%, rgba(5, 11, 22, 0.6) 50%, rgba(5, 11, 22, 0.3) 100%);
}

.hero-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 24px 72px;
}

.hero-inner > * {
  max-width: 640px;
}

.hero .btn-secondary {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.4);
}

.hero .btn-secondary:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 767px) {
  .hero-veil {
    background: linear-gradient(to top, rgba(5, 11, 22, 0.95) 0%, rgba(5, 11, 22, 0.78) 55%, rgba(5, 11, 22, 0.45) 100%);
  }

  .hero-inner {
    padding: 96px 20px 56px;
  }
}

.eyebrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
}

.headline {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-text {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

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

.btn-primary:hover {
  background: var(--accent-strong);
}

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

.btn-secondary:hover {
  border-color: var(--accent);
}

/* Sections */

.section {
  padding: 72px 24px;
}

.section-alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.section-lead {
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: 40px;
}

#sobre .section-inner p {
  max-width: 70ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Stack */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stack-group {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stack-group h3 {
  font-size: 1rem;
  margin-bottom: 16px;
}

.stack-group .project-stack {
  margin: 0;
}

/* Projects */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-thumb {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--thumb-bg);
  padding: 20px;
}

.project-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.project-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-body h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.project-body p {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.project-stack {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 20px;
}

.project-stack li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.project-link {
  align-self: flex-start;
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

.project-case {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}

.project-case summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  list-style-position: inside;
}

.project-case summary:hover {
  color: var(--accent-strong);
}

.case-content {
  padding: 4px 0 8px;
}

.case-content h4 {
  margin: 14px 0 6px;
  color: var(--text);
  font-size: 0.92rem;
}

.case-content p {
  margin-bottom: 10px;
}

.case-content ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.case-content li + li {
  margin-top: 4px;
}

.case-content .case-note {
  font-size: 0.85rem;
  margin-top: 16px;
}

/* Contact */

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  font-weight: 600;
  min-height: 44px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.contact-link:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.contact-icon {
  font-size: 1.25rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-logo-wrap {
  display: inline-block;
  background: #f5f7fa;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 20px;
}

.footer-logo {
  height: 64px;
  width: auto;
  display: block;
}

/* Mobile */

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 24px;
    gap: 4px;
    display: none;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-link {
    display: block;
    padding: 12px 0;
    border-bottom: none;
  }

  .nav-link.is-active {
    border-bottom: none;
  }

  .section {
    padding: 56px 20px;
  }
}
