/* ============================================================================
   Leonardo Baray Machado — portfolio
   Tema escuro frio, denso, estilo "dashboard". Linguagem visual portada do
   projeto tradencio: painéis elevados, acento azul, números monoespaçados
   tabulares, cards de métrica, tabela densa, badges-chip e modal de detalhe.
   Sem framework, sem build.
   ========================================================================== */

:root {
  --bg:          #0a0d12;
  --bg-elev:     #11161e;
  --bg-elev-2:   #181f29;
  --bg-elev-3:   #1f2835;
  --border:      #232c3a;
  --border-hi:   #33415380;
  --text:        #e4e9f1;
  --text-dim:    #97a2b2;
  --text-mute:   #626d7d;
  --accent:      #62b4ff;
  --accent-dim:  #2f74ad;
  --green:       #43d693;
  --green-dim:   #1e6b48;
  --red:         #ff6b78;
  --yellow:      #f5c061;
  --gold:        #ffd34d;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Oxygen, Ubuntu, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas,
          monospace;

  --shadow:   0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-l: 0 24px 64px rgba(0, 0, 0, 0.6);
  --maxw:     1180px;
  --radius:   10px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #8cc8ff; }

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.15; margin: 0; }

code, .mono { font-family: var(--mono); }
code {
  font-size: 0.86em;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-dim); }
.accent { color: var(--accent); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Acessibilidade -------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--accent); color: #04101e;
  padding: 9px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  z-index: 100; transition: top 0.15s;
}
.skip-link:focus { top: 12px; }

/* Toggle de idioma — esconde o idioma inativo ---------------------------- */
html[data-lang="pt"] [data-en] { display: none !important; }
html[data-lang="en"] [data-pt] { display: none !important; }

/* ============================================================ Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 13, 18, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 18px;
  height: 60px;
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
}

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
  color: var(--text); white-space: nowrap;
}
.brand .logo { color: var(--accent); font-size: 13px; transform: translateY(-1px); }
.brand:hover { color: var(--text); }
.brand:hover .logo { color: #8cc8ff; }

.nav {
  display: flex; align-items: center; gap: 2px;
  margin-left: 8px; flex: 1;
}
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  padding: 7px 12px; border-radius: 7px;
  border: 1px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.nav a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav a.active { color: var(--text); background: var(--bg-elev-3); border-color: var(--border-hi); }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Segmented control de idioma (portado do market-switch) */
.lang-switch {
  display: inline-flex; gap: 2px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}
.lang-switch button {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-dim); font-family: var(--mono);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 5px 10px; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--accent-dim); color: #fff; }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  color: var(--green);
  border: 1px solid #43d69355; background: #43d6930f;
  padding: 5px 10px; border-radius: 7px; white-space: nowrap;
}
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

/* Hamburger (mobile) */
.nav-toggle {
  display: none; width: 40px; height: 36px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-toggle .bar { width: 17px; height: 1.5px; background: var(--text-dim); transition: 0.2s; }

/* ============================================================ Sections ==== */
main { display: block; }

section { padding: 64px 0; border-top: 1px solid var(--border); }
section:first-of-type { border-top: 0; }

.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 30px; }
.section-head h2 { font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; }
.section-head .meta { margin-left: auto; font-size: 12.5px; color: var(--text-mute); font-family: var(--mono); }

/* =============================================================== Hero ===== */
.hero { padding: clamp(56px, 9vw, 104px) 0 64px; border-top: 0; }
.hero h1 {
  font-size: clamp(38px, 7vw, 68px); font-weight: 750; line-height: 1.02;
  margin: 0 0 18px; letter-spacing: -0.03em;
}
.hero .tagline {
  font-size: clamp(18px, 2.6vw, 25px); font-weight: 500;
  color: var(--text); max-width: 34ch; margin: 0 0 22px; line-height: 1.3;
}
.hero .lead {
  font-size: 16px; color: var(--text-dim); max-width: 64ch; margin: 0 0 24px;
}
.hero .lead strong { color: var(--text); font-weight: 600; }

.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  margin-bottom: 30px;
}
.hero-meta .sep { color: var(--border-hi); }
.hero-meta .ico { color: var(--accent); }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 44px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-elev-2); color: var(--text);
  transition: background 0.13s, border-color 0.13s, transform 0.05s, color 0.13s;
}
.btn:hover { background: var(--bg-elev-3); border-color: var(--border-hi); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #04101e; }

/* Cards de métrica (metrics-row do tradencio) --------------------------- */
.metrics {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.metric {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.metric .v {
  font-family: var(--mono); font-size: 26px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--accent); line-height: 1;
}
.metric .l {
  display: block; margin-top: 8px;
  font-size: 11.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.4;
}

/* ============================================================== Stack ===== */
.stack-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.stack-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
}
.stack-card h3 {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text); background: var(--bg-elev-2);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 9px; white-space: nowrap;
}
.chip.key { color: var(--accent); border-color: #62b4ff44; background: #62b4ff12; }

/* ============================================================ Projetos ==== */
.proj-group { margin-bottom: 34px; }
.proj-group:last-child { margin-bottom: 0; }
.proj-group-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.proj-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Tabela densa de projetos (ranking-table do tradencio) */
.ptable {
  width: 100%; border-collapse: collapse;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ptable th, .ptable td {
  padding: 0; text-align: left; border-bottom: 1px solid var(--border);
}
.ptable thead th {
  background: var(--bg-elev-2);
  font-family: var(--mono); font-weight: 600; font-size: 10.5px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 9px 14px;
}
.ptable thead .col-tags { width: 168px; }
.ptable thead .col-act  { width: 52px; }
.ptable tbody tr { transition: background 0.1s; cursor: pointer; }
.ptable tbody tr:last-child td { border-bottom: none; }
.ptable tbody tr:hover { background: var(--bg-elev-2); }
.ptable tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ptable td { padding: 13px 14px; vertical-align: middle; }

.p-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; color: var(--text); }
.p-tagline { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-dim); font-weight: 400; }
.p-stack { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 7px; border-radius: 4px; border: 1px solid transparent; white-space: nowrap;
}
.tag.prod    { color: var(--green);  background: #43d6931a; border-color: #43d69333; }
.tag.live    { color: var(--accent); background: #62b4ff1a; border-color: #62b4ff33; }
.tag.public  { color: var(--text-dim); background: #97a2b214; border-color: #97a2b233; }
.tag.private { color: var(--yellow); background: #f5c0611a; border-color: #f5c06133; }

.cell-act { text-align: center; }
.p-act { color: var(--text-mute); font-size: 15px; opacity: 0; transition: opacity 0.12s, color 0.12s; }
.ptable tbody tr:hover .p-act,
.ptable tbody tr:focus-visible .p-act { opacity: 1; color: var(--accent); }

/* Lista enxuta de experimentos ----------------------------------------- */
.misc {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.misc-item {
  display: grid; grid-template-columns: 200px 1fr; gap: 16px;
  padding: 13px 16px; border-bottom: 1px solid var(--border); align-items: baseline;
}
.misc-item:last-child { border-bottom: none; }
.misc-item .name { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
a.misc-name:hover { color: var(--accent); }
.misc-item .desc { font-size: 13px; color: var(--text-dim); }
.misc-item .desc code { font-size: 0.82em; }

/* =============================================================== Modal ==== */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 10, 0.66); backdrop-filter: blur(3px); }
.modal-card {
  position: relative;
  background: var(--bg-elev); border: 1px solid var(--border-hi);
  border-radius: 14px; width: min(720px, 100%); max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-l);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 19px; font-weight: 700; }
.modal-head .sub { display: block; margin-top: 7px; }
#modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.modal-close {
  flex: none; background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 16px; line-height: 1;
  transition: color 0.12s, border-color 0.12s;
}
.modal-close:hover { color: var(--text); border-color: var(--border-hi); }

.pm-body { overflow-y: auto; padding: 20px; }
.pm-desc { font-size: 14.5px; color: var(--text); line-height: 1.62; margin: 0 0 18px; }
.pm-desc code { font-size: 0.85em; }

.pm-params { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.pm-param { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; }
.pm-param .pl {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 5px;
}
.pm-param .pv { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }

.pm-section { margin-bottom: 18px; }
.pm-section:last-child { margin-bottom: 0; }
.pm-section h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); padding-bottom: 7px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.pm-section ul { margin: 0; padding: 0; list-style: none; }
.pm-section li {
  position: relative; padding: 6px 0 6px 18px;
  font-size: 13.5px; line-height: 1.55; color: var(--text);
}
.pm-section li::before {
  content: ""; position: absolute; left: 2px; top: 13px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.pm-section li code { font-size: 0.84em; }

.pm-links { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.pm-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  padding: 8px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-elev-2); color: var(--text);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.pm-link:hover { border-color: var(--accent); color: var(--accent); }
.pm-link.disabled { color: var(--text-mute); cursor: default; border-style: dashed; }
.pm-link.disabled:hover { border-color: var(--border); color: var(--text-mute); }

/* =============================================================== Infra ==== */
.infra-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.infra-side { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.infra-side.after { border-color: #43d69333; background: #43d6930a; }
.infra-side h3 {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.infra-side.before h3 { color: var(--red); }
.infra-side.after h3 { color: var(--green); }
.infra-side ul { margin: 0; padding: 0; list-style: none; }
.infra-side li {
  position: relative; padding: 8px 0 8px 20px; font-size: 13.5px; line-height: 1.5;
  color: var(--text-dim); border-bottom: 1px solid #1a212c;
}
.infra-side li:last-child { border-bottom: none; }
.infra-side li strong { color: var(--text); font-weight: 600; }
.infra-side li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 6px; height: 6px; }
.infra-side.before li::before { background: var(--red); border-radius: 1px; transform: rotate(45deg); top: 13px; }
.infra-side.after li::before { background: var(--green); border-radius: 50%; }

/* ============================================================== Sobre ===== */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px; align-items: start; }
.about-text p { font-size: 15.5px; color: var(--text-dim); margin: 0 0 16px; }
.about-text p strong { color: var(--text); font-weight: 600; }
.about-text .pull {
  font-size: 18px; color: var(--text); font-weight: 500; line-height: 1.45;
  border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 22px 0;
}
.about-side {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 20px; margin: 0;
}
.about-side div { display: flex; flex-direction: column; gap: 3px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.about-side div:last-child { border-bottom: none; }
.about-side dt {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.about-side dd { margin: 0; font-size: 14px; color: var(--text); }

/* ============================================================ Contato ===== */
.contact-card {
  background: linear-gradient(150deg, var(--bg-elev-2), var(--bg-elev));
  border: 1px solid var(--border-hi); border-radius: 16px;
  padding: clamp(28px, 5vw, 48px); text-align: center;
}
.contact-card h2 { font-size: clamp(26px, 4.5vw, 40px); font-weight: 750; margin: 0 0 14px; }
.contact-card p { font-size: 16px; color: var(--text-dim); max-width: 56ch; margin: 0 auto 26px; }
.contact-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ============================================================= Footer ===== */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
  font-size: 12.5px; color: var(--text-mute); font-family: var(--mono);
}

/* ========================================================= Responsivo ===== */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .pm-params { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .nav, .topbar-right .status-badge { display: none; }
  .nav-toggle { display: flex; }
  .nav.is-open {
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    position: absolute; top: 60px; left: 0; right: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 12px 16px; margin: 0;
  }
  .nav.is-open a { padding: 11px 12px; }

  .infra-wrap { grid-template-columns: 1fr; }

  /* Tabela de projetos vira cards empilhados */
  .ptable, .ptable thead, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable { border: 0; background: transparent; }
  .ptable thead { display: none; }
  .ptable tbody tr {
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 10px; padding: 14px 16px;
    position: relative;
  }
  .ptable td { border: 0; padding: 4px 0; }
  .ptable td.cell-tags { margin-top: 8px; }
  .ptable td.cell-act { display: none; }
  .p-tagline { max-width: 90%; }

  .misc-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 420px) {
  .pm-params { grid-template-columns: 1fr; }
  .container { padding: 0 18px; }
  .topbar-inner { padding: 0 18px; }
}

/* Movimento reduzido */
@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; }
}
