/* ==========================================================================
   Diego Belini — Portfolio
   Design system: dark, code-inspired. Signature motif is the git-diff
   before/after chip, echoing the "do código ao pixel" positioning and the
   fact that every case study is fundamentally a before → after story.
   ========================================================================== */

:root {
  --bg: #0A0E14;
  --bg-elevated: #111720;
  --bg-elevated-2: #171E29;
  --border: #232B38;
  --border-soft: #1A212C;

  --text-primary: #E8EDF3;
  --text-secondary: #93A1B4;
  --text-muted: #5C6B80;

  --accent-add: #4FD98B;
  --accent-add-bg: rgba(79, 217, 139, 0.1);
  --accent-remove: #E5645A;
  --accent-remove-bg: rgba(229, 100, 90, 0.08);
  --accent-primary: #5AA9E6;
  --accent-warn: #D9A441;

  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max-width: 880px;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.accent-add { color: var(--accent-add); }
.accent-primary { color: var(--accent-primary); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent-primary);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 200;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 3px;
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

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

.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav__links a {
  text-decoration: none;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.nav__links a:hover { color: var(--text-primary); }

.nav__cta {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary) !important;
}
.nav__cta:hover {
  border-color: var(--accent-add);
  color: var(--accent-add) !important;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav__toggle span {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
}

/* ---------- Hero ---------- */

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 80px 32px 40px;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  font-size: 13px;
  color: var(--accent-add);
  margin: 0 0 16px;
  letter-spacing: 0.01em;
}

.hero__title {
  font-family: var(--font-mono);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero__lede {
  font-size: 19px;
  color: var(--text-secondary);
  max-width: 52ch;
  margin: 0 0 32px;
}

.hero__cta-row {
  display: flex;
  gap: 14px;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn--primary {
  background: var(--accent-add);
  color: #0A0E14;
}
.btn--primary:hover { background: #6EE7A5; }

.btn--ghost {
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn--ghost:hover { border-color: var(--text-secondary); }

.hero__contact {
  font-size: 13px;
  color: var(--text-secondary);
}
.hero__contact a { text-decoration: none; }
.hero__contact a:hover { color: var(--accent-primary); }
.hero__contact .dot { margin: 0 10px; color: var(--text-muted); }

.hero__avatar-wrap {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.hero__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Pillars ---------- */

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 56px;
}

.pillar {
  background: var(--bg-elevated);
  padding: 24px;
}

.pillar__fn {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text-primary);
}

.pillar__desc {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
}

/* ---------- Section shared ---------- */

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 32px;
  border-top: 1px solid var(--border-soft);
}

.section__title {
  font-family: var(--font-mono);
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.section__lede {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 62ch;
  margin: 0 0 48px;
}

/* ---------- Timeline / commit log ---------- */

.timeline {
  position: relative;
  padding-left: 28px;
  margin-bottom: 56px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.commit {
  position: relative;
  margin-bottom: 36px;
}
.commit:last-child { margin-bottom: 0; }

.commit__node {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-muted);
}
.commit__node--head {
  border-color: var(--accent-add);
  background: var(--accent-add);
  box-shadow: 0 0 0 3px var(--accent-add-bg);
}

.commit__tag {
  font-size: 12px;
  color: var(--accent-add);
  margin: 0 0 6px;
}
.commit:not(:first-child) .commit__tag { color: var(--text-muted); }

.commit__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.commit__desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 64ch;
}

/* ---------- Skills ---------- */

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

.skills__label {
  font-size: 12px;
  color: var(--accent-primary);
  margin: 0 0 6px;
  text-transform: lowercase;
}

.skills__list {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.7;
}

/* ---------- Case studies ---------- */

.case {
  padding: 40px 0;
  border-top: 1px solid var(--border-soft);
}
.case:first-of-type { border-top: none; padding-top: 0; }

.case__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.case__meta {
  font-size: 12.5px;
  color: var(--accent-warn);
  margin: 0 0 8px;
}

.case__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  max-width: 48ch;
}

.case__link {
  font-size: 13px;
  color: var(--accent-primary);
  text-decoration: none;
  white-space: nowrap;
  padding-top: 4px;
}
.case__link:hover { text-decoration: underline; }

.case__image {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 28px;
  background: var(--bg-elevated);
}
.case__image--secondary { margin-top: 8px; }

.case__block {
  margin-bottom: 24px;
}

.case__label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: lowercase;
}

.case__list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}
.case__list li { margin-bottom: 8px; }
.case__list li:last-child { margin-bottom: 0; }
.case__list strong { color: var(--text-primary); }

.diff {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  font-size: 13.5px;
}

.diff-line {
  padding: 9px 14px;
}
.diff-line.remove {
  background: var(--accent-remove-bg);
  color: var(--accent-remove);
}
.diff-line.add {
  background: var(--accent-add-bg);
  color: var(--accent-add);
}
.diff-line em { color: inherit; font-style: normal; opacity: 0.75; }

.case__quote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 2px solid var(--accent-add);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 16px;
  font-style: italic;
  color: var(--text-primary);
}
.case__quote cite {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-style: normal;
  color: var(--text-muted);
}

.case__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.case__table tr:not(:last-child) { border-bottom: 1px solid var(--border); }
.case__table th, .case__table td {
  text-align: left;
  padding: 10px 14px;
  font-weight: 400;
}
.case__table th {
  color: var(--text-muted);
  width: 110px;
  font-family: var(--font-mono);
  font-weight: 500;
  background: var(--bg-elevated);
}
.case__table td { color: var(--text-secondary); }

/* ---------- Branch label + mini cards ---------- */

.branch-label {
  font-size: 13px;
  color: var(--text-muted);
  margin: 56px 0 24px;
  padding-top: 40px;
  border-top: 1px solid var(--border-soft);
}

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

.mini-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.mini-card__image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated-2);
}

.mini-card__body { padding: 18px; }

.mini-card__title {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0 0 8px;
}

.mini-card__desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
}

/* ---------- Contact ---------- */

.section--contact {
  text-align: center;
}
.section--contact .section__lede { margin-left: auto; margin-right: auto; }

.contact-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 15px;
  min-width: 200px;
  transition: border-color 0.15s ease;
}
.contact-link:hover { border-color: var(--accent-add); }
.contact-link .mono { font-size: 11.5px; }

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 32px;
  border-top: 1px solid var(--border-soft);
}
.footer p { font-size: 12.5px; margin: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .nav { padding: 16px 20px; }
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav__links.is-open { max-height: 300px; }
  .nav__links a {
    width: 100%;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
  }
  .nav__cta { margin: 12px 20px; }

  .hero { padding: 48px 20px 32px; }
  .hero__grid { grid-template-columns: 1fr; text-align: left; }
  .hero__avatar-wrap { width: 140px; height: 140px; }
  .hero__cta-row { flex-direction: column; }
  .hero__contact { display: flex; flex-direction: column; gap: 8px; }
  .hero__contact .dot { display: none; }

  .pillars { grid-template-columns: 1fr; margin-top: 40px; }

  .section { padding: 56px 20px; }

  .skills { grid-template-columns: 1fr; }

  .case__header { flex-direction: column; }

  .mini-grid { grid-template-columns: 1fr; }

  .contact-link { width: 100%; }
}
