/* ============================================================
   João Ferrete — portfolio
   Design tokens: dark base, teal (continuity) + amber signal.
   Type: Space Grotesk (display) · Inter (body) · JetBrains Mono (data)
   ============================================================ */

:root {
  --ink: #0e1417;
  --surface: #161d21;
  --surface-2: #1b242a;
  --line: #243036;
  --teal: #5bc8c2;
  --teal-dim: #3a7e7a;
  --amber: #f4a259;
  --text: #e6edee;
  --muted: #8a9ba0;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1080px;
  --pad: clamp(20px, 5vw, 64px);
  --radius: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

::selection {
  background: var(--teal);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- skip link ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  background: var(--teal);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 11px 20px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.btn--solid {
  background: var(--teal);
  color: var(--ink);
}
.btn--solid:hover {
  background: #74dad4;
  transform: translateY(-2px);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn--ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-2px);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px var(--pad);
  background: rgba(14, 20, 23, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}
.brand__logo {
  border-radius: 8px;
  display: block;
}
.brand__name {
  font-size: 16px;
}
.brand__accent {
  color: var(--teal);
}

.nav {
  display: flex;
  gap: 28px;
  margin-left: auto;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--teal);
  transition: width 0.2s ease;
}
.nav a:hover,
.nav a.is-active {
  color: var(--text);
}
.nav a:hover::after,
.nav a.is-active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.lang-toggle:hover {
  border-color: var(--teal);
}
.lang-toggle__opt.is-active {
  color: var(--teal);
  font-weight: 600;
}
.lang-toggle__sep {
  opacity: 0.4;
  margin: 0 2px;
}

/* burger (mobile only) */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-burger span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition:
    transform 0.25s ease,
    opacity 0.2s ease;
}
.nav-burger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-burger.is-open span:nth-child(2) {
  opacity: 0;
}
.nav-burger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  position: fixed;
  top: 69px;
  left: 0;
  right: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 8px var(--pad) 16px;
  transform: translateY(-120%);
  visibility: hidden;
  transition:
    transform 0.3s ease,
    visibility 0s linear 0.3s;
}
.mobile-nav.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.3s ease;
}
.mobile-nav a {
  padding: 14px 0;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  border-bottom: 1px solid var(--line);
}
.mobile-nav a:last-child {
  border-bottom: none;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 160px var(--pad) 80px;
  max-width: var(--maxw);
  margin: 0 auto;
  overflow: hidden;
}
.hero__graph {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(
    120% 80% at 75% 40%,
    #000 25%,
    transparent 75%
  );
  mask-image: radial-gradient(120% 80% at 75% 40%, #000 25%, transparent 75%);
  opacity: 0.9;
}
.hero__graph svg {
  width: 100%;
  height: 100%;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--teal);
  margin: 0 0 18px;
  letter-spacing: 0.04em;
}

.hero__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 8vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 22px;
}

.hero__role {
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.2vw, 19px);
  color: var(--text);
  margin: 0 0 18px;
}

.hero__tagline {
  font-size: clamp(16px, 2.4vw, 20px);
  color: var(--muted);
  max-width: 560px;
  margin: 0 0 34px;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* ============================================================
   SECTIONS (shared)
   ============================================================ */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 80px var(--pad);
  border-top: 1px solid var(--line);
}

.section__label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.node-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(244, 162, 89, 0.15);
}

.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 4.5vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 40px;
  max-width: 720px;
}
.section__title--big {
  font-size: clamp(34px, 6vw, 58px);
}

/* ---------- ABOUT ---------- */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.about__lead .section__title {
  margin-bottom: 0;
}
.about__body p {
  margin: 0 0 18px;
  color: var(--muted);
}
.about__body p:first-child {
  color: var(--text);
}

.about__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  list-style: none;
  padding: 24px 0 0;
  margin: 8px 0 0;
  border-top: 1px solid var(--line);
}
.about__facts li {
  display: flex;
  flex-direction: column;
}
.about__facts .num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--teal);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.about__facts li span:last-child {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- SKILLS ---------- */
.skills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
.skill-group {
  flex: 1 1 300px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
  margin: 0 0 16px;
}
.skill-group ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.skill-group li {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 11px;
}

/* ---------- PROJECTS ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition:
    transform 0.18s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--teal);
  background: var(--surface-2);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card__head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}
.card__stars {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  white-space: nowrap;
}
.card__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--teal);
  white-space: nowrap;
}
.card__live i {
  font-size: 7px;
  animation: live-blink 1.6s ease-in-out infinite;
}
@keyframes live-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.card p {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 18px;
  flex: 1;
}
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card__tags span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--teal);
  border: 1px solid var(--teal-dim);
  border-radius: 6px;
  padding: 3px 8px;
}

.more-link {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 40px auto 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 24px;
  width: fit-content;
  transition: all 0.2s ease;
}
.more-link:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ---------- EXPERIENCE / TIMELINE ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.timeline__item {
  position: relative;
  padding: 0 0 36px 40px;
}
.timeline__item:last-child {
  padding-bottom: 0;
}
.timeline__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--teal);
}
.timeline__item--edu::before {
  border-color: var(--amber);
}
.timeline__date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--amber);
  letter-spacing: 0.02em;
}
.timeline__item h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 6px 0 2px;
}
.timeline__org {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  margin: 0 0 10px;
}
.timeline__item p:last-child {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

/* ---------- CONTACT ---------- */
.section--contact {
  padding-bottom: 100px;
}
.contact__sub {
  color: var(--muted);
  max-width: 560px;
  margin: -20px 0 36px;
}
.contact__links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact__links a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(15px, 2.4vw, 18px);
  border-bottom: 1px solid var(--line);
  transition:
    color 0.2s ease,
    padding-left 0.2s ease;
}
.contact__links a:hover {
  color: var(--teal);
  padding-left: 10px;
}
.contact__links i {
  color: var(--teal);
  width: 24px;
  text-align: center;
}

/* ---------- FOOTER ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--pad);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}
.site-footer .to-top {
  text-decoration: none;
  color: var(--muted);
}
.site-footer .to-top:hover {
  color: var(--teal);
}

/* ---------- hero graph elements (drawn by JS) ---------- */
.graph-edge {
  stroke: var(--line);
  stroke-width: 1;
}
.graph-trace {
  stroke: var(--teal);
  stroke-width: 1.8;
  stroke-linecap: round;
  fill: none;
  filter: drop-shadow(0 0 3px rgba(91, 200, 194, 0.5));
}
.graph-node {
  fill: var(--surface-2);
  stroke: var(--teal-dim);
  stroke-width: 1.4;
  transition:
    fill 0.5s ease,
    stroke 0.5s ease,
    r 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.graph-node.is-active {
  fill: var(--teal);
  stroke: var(--teal);
  r: 6.5;
  filter: drop-shadow(0 0 5px rgba(91, 200, 194, 0.6));
}
.graph-pulse {
  fill: var(--amber);
  filter: drop-shadow(0 0 6px rgba(244, 162, 89, 0.85));
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .nav {
    display: none;
  }
  .nav-burger {
    display: flex;
  }
  .about {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hero__graph {
    -webkit-mask-image: radial-gradient(
      140% 60% at 50% 25%,
      #000 20%,
      transparent 80%
    );
    mask-image: radial-gradient(140% 60% at 50% 25%, #000 20%, transparent 80%);
    opacity: 0.5;
  }
}

@media (max-width: 520px) {
  .brand__name {
    display: none;
  }
  .header-actions {
    gap: 8px;
  }
  #cvHeader {
    display: none;
  }
  .section {
    padding: 56px var(--pad);
  }
  .hero__cta {
    flex-direction: column;
    width: 100%;
  }
  .hero__cta .btn {
    justify-content: center;
    width: 100%;
  }
}

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

/* ============================================================
   GLASS THEME (Togglable)
   ============================================================ */
.theme-glass .site-header {
  background: rgba(14, 20, 23, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.theme-glass .card,
.theme-glass .skill-group {
  background: rgba(22, 29, 33, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.theme-glass .card:hover {
  background: rgba(27, 36, 42, 0.8);
  border-color: var(--teal);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(91, 200, 194, 0.15);
}
.theme-glass .skill-group li {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.theme-glass .mobile-nav {
  background: rgba(22, 29, 33, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
