/* ==========================================================================
   Gustavo Melo — portfolio
   Design tokens shared with the résumé / cover letters (Inter, navy accent),
   extended with JetBrains Mono for eyebrows and tags.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-raised: #f7f7f9;
  --text: #1c1d21;
  --text-secondary: #5b5e68;
  --text-tertiary: #8a8d97;
  --rule: #d8d9de;
  --rule-strong: #1c1d21;
  --accent: #2c3e63;
  --accent-soft: #eef1f7;
  --accent-contrast: #ffffff;
  --link: #2c3e63;
  --shadow: 0 1px 2px rgba(28, 29, 33, 0.04), 0 8px 24px rgba(28, 29, 33, 0.06);

  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --content-width: 920px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b;
    --bg-raised: #1b1e25;
    --text: #edeef1;
    --text-secondary: #a7abb6;
    --text-tertiary: #7d8190;
    --rule: #2d3038;
    --rule-strong: #edeef1;
    --accent: #8ea3d6;
    --accent-soft: #1e2636;
    --accent-contrast: #10131a;
    --link: #9db3e8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #14161b;
  --bg-raised: #1b1e25;
  --text: #edeef1;
  --text-secondary: #a7abb6;
  --text-tertiary: #7d8190;
  --rule: #2d3038;
  --rule-strong: #edeef1;
  --accent: #8ea3d6;
  --accent-soft: #1e2636;
  --accent-contrast: #10131a;
  --link: #9db3e8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { 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; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

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

a { color: var(--link); }

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 28px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.nav__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.nav__mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav__mark span { color: var(--accent); }

.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav__links a:hover,
.nav__links a.is-active { color: var(--text); }

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.icon-btn:hover { color: var(--text); border-color: var(--text-tertiary); background: var(--bg-raised); }

.icon-btn svg { width: 16px; height: 16px; }

.lang-toggle {
  width: auto;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.theme-toggle .sun { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
}

:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }

.nav__burger {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

/* ---------- hero ---------- */

.hero {
  padding: 96px 0 72px;
  position: relative;
}

.hero__avatar {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin-bottom: 28px;
  background: var(--accent-soft);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.hero__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.hero__avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--accent);
}

.hero__eyebrow { margin-bottom: 18px; }

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(36px, 5.2vw, 56px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero__lede {
  max-width: 62ch;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 34px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 64px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

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

.btn--primary:hover { opacity: 0.9; }

.btn--ghost {
  background: transparent;
  border-color: var(--rule);
  color: var(--text);
}

.btn--ghost:hover { border-color: var(--text-tertiary); background: var(--bg-raised); }

/* ---------- sections ---------- */

section { padding: 72px 0; border-top: 1px solid var(--rule); }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.section__title {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ---------- about ---------- */

.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

.about p {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 16px;
}

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

.facts {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg-raised);
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.facts dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- experience timeline ---------- */

.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--rule);
}

.timeline__item {
  position: relative;
  padding-bottom: 48px;
}

.timeline__item:last-child { padding-bottom: 0; }

.timeline__item::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 4px;
}

.timeline__role {
  font-size: 16px;
  font-weight: 700;
}

.timeline__org { color: var(--accent); font-weight: 700; }

.timeline__meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.timeline__desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 6px 0 12px;
  max-width: 68ch;
}

.timeline__bullets {
  margin: 0;
  padding-left: 18px;
}

.timeline__bullets li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 6px;
}

.timeline__bullets li:last-child { margin-bottom: 0; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- projects ---------- */

.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--text-tertiary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card__kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.card__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px;
}

.card__desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0 0 16px;
  flex: 1;
}

.card__links {
  display: flex;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.card__links a { text-decoration: none; }
.card__links a:hover { text-decoration: underline; }

/* ---------- skills ---------- */

.skills__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 40px;
}

.skill-group__title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 12px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 14px;
}

.tool-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 8px 14px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-tile:hover {
  border-color: var(--text-tertiary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.tool-tile__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.tool-tile__badge--concept {
  background: var(--accent-soft);
  border-color: var(--rule);
}

.tool-tile__icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.tool-tile__icon--concept {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.tool-tile__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ---------- education ---------- */

.edu__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.edu__card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: 12px;
}

.edu__logo {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 6px;
}

.edu__title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.edu__sub { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* ---------- contact / footer ---------- */

.contact {
  text-align: center;
}

.contact__title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin: 6px 0 16px;
  letter-spacing: -0.01em;
}

.contact__lede {
  max-width: 52ch;
  margin: 0 auto 32px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.contact__email {
  font-family: var(--font-mono);
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 4px;
}

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

.contact__phone {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.contact__phone a {
  color: var(--text-secondary);
  text-decoration: none;
}

.contact__phone-tel { font-family: var(--font-mono); }

.contact__phone a:hover { color: var(--accent); }

.contact__phone-sep { margin: 0 2px; color: var(--text-tertiary); }

.contact__socials {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

footer.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0;
}

.site-footer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.site-footer__row a { color: var(--text-tertiary); text-decoration: none; }
.site-footer__row a:hover { color: var(--text); }

/* ---------- reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
  .skills__grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav__links, .nav__actions .icon-btn:not(.theme-toggle):not(.nav__burger) { display: none; }
  .nav__burger { display: inline-flex; align-items: center; justify-content: center; }
  .projects__grid { grid-template-columns: 1fr; }
  .edu__grid { grid-template-columns: 1fr; }
  .section__head { flex-direction: column; align-items: flex-start; }
  section { padding: 56px 0; }
  .hero { padding: 64px 0 48px; }
}

.nav--open .nav__links {
  display: flex;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 8px 28px 20px;
}

.nav--open .nav__links a { padding: 10px 0; width: 100%; }
