/* ── Tokens ────────────────────────────────────────────── */
:root {
  --bg:           #121110;
  --border:       rgba(218, 200, 165, 0.07);
  --border-mid:   rgba(218, 200, 165, 0.13);

  --text:         #ddd3be;
  --text-mid:     #a89b86;
  --text-dim:     #8a8074;

  --accent:       #c4925a;
  --accent-hover: #d4a46a;

  --ff-display: 'Fraunces', Georgia, serif;
  --ff-mono:    'JetBrains Mono', 'Courier New', monospace;
  --ff-body:    'Figtree', system-ui, sans-serif;
}

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

/* ── Base ──────────────────────────────────────────────── */
html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient warm glow — barely perceptible */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 65% 55% at 18% 48%,
    rgba(175, 115, 55, 0.04) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Grain ─────────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ── Accessibility helpers ─────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Links ─────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 200ms ease;
}

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

a:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Layout ────────────────────────────────────────────── */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(240px, 37%) minmax(0, 63%);
  max-width: 1080px;
  margin: 0 auto;
  animation: surface 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes surface {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .layout {
    animation: none;
  }

  .status-dot {
    animation: none;
  }

  .links a,
  .project,
  .project-arrow {
    transition-property: color, background-color;
  }
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 3rem 0 2.5rem;
  border-right: 1px solid var(--border);
}

/* Em janelas muito altas o centro deixa um vazio grande; ancora no topo. */
@media (min-height: 1100px) {
  .sidebar {
    align-items: flex-start;
    padding-top: 6rem;
  }
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: 100%;
}

/* Availability */
.availability {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.15rem;
  font-family: var(--ff-mono);
  font-size: 0.63rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.status-dot {
  flex-shrink: 0;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #8fae72;
  box-shadow: 0 0 0 3px rgba(143, 174, 114, 0.14);
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* Name */
.identity h1 {
  font-family: var(--ff-display);
  font-weight: 200;
  font-style: italic;
  font-size: clamp(2.25rem, 3.2vw, 2.85rem);
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 0.65rem;
  color: var(--text);
}

.role-line {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--text-mid);
  margin: 0 0 1rem;
}

.tagline {
  font-family: var(--ff-body);
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-mid);
  margin: 0;
  max-width: 30ch;
}

/* Stack chips */
.stack-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  line-height: 1.15;
}

.stack span {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  padding: 0.2em 0.55em;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 200ms ease, border-color 200ms ease;
}

.stack span:hover {
  color: var(--text-mid);
  border-color: var(--border-mid);
}

.stack-primary span {
  color: var(--text-mid);
  border-color: var(--border-mid);
}

/* Nav links */
.links {
  display: flex;
  flex-direction: column;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  transition: color 180ms ease, padding-left 180ms ease;
}

.links a:first-child {
  border-top: 1px solid var(--border);
}

.links a:hover {
  color: var(--text);
  padding-left: 0.35rem;
}

.link-arrow {
  font-size: 0.75rem;
  opacity: 0.35;
  transition: opacity 180ms ease, color 180ms ease;
}

.links a:hover .link-arrow {
  opacity: 0.7;
  color: var(--accent);
}

/* CV download */
.cv-cta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(196, 146, 90, 0.38);
  border-radius: 3px;
  background: rgba(196, 146, 90, 0.08);
  font-family: var(--ff-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.cv-cta:hover {
  background: rgba(196, 146, 90, 0.16);
  border-color: rgba(196, 146, 90, 0.6);
  color: var(--text);
}

.cv-cta-icon {
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1;
}

.cv-cta-meta {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

/* Email row with copy action */
.link-email-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.link-email-row .link-email {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 0;
  padding-right: 0;
}

.link-email-row .link-email span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  min-width: 4.6rem;
  padding: 0.32rem 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

.copy-btn:hover {
  color: var(--text-mid);
  border-color: var(--border-mid);
}

.copy-btn.is-copied {
  color: var(--accent);
  border-color: rgba(196, 146, 90, 0.45);
}

.copy-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

/* Footer row: year + language toggle */
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.year {
  display: inline-block;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lang-toggle button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.65rem 0.4rem;
  margin: -0.65rem -0.4rem;
  font: inherit;
  letter-spacing: inherit;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 180ms ease;
}

.lang-toggle button:hover {
  color: var(--text-mid);
}

.lang-toggle button[aria-current='true'] {
  color: var(--text-mid);
}

.lang-toggle button[aria-current='true']:hover {
  color: var(--text);
}

.lang-toggle button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.lang-sep {
  color: var(--text-dim);
  opacity: 0.5;
}

/* ── Content ───────────────────────────────────────────── */
.content {
  padding: 3.25rem 3rem 3.5rem 4rem;
}

/* ── Sections ──────────────────────────────────────────── */
.section {
  margin-bottom: 2.5rem;
}

.section:last-child {
  margin-bottom: 0;
}

.section h2 {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section h2::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 1px;
  background: var(--border);
}

.section > p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 0.75em;
}

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

/* ── Experience ────────────────────────────────────────── */
.experience-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.9rem;
  margin-bottom: 0.9rem;
}

.experience-head h3 {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}

.experience-meta {
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.12em 0.5em;
  white-space: nowrap;
}

.experience-company {
  margin: -0.45rem 0 0.9rem;
  font-size: 0.8rem;
  color: var(--text-mid);
}

.experience-list strong {
  color: var(--text);
  font-weight: 500;
}

.experience-subhead {
  margin: 1.35rem 0 0.55rem;
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.history-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.45rem;
  font-size: 0.82rem;
}

.history-role {
  color: var(--text-mid);
}

.history-org {
  color: var(--text-dim);
}

.history-org::before {
  content: '·';
  margin-right: 0.45rem;
  color: var(--text-dim);
}

.history-period {
  margin-left: auto;
  font-family: var(--ff-mono);
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  white-space: nowrap;
}

.experience-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.experience-list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-mid);
}

.experience-list li::before {
  content: '';
  position: absolute;
  left: 0.05rem;
  top: 0.66em;
  width: 0.26rem;
  height: 0.26rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ── Projects ──────────────────────────────────────────── */
.projects {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 180ms ease;
}

.project:first-child {
  border-top: 1px solid var(--border);
}

.project:hover {
  padding-left: 0.6rem;
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.7rem;
  margin-bottom: 0.55rem;
  line-height: 1.3;
}

.project-head a {
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.925rem;
  color: var(--text);
  transition: color 180ms ease;
}

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

.project-stack {
  font-family: var(--ff-mono);
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 400;
}

.project-head a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding-block: 0.2rem;
  margin-block: -0.2rem;
}

.project-arrow {
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: color 180ms ease, transform 180ms ease;
}

.project-head a:hover .project-arrow {
  color: var(--accent);
  transform: translate(1px, -1px);
}

.project-badge {
  font-family: var(--ff-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(196, 146, 90, 0.1);
  border-radius: 3px;
  padding: 0.12em 0.45em;
}

.project-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--ff-body);
  font-weight: 500;
  font-size: 0.925rem;
  line-height: 1.3;
  color: var(--text);
}

.project-badge--muted {
  color: var(--text-dim);
  background: rgba(218, 200, 165, 0.05);
}

/* ── Education & contact ───────────────────────────────── */
.education-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.education-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.15rem 0.75rem;
}

.education-title {
  font-size: 0.875rem;
  color: var(--text);
}

.education-meta {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

.contact-block {
  margin-top: 1.85rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.contact-lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  font-family: var(--ff-body);
  font-size: 0.78rem;
  color: var(--text-mid);
  transition: color 180ms ease, border-color 180ms ease,
    background-color 180ms ease;
}

.btn:hover {
  color: var(--text);
  border-color: var(--border-mid);
  background: rgba(218, 200, 165, 0.04);
}

.btn-primary {
  border-color: rgba(196, 146, 90, 0.45);
  background: rgba(196, 146, 90, 0.1);
  color: var(--text);
}

.btn-primary:hover {
  border-color: rgba(196, 146, 90, 0.7);
  background: rgba(196, 146, 90, 0.18);
  color: var(--text);
}

.btn-meta {
  font-family: var(--ff-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.project > p {
  font-size: 0.855rem;
  line-height: 1.7;
  color: var(--text-mid);
  margin: 0;
}

.projects-note {
  margin: 1.1rem 0 0;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-dim);
}

.projects-note a {
  color: var(--text-mid);
  border-bottom: 1px solid var(--border-mid);
  padding-bottom: 1px;
}

.projects-note a:hover {
  color: var(--accent);
  border-color: currentColor;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 3rem 1.5rem 2.25rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 2.5rem 1.5rem 4rem;
  }
}

@media (max-height: 820px) and (min-width: 861px) {
  .sidebar {
    align-items: flex-start;
    padding-top: 3rem;
    padding-bottom: 2rem;
  }

  .sidebar-inner {
    gap: 1.75rem;
  }

  .content {
    padding: 2.25rem 3rem 2.5rem 4rem;
  }

  .section {
    margin-bottom: 1.75rem;
  }

  .section h2 {
    margin-bottom: 0.85rem;
  }

  .project {
    padding: 0.8rem 0;
  }
}

@media (max-height: 760px) and (min-width: 861px) {
  .sidebar {
    padding-top: 2rem;
    padding-bottom: 1.5rem;
  }

  .sidebar-inner {
    gap: 1.35rem;
  }

  .content {
    padding: 1.75rem 3rem 2rem 4rem;
  }

  .section {
    margin-bottom: 1.25rem;
  }

  .section h2 {
    margin-bottom: 0.7rem;
  }

  .project {
    padding: 0.65rem 0;
  }
}

@media (min-width: 861px) {
  html {
    scrollbar-width: thin;
    scrollbar-color: rgba(218, 200, 165, 0.18) transparent;
  }
}
