/* ============================================================================
   P8 PMO 360 — pmo.css
   Design system completo + header multi-página funcional
   Versão 2.0
   ============================================================================ */

/* ===== VARIÁVEIS E RESET ===== */
:root {
  --bg: #000;
  --ink: #f4f3ef;
  --mute: #a9a7a0;
  --panel: #161616;
  --line: #2c2c2c;
  --bg2: #f4f3ef;
  --ink2: #0a0a0a;
  --mute2: #55534e;
  --red: #e10600;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f3ef;
    --ink: #0a0a0a;
    --mute: #55534e;
    --panel: #e7e5de;
    --line: #cfcdc5;
    --bg2: #000;
    --ink2: #f4f3ef;
    --mute2: #a9a7a0;
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f4f3ef;
  --ink: #0a0a0a;
  --mute: #55534e;
  --panel: #e7e5de;
  --line: #cfcdc5;
  --bg2: #000;
  --ink2: #f4f3ef;
  --mute2: #a9a7a0;
  color-scheme: light;
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px));
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-weight: 850;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 7vw, 5.4rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); max-width: 16ch; }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }
p { margin: 0; }

/* Helper de acessibilidade */
.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;
}

/* ===== HEADER ===== */
header#pmo-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
header#pmo-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
  font-stretch: 120%;
  font-size: 1.5rem;
  color: var(--ink);
}
.logo b { color: var(--red); }
.logo small {
  font-weight: 600;
  font-stretch: 100%;
  font-size: 0.8rem;
  color: var(--mute);
}
.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

nav {
  display: flex;
  gap: 26px;
  align-items: center;
  font-size: 0.95rem;
}
nav a { text-decoration: none; color: var(--mute); transition: color 0.2s; }
nav a:hover { color: var(--ink); }

/* ===== BOTÕES ===== */
.btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-weight: 750;
  padding: 14px 24px;
  text-decoration: none;
  border: 2px solid var(--red);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  line-height: 1;
}
.btn:hover { background: transparent; color: var(--ink); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn.ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
nav .btn {
  padding: 10px 18px;
  color: #fff;
}
nav .btn:hover { color: var(--ink); }

/* Botões ghost sobre fundo vermelho */
.red .btn.ghost {
  color: #fff;
  border-color: #fff;
}
.red .btn.ghost:hover {
  background: #fff;
  color: var(--red);
}
.inv .btn.ghost {
  color: var(--ink2);
  border-color: var(--ink2);
}
.inv .btn.ghost:hover {
  background: var(--ink2);
  color: var(--bg2);
}

/* ===== SECÇÕES ===== */
section {
  padding: 124px 0;
  position: relative;
  overflow: hidden;
}

/* ===== HERO ===== */
.hero {
  padding: 56px 0 104px;
  min-height: calc(100svh - 72px);
  display: flex;
  align-items: center;
}
.hero .grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 940px) {
  .hero .grid { grid-template-columns: 1fr; }
}
.lede {
  font-size: 1.2rem;
  color: var(--mute);
  max-width: 46ch;
  margin: 28px 0 36px;
}
.cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.tag {
  position: absolute;
  left: -40px;
  top: 8%;
  width: 620px;
  max-width: 90vw;
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
}
.hero .wrap {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ===== RODA DOS 8 Ps ===== */
.wheelbox {
  display: grid;
  gap: 18px;
  position: relative;
  perspective: 1100px;
}
svg.wheel {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
  display: block;
  overflow: visible;
  transition: transform 0.2s ease-out;
  will-change: transform;
  filter: drop-shadow(0 34px 30px rgba(225, 6, 0, 0.22));
}
.seg path {
  fill: var(--panel);
  stroke: var(--bg);
  stroke-width: 3;
  transition: fill 0.25s;
}
.seg text {
  fill: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
  transition: fill 0.25s;
}
.seg { cursor: pointer; outline: none; }
.seg:hover path { fill: var(--line); }
.seg.on path,
.seg.on:hover path { fill: var(--red); }
.seg.on text { fill: #fff; }
.seg:focus-visible path { stroke: var(--ink); }

.ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
  cursor: pointer;
  transition: stroke 0.25s;
}
.ring:hover { stroke: var(--mute); }
.ring.on { stroke: var(--red); }

.spin {
  fill: none;
  stroke: var(--mute);
  stroke-width: 1.5;
  stroke-dasharray: 2 9;
  transform-origin: 200px 200px;
  animation: spin 60s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.hub { fill: var(--bg); }
.hubt {
  font-weight: 900;
  font-stretch: 125%;
  text-anchor: middle;
  fill: var(--ink);
}
.info {
  border-left: 4px solid var(--red);
  padding: 4px 0 4px 18px;
  min-height: 112px;
}
.info h3 { margin-bottom: 6px; }
.info h3 span {
  color: var(--mute);
  font-weight: 500;
  font-stretch: 100%;
  font-size: 1rem;
  margin-left: 8px;
}
.info p { color: var(--mute); max-width: 52ch; }

/* ===== FUNDO INVERTIDO ===== */
.inv {
  background: var(--bg2);
  color: var(--ink2);
  --ink: var(--ink2);
  --mute: var(--mute2);
  --panel: transparent;
  --line: color-mix(in srgb, var(--ink2) 22%, transparent);
}

/* ===== FUNDO VERMELHO ===== */
.red {
  background: var(--red);
  color: #fff;
  --mute: #fff;
  --line: rgba(255, 255, 255, 0.4);
}
.red .btn {
  background: #000;
  border-color: #000;
  color: #fff;
}
.red .btn:hover {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

/* ===== COLUNAS (3 disciplinas) ===== */
.cols3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 56px;
  border-top: 2px solid var(--ink);
}
.cols3 > div {
  padding: 28px 28px 8px 0;
}
.cols3 > div + div {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}
.cols3 h3 {
  margin-bottom: 12px;
  font-size: 1.6rem;
}
.cols3 p { color: var(--mute); }
@media (max-width: 820px) {
  .cols3 { grid-template-columns: 1fr; }
  .cols3 > div + div {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* ===== SERVIÇOS ===== */
.sv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 56px;
  margin-top: 48px;
}
.sv article {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.sv h3 { margin-bottom: 6px; }
.sv h3 a { text-decoration: none; }
.sv h3 a:hover { color: var(--red); }
.sv p { color: var(--mute); max-width: 46ch; }
@media (max-width: 820px) {
  .sv { grid-template-columns: 1fr; }
}

/* ===== PROCESSO ===== */
.steps {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  counter-reset: s;
}
.steps li {
  counter-increment: s;
  border-top: 3px solid #fff;
  padding-top: 18px;
}
.steps li::before {
  content: counter(s);
  display: block;
  font-weight: 900;
  font-stretch: 125%;
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 14px;
}
.steps h3 { margin-bottom: 8px; }
@media (max-width: 900px) {
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .steps { grid-template-columns: 1fr; }
}

/* ===== MODELOS ===== */
.models {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 48px;
}
.models div {
  border: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s ease-out;
}
.models div:hover { border-color: var(--red); }
.models h3 a { text-decoration: none; }
.models h3 a:hover { color: var(--red); }
.models p {
  color: var(--mute);
  font-size: 0.95rem;
}
@media (max-width: 940px) {
  .models { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .models { grid-template-columns: 1fr; }
}

/* ===== CTA FINAL ===== */
.final h2 { max-width: 18ch; }
.final .cta { margin-top: 32px; }

/* ===== FOOTER ===== */
footer {
  padding: 56px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 0.92rem;
}
.fg {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
}
.fg h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1rem;
}
.fg a {
  display: block;
  text-decoration: none;
  margin-bottom: 6px;
}
.fg a:hover { color: var(--ink); }
.fb {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  .fg { grid-template-columns: 1fr; }
}

/* ===== TEXTURA GLOBAL DE GRÃO ===== */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27160%27%20height=%27160%27%3E%3Cfilter%20id=%27n%27%3E%3CfeTurbulence%20type=%27fractalNoise%27%20baseFrequency=%27.9%27%20numOctaves=%272%27/%3E%3C/filter%3E%3Crect%20width=%27100%25%27%20height=%27100%25%27%20filter=%27url(%23n)%27/%3E%3C/svg%3E");
}

/* ===== MEGA MENU ===== */
nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
  align-items: center;
}
.mi {
  height: 72px;
  padding: 0 12px;
  background: none;
  border: 0;
  color: var(--mute);
  font: inherit;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  transition: color 0.2s;
}
.has > .mi::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s;
}
li.open > .mi,
.mi:hover { color: var(--ink); }
li.open > .mi::after { transform: rotate(225deg) translateY(-2px); }

/* Estado ativo do item do menu */
nav a.mi.is-active,
nav li > .mi.is-active { color: var(--red); }
nav a.mi.is-active:hover,
nav li > .mi.is-active:hover { color: var(--red); }

.mega {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 40px 60px rgba(0, 0, 0, 0.35);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.22s, transform 0.22s, visibility 0.22s;
}
li.open > .mega {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.mega .in {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.25fr;
  gap: 4px 28px;
  padding: 36px 24px 40px;
  max-width: 1180px;
  margin: 0 auto;
}
.mega .in.c3 {
  grid-template-columns: repeat(3, 1fr) 1.25fr;
}
.mega a {
  display: block;
  padding: 12px 14px;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}
.mega a:hover {
  border-color: var(--red);
  background: var(--panel);
}
.mega a.is-active b { color: var(--red); }
.mega a.is-active { border-color: var(--red); }
.mega b {
  display: block;
  font-weight: 750;
  color: var(--ink);
}
.mega span {
  font-size: 0.88rem;
  color: var(--mute);
}
.mega .ft {
  background: var(--red);
  color: #fff;
  padding: 24px;
  grid-row: span 2;
  grid-column: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.3;
}
.mega .in.c3 .ft { grid-column: 4; }
.mega .ft a {
  background: #000;
  color: #fff;
  border: 0;
  padding: 12px 16px;
  text-align: center;
  font-weight: 750;
  font-size: 0.95rem;
}
.mega .ft a:hover {
  background: #fff;
  color: #000;
}

/* Rodapé do megamenu com links diretos */
.mega-foot {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 14px 24px;
  display: flex;
  gap: 28px;
  justify-content: center;
  max-width: 1180px;
  margin: 0 auto;
  font-size: 0.85rem;
}
.mega-foot a {
  color: var(--mute);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mega-foot a:hover,
.mega-foot a.is-active { color: var(--red); }

/* ===== BURGER (mobile) ===== */
.burger {
  display: none;
  width: 44px;
  height: 44px;
  background: none;
  border: 2px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 7px 0 currentColor;
  margin-top: -7px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
header.open .burger span {
  transform: rotate(45deg);
  box-shadow: 0 0 0 currentColor;
  margin-top: 0;
}
header.open .burger span::after {
  content: '';
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  transform: rotate(90deg);
  margin-top: -2px;
}

@media (max-width: 940px) {
  .burger { display: flex; }
  nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 24px;
    max-height: calc(100svh - 72px);
    overflow: auto;
  }
  header.open nav { display: flex; }
  nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .mi {
    width: 100%;
    height: 56px;
    padding: 0;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
  }
  .mega {
    position: static;
    visibility: visible;
    opacity: 1;
    transform: none;
    box-shadow: none;
    border: 0;
    display: none;
    transition: none;
  }
  li.open > .mega { display: block; }
  .mega .in,
  .mega .in.c3 {
    grid-template-columns: 1fr;
    padding: 8px 0 16px;
  }
  .mega .ft,
  .mega .in.c3 .ft {
    grid-column: auto;
    grid-row: auto;
    margin-top: 8px;
  }
  .mega-foot {
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 0;
    align-items: flex-start;
  }
  .mega-foot a { font-size: 0.85rem; }
  nav > .btn {
    text-align: center;
    margin-top: 18px;
  }
}

/* ===== CUBO 3D ===== */
.cube {
  position: absolute;
  right: 0;
  top: -8px;
  width: 76px;
  height: 76px;
  transform-style: preserve-3d;
  transform: rotateX(-24deg) rotateY(30deg);
  animation: cube 22s linear infinite;
  z-index: 2;
  pointer-events: none;
}
.cube b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-stretch: 125%;
  font-size: 17px;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--ink);
}
.cube b:nth-child(odd) {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.cube b:nth-child(1) { transform: translateZ(38px); }
.cube b:nth-child(2) { transform: rotateY(90deg) translateZ(38px); }
.cube b:nth-child(3) { transform: rotateY(180deg) translateZ(38px); }
.cube b:nth-child(4) { transform: rotateY(-90deg) translateZ(38px); }
.cube b:nth-child(5) { transform: rotateX(90deg) translateZ(38px); }
.cube b:nth-child(6) { transform: rotateX(-90deg) translateZ(38px); }
@keyframes cube {
  to { transform: rotateX(336deg) rotateY(390deg); }
}

/* ===== STACK 3D (secção vermelha) ===== */
.stack {
  position: absolute;
  right: 9%;
  top: 70px;
  width: 130px;
  height: 130px;
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(62deg) rotateZ(0);
  animation: stk 16s linear infinite;
  pointer-events: none;
}
.stack i {
  position: absolute;
  inset: 0;
  border: 3px solid #000;
  background: rgba(0, 0, 0, 0.16);
}
.stack i:nth-child(2) { transform: translateZ(28px); }
.stack i:nth-child(3) { transform: translateZ(56px); }
.stack i:nth-child(4) { transform: translateZ(84px); background: #000; }
@keyframes stk {
  to { transform: perspective(900px) rotateX(62deg) rotateZ(360deg); }
}
@media (max-width: 700px) {
  .stack { display: none; }
}

/* ===== MARQUEE ===== */
.band {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 26px 0;
}
.track {
  display: flex;
  gap: 56px;
  width: max-content;
  animation: mq 60s linear infinite;
}
.track span {
  font-weight: 900;
  font-stretch: 125%;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--mute);
  white-space: nowrap;
}
.track span:nth-child(3n) { -webkit-text-stroke-color: var(--red); }
@keyframes mq {
  to { transform: translateX(-50%); }
}

/* ===== ANIMAÇÕES DE ENTRADA ===== */
@keyframes up {
  from { opacity: 0; transform: translateY(32px); }
}
.hero h1 { animation: up 1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero .lede { animation: up 1s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero .cta { animation: up 1s 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.wheelbox { animation: up 1.2s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ===== HOVER COM BRILHO ===== */
.models div,
.sv article,
.cols3 > div { position: relative; }
.models div::before,
.sv article::before,
.cols3 > div::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(225, 6, 0, 0.18), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.models div:hover::before,
.sv article:hover::before,
.cols3 > div:hover::before { opacity: 1; }
.models div { transition: border-color 0.2s, transform 0.2s ease-out; }

/* ===== PREFERÊNCIAS ===== */
@media (prefers-reduced-motion: reduce) {
  .spin,
  .cube,
  .stack,
  .track,
  .hero h1,
  .hero .lede,
  .hero .cta,
  .wheelbox { animation: none; }
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}

/* ===== IMPRESSÃO ===== */
@media print {
  header#pmo-header,
  .mega,
  .mega-foot,
  .burger,
  .band { display: none !important; }
  body::after { display: none; }
  body { background: #fff; color: #000; }
}