:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f6f8;
  --color-text: #1c1e21;
  --color-text-muted: #5b6270;
  --color-primary: #2d5fff;
  --color-primary-dark: #1c3fc7;
  --color-border: #e2e4e9;
  --max-width: 960px;
  /* O menu completo (com Ferramentas e Portfólios Web) não cabe em 960px. */
  --max-width-nav: 1120px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

h1, h2, h3 {
  line-height: 1.2;
  margin-top: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Navbar */

.navbar {
  position: sticky;
  top: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width-nav);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  margin-right: 1.5rem;
  white-space: nowrap;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

nav a {
  color: var(--color-text);
  white-space: nowrap;
}

.nav-container nav {
  margin-left: auto;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1.5rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switch a {
  display: flex;
  border: 2px solid transparent;
  border-radius: 3px;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}

.lang-switch a:hover {
  opacity: 1;
}

.lang-switch a[aria-current="page"] {
  opacity: 1;
  border-color: var(--color-primary);
}

.flag {
  display: block;
  width: 24px;
  height: 16px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--color-border);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
}

/* Hero */

.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem;
  text-align: center;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  border: 3px solid var(--color-border);
}

.hero h1 {
  font-size: 2.5rem;
}

.subtitle {
  color: var(--color-text-muted);
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.btn-primary {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
}

/* Sections */

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.section.alt {
  background: var(--color-bg-alt);
  max-width: 100%;
}

.section.alt > * {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Tags */

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
}

.tag {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

/* Timeline */

.timeline {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--color-border);
}

.timeline-item {
  padding: 0 0 2rem 1.5rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
}

.timeline-date {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}

/* Portfólios Web: miniatura (captura da página inicial) no topo do card */

.portfolio-cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.portfolio-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
  padding-top: 0;
}

/* No flex as margens não colapsam; o espaçamento vem do gap. */
.portfolio-card > * {
  margin: 0;
}

.portfolio-card > a:last-child {
  margin-top: auto;
}

.portfolio-preview {
  display: block;
  margin: 0 -1.5rem 0.25rem;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.portfolio-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  transition: transform 0.3s;
}

.portfolio-preview:hover img,
.portfolio-preview:focus-visible img {
  transform: scale(1.03);
}

/* Footer */

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--color-border);
}

/* Responsive */

/* Com as abas Ferramentas e Portfólios Web, o menu completo fica justo logo acima do breakpoint mobile. */
@media (max-width: 1100px) {
  nav ul {
    gap: 1rem;
  }

  nav a {
    font-size: 0.95rem;
  }
}

@media (max-width: 940px) {
  .menu-toggle {
    display: flex;
  }

  .nav-actions {
    margin-left: 0.75rem;
  }

  nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    gap: 1rem;
    display: none;
  }

  nav ul.open {
    display: flex;
  }
}

/* Verificação anti-robô (Turnstile) */

.gate {
  display: none;
}

.gated .gate {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(28, 30, 33, 0.35);
}

.gated body {
  overflow: hidden;
}

.gated body > :not(.gate) {
  filter: blur(8px);
  user-select: none;
}

.gate-box {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 2rem 1rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.gate-box h2 {
  margin-top: 0;
}

.gate-box p {
  color: var(--color-text-muted);
}

.gate-status:empty {
  display: none;
}

/* Ferramentas: Firewall Multivendor Configurator */

/* Página da ferramenta (ferramentas/): mais larga, para comparar os dois sites lado a lado. */
.section-wide {
  max-width: 1280px;
}

.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.tool {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1.5rem;
}

.tool-intro,
.tool-hint,
.tool-crypto,
.fw-note {
  color: var(--color-text-muted);
}

.tool-hint {
  font-size: 0.9rem;
}

.btn-secondary {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-primary);
  background: #fff;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #eef2ff;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-tf {
  background: #5c4ee5;
}

.btn-tf:hover {
  background: #4337c9;
}

button.btn-primary {
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.fw-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.fw-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100px;
  padding: 0.6rem 0.4rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: grab;
}

.fw-item:hover {
  border-color: var(--color-text-muted);
}

.fw-item[aria-pressed="true"] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.fw-icon,
.node-icon {
  width: 40px;
  height: 30px;
}

.v-srx .fw-icon { color: #2f6b1f; }
.v-fortigate .fw-icon { color: #da291c; }
.v-paloalto .fw-icon { color: #fa582d; }
.v-asa .fw-icon { color: #049fd9; }

.topology {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 160px) 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.site {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
  border: 1px dashed var(--color-text-muted);
  border-radius: 8px;
}

.site h4 {
  margin: 0 0 -0.5rem;
  text-align: center;
}

.node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem;
  text-align: center;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

/* Cabos verticais ligando ISP, firewall e LAN dentro de cada site. */
.node + .node::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  height: calc(1.5rem + 2px);
  border-left: 2px solid var(--color-text-muted);
}

.node-icon {
  color: var(--color-text-muted);
}

.node label,
.tool-options label {
  display: block;
  width: 100%;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: left;
}

.node input,
.tool-options input {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.35rem 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.node input[aria-invalid="true"],
.tool-options input[aria-invalid="true"] {
  border-color: #c0392b;
  box-shadow: 0 0 0 1px #c0392b;
}

.fw-slot {
  justify-content: center;
  min-height: 100px;
  background: #fff;
  border: 2px dashed var(--color-primary);
  cursor: pointer;
}

.fw-slot.pick,
.fw-slot.over {
  background: #eef2ff;
}

.fw-slot.missing {
  border-color: #c0392b;
}

.fw-slot.filled {
  border-style: solid;
  border-color: var(--color-border);
  cursor: grab;
}

.fw-slot-empty {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.fw-placed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.fw-placed .fw-icon {
  width: 56px;
  height: 42px;
}

.fw-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  padding: 0.1rem 0.4rem;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.fw-remove:hover {
  color: #c0392b;
}

.wan-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-top: 4rem;
  text-align: center;
}

.wan-cloud {
  width: 80px;
  height: 50px;
  color: var(--color-text-muted);
}

.tunnel {
  width: 100%;
  padding-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 3px dashed var(--color-text-muted);
}

.tunnel.up {
  font-weight: 600;
  color: #1f9d55;
  border-top-style: solid;
  border-color: #1f9d55;
}

.tool-options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.tool-options label {
  flex: 1 1 260px;
  max-width: 420px;
}

.tool-crypto {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
}

.tool-status {
  min-height: 1.6em;
  font-size: 0.95rem;
}

.tool-status.error {
  color: #c0392b;
}

.tool-status.ok {
  color: #1f9d55;
}

.fw-output {
  scroll-margin-top: 5rem;
}

.fw-output[hidden] {
  display: none;
}

.fw-compare-head,
.fw-row-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.fw-compare-head {
  margin-bottom: 1rem;
}

.fw-site-head {
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.fw-site-head h4 {
  margin: 0;
}

.fw-note {
  margin: 0.3rem 0 0.6rem;
  font-size: 0.85rem;
}

.tf-guide {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border: 1px solid #5c4ee5;
  border-radius: 6px;
}

.tf-guide summary {
  font-weight: 600;
  cursor: pointer;
}

.tf-guide ol {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.tf-guide li {
  margin-bottom: 0.75rem;
}

.tf-guide pre {
  margin: 0.5rem 0;
  overflow-x: auto;
  padding: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #e2e8f0;
  background: #0f172a;
  border-radius: 6px;
}

.tf-guide code {
  font-size: 0.85em;
}

.tf-guide table {
  display: block;
  overflow-x: auto;
  margin-top: 0.5rem;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tf-guide th,
.tf-guide td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--color-border);
}

.tf-guide th {
  background: var(--color-bg-alt);
}

.fw-blocks {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fw-row {
  padding: 0.75rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.fw-row-head h5 {
  margin: 0;
  font-size: 0.95rem;
}

.fw-block-desc {
  margin: 0.3rem 0 0.6rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.fw-cell {
  min-width: 0;
}

.fw-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.fw-cell-site {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.btn-copy-block {
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.fw-na {
  margin: 0;
  padding: 1rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: 6px;
}

.fw-cell pre {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #e2e8f0;
  background: #0f172a;
  border-radius: 6px;
}

@media (max-width: 720px) {
  .tool {
    padding: 1rem;
  }

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

  .wan-link {
    margin-top: 0;
  }

  .fw-compare-head,
  .fw-row-cols {
    grid-template-columns: 1fr;
  }
}
