/* Onzetec Games — site oficial.
   CSS moderno sem build: variáveis, aninhamento, oklch, container queries, :has(),
   transições entre páginas (View Transitions) e animações ao rolar (scroll-driven). */

@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  --navy: #011c38;
  --bg: #070b16;
  --bg-2: #0d1426;
  --card: #121a30;
  --card-2: #18223d;
  --line: #24304f;
  --text: #eef1f8;
  --muted: #a6afc6;
  --orange: #ff7a1a;
  --orange-2: #ffb547;
  --cyan: #3fd0e0;
  --violet: #8b6cff;
  --green: #5bd68a;
  --radius: 16px;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --sans: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 18px 50px -20px rgb(0 0 0 / 0.7);
  --glow: 0 0 0 1px oklch(0.75 0.17 50 / 0.5), 0 10px 40px -10px oklch(0.72 0.19 50 / 0.6);
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.35 0.12 270 / 0.45), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, oklch(0.45 0.16 45 / 0.22), transparent 60%),
    var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Linhas de TV antiga (CRT) por cima de tudo, bem leves. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(to bottom, rgb(255 255 255 / 0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

img { max-width: 100%; display: block; }
a { color: var(--orange-2); text-underline-offset: 3px; }
a:hover { color: var(--orange); }
code, kbd {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  word-break: break-word;
}
kbd { border-bottom-width: 3px; }

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }

.pixel { font-family: var(--pixel); letter-spacing: 0.02em; line-height: 1.5; }

h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h2.section-title {
  font-family: var(--pixel);
  font-size: clamp(1.05rem, 2.6vw, 1.6rem);
  margin: 0 0 8px;
  color: var(--text);
  text-shadow: 3px 3px 0 oklch(0.55 0.2 40 / 0.6);
}
.section-sub { color: var(--muted); margin: 0 0 32px; max-width: 62ch; }

/* ------------------------------------------------------------ topo */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.3);
  background: rgb(7 11 22 / 0.72);
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
  view-transition-name: topbar;

  & .wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; }
  & .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
  & .brand img { height: 34px; width: auto; }
  & .brand span { font-family: var(--pixel); font-size: 0.72rem; }
  & nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
  & nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
  }
  & nav a:hover, & nav a[aria-current="page"] { color: var(--text); background: var(--card-2); }
}

.sound-toggle {
  margin-left: 4px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  height: 40px;
  min-width: 40px;
  cursor: pointer;
  font-size: 1rem;
  &[aria-pressed="true"] { border-color: var(--orange); box-shadow: var(--glow); }
}

@media (max-width: 720px) {
  .topbar .brand span { display: none; }
  .topbar nav a { padding: 8px 8px; font-size: 0.92rem; }
}

/* ------------------------------------------------------------ botões */
.btn {
  --b: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 14px;
  text-decoration: none;
  color: #1f0a00;
  background: var(--b);
  font-weight: 700;
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 0 oklch(0.5 0.17 45), var(--shadow);
  transform: translateY(0);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s, filter 0.2s;

  &:hover { transform: translateY(-3px); color: #1f0a00; filter: brightness(1.06); box-shadow: 0 9px 0 oklch(0.5 0.17 45), var(--shadow); }
  &:active { transform: translateY(4px); box-shadow: 0 2px 0 oklch(0.5 0.17 45); }
  &:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
  & .ico { font-size: 1.5rem; line-height: 1; }
  & small { display: block; font-weight: 500; opacity: 0.75; font-size: 0.78rem; }

  &.ghost {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: 0 6px 0 #050812, var(--shadow);
    &:hover { color: var(--text); border-color: var(--orange); }
  }
  &.cyan { --b: var(--cyan); color: #00262b; box-shadow: 0 6px 0 oklch(0.55 0.1 210), var(--shadow); }
  &.violet { --b: var(--violet); color: #fff; box-shadow: 0 6px 0 oklch(0.45 0.17 290), var(--shadow); }
  &.small { padding: 9px 14px; font-size: 0.92rem; border-radius: 11px; }
}

/* ------------------------------------------------------------ hero */
.hero {
  position: relative;
  padding: clamp(48px, 9vw, 110px) 0 60px;
  overflow: clip;

  & .grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
  & .logo { width: min(420px, 90%); filter: drop-shadow(0 16px 40px rgb(255 122 26 / 0.35)); animation: float 6s ease-in-out infinite; }
  & h1 {
    font-family: var(--pixel);
    font-size: clamp(1.25rem, 3.6vw, 2.3rem);
    margin: 28px 0 16px;
    text-shadow: 4px 4px 0 oklch(0.55 0.2 40 / 0.55);
  }
  & .lead { color: var(--muted); font-size: 1.12rem; max-width: 52ch; margin: 0 0 30px; }
  & .ctas { display: flex; flex-wrap: wrap; gap: 14px; }
  & .note { color: var(--muted); font-size: 0.88rem; margin-top: 18px; }
}

@media (max-width: 900px) {
  .hero .grid { grid-template-columns: 1fr; }
  .hero .tv { order: -1; }
}

@keyframes float { 50% { transform: translateY(-10px); } }

/* TV de tubo com as capas dos consoles passando. */
.tv {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 34px;
  padding: 26px;
  background: linear-gradient(145deg, #2b2f3d, #12141c);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.08), 0 30px 70px -20px rgb(0 0 0 / 0.9);
  rotate: -2deg;
  transition: rotate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  &:hover { rotate: 0deg; }

  & .screen {
    position: relative;
    height: 100%;
    border-radius: 26px / 34px;
    overflow: hidden;
    background: #000;
    box-shadow: inset 0 0 60px rgb(0 0 0 / 0.9);
  }
  & .screen img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    scale: 1.06;
    transition: opacity 0.9s ease, scale 6s linear;
  }
  & .screen img.on { opacity: 1; scale: 1; }
  & .screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      repeating-linear-gradient(to bottom, rgb(0 0 0 / 0.28) 0 2px, transparent 2px 4px),
      radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 0.65));
    pointer-events: none;
  }
  & .label {
    position: absolute;
    left: 50%;
    bottom: -14px;
    translate: -50% 0;
    background: var(--orange);
    color: #1f0a00;
    font-family: var(--pixel);
    font-size: 0.62rem;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 0 oklch(0.5 0.17 45);
  }
}

/* ------------------------------------------------------------ seções */
section { padding: 70px 0; }
.band { background: linear-gradient(180deg, transparent, rgb(255 255 255 / 0.025) 30%, transparent); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
}

.card {
  container-type: inline-size;
  position: relative;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.25s;

  &:hover { transform: translateY(-6px) rotate(-0.4deg); border-color: oklch(0.72 0.19 50 / 0.6); }
  & h3 { margin: 10px 0 6px; font-size: 1.2rem; }
  & p { margin: 0; color: var(--muted); }
  & .emoji { font-size: 2rem; }
  & .tag {
    display: inline-block;
    font-family: var(--pixel);
    font-size: 0.55rem;
    padding: 6px 8px;
    border-radius: 6px;
    background: oklch(0.72 0.19 50 / 0.18);
    color: var(--orange-2);
  }
}

/* Cards de download (os três "cartuchos"). */
.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 22px;
}
.cart {
  --c: var(--orange);
  position: relative;
  border-radius: 18px 18px 26px 26px;
  padding: 30px 24px 26px;
  background: linear-gradient(180deg, color-mix(in oklch, var(--c) 22%, var(--card)), var(--card));
  border: 2px solid color-mix(in oklch, var(--c) 55%, transparent);
  box-shadow: 0 8px 0 color-mix(in oklch, var(--c) 40%, #000), var(--shadow);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  &:hover { transform: translateY(-8px); }
  &.recommended { outline: 3px dashed color-mix(in oklch, var(--c) 80%, white); outline-offset: 6px; }
  &.recommended::before {
    content: "Recomendado para você";
    position: absolute;
    top: -14px;
    right: 18px;
    background: var(--c);
    color: #111;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
  }
  /* "Encaixe" do cartucho no topo. */
  &::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    translate: -50% 0;
    width: 40%;
    height: 10px;
    border-radius: 0 0 10px 10px;
    background: color-mix(in oklch, var(--c) 45%, #000);
  }
  & .big { font-size: 2.6rem; }
  & h3 { font-family: var(--pixel); font-size: 0.95rem; margin: 14px 0 10px; line-height: 1.6; }
  & p { color: var(--muted); margin: 0 0 18px; }
  & ul { color: var(--muted); padding-left: 18px; margin: 0 0 20px; }
  & .btn { width: 100%; justify-content: center; }
  &.tv { --c: var(--orange); }
  &.phone { --c: var(--cyan); }
  &.web { --c: var(--violet); }
}

.copy-line {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0 0;
  & code { flex: 1; padding: 8px 10px; }
  & button {
    border: 1px solid var(--line);
    background: var(--card-2);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
  }
}

/* Consoles: grade com as capas. */
.consoles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 16px;
  & figure {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
    &:hover { transform: scale(1.05) rotate(-1deg); box-shadow: var(--glow); }
  }
  & img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
  & figcaption { padding: 10px 12px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
  & figcaption small { color: var(--muted); font-weight: 400; }
}

/* Passos numerados. */
.steps {
  counter-reset: step;
  display: grid;
  gap: 14px;
  padding: 0;
  list-style: none;
  & li {
    counter-increment: step;
    position: relative;
    padding: 16px 18px 16px 64px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  & li::before {
    content: counter(step);
    position: absolute;
    left: 16px;
    top: 14px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font-family: var(--pixel);
    font-size: 0.8rem;
    border-radius: 9px;
    background: var(--orange);
    color: #1f0a00;
    box-shadow: 0 3px 0 oklch(0.5 0.17 45);
  }
}

.callout {
  border-left: 4px solid var(--orange);
  background: oklch(0.72 0.19 50 / 0.08);
  padding: 14px 18px;
  border-radius: 0 12px 12px 0;
  margin: 18px 0;
  &.info { border-color: var(--cyan); background: oklch(0.8 0.12 200 / 0.08); }
  &.warn { border-color: #ff6b6b; background: oklch(0.65 0.2 25 / 0.1); }
  & p { margin: 0; }
}

/* ------------------------------------------------------------ manual */
.manual {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 40px 0 80px;

  & aside { position: sticky; top: 88px; align-self: start; max-height: calc(100dvh - 110px); overflow: auto; }
  & aside nav { display: grid; gap: 2px; }
  & aside a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.94rem;
    border-left: 2px solid transparent;
    &.active { color: var(--text); background: var(--card); border-left-color: var(--orange); }
    &.sub { padding-left: 22px; font-size: 0.88rem; }
  }
  & article { min-width: 0; }
  & article h2 {
    font-family: var(--pixel);
    font-size: clamp(0.95rem, 2.2vw, 1.25rem);
    margin: 56px 0 14px;
    padding-top: 6px;
    color: var(--orange-2);
  }
  & article h2:first-child { margin-top: 0; }
  & article h3 { margin: 28px 0 8px; font-size: 1.15rem; }
  & dl { display: grid; grid-template-columns: minmax(160px, 30%) 1fr; gap: 0; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  & dt, & dd { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); }
  & dt { font-weight: 600; background: var(--card); }
  & dd { color: var(--muted); background: var(--bg-2); }
  & dl > :nth-child(1), & dl > :nth-child(2) { border-top: 0; }
  & table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.95rem; }
  & th, & td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
  & th { color: var(--muted); font-weight: 600; }
  & .table-scroll { overflow-x: auto; }
}

@media (max-width: 900px) {
  .manual { grid-template-columns: 1fr; }
  .manual aside { position: static; max-height: none; }
  .manual aside nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding-bottom: 6px; }
  .manual aside a.sub { display: none; }
  .manual dl { grid-template-columns: 1fr; }
  .manual dd { border-top: 0; }
}

/* ------------------------------------------------------------ jogos */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
  &:hover { transform: translateY(-2px); }
  &[aria-pressed="true"] { background: var(--orange); color: #1f0a00; border-color: var(--orange); font-weight: 600; }
}
.search {
  width: 100%;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  margin-bottom: 14px;
  &:focus { outline: 2px solid var(--orange); }
}
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 18px;
}
.game {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  &:hover { transform: translateY(-5px); }
  & .cover { aspect-ratio: 4 / 3; background: var(--bg-2); object-fit: cover; width: 100%; }
  & .body { padding: 12px 14px 14px; display: grid; gap: 6px; flex: 1; }
  & h3 { margin: 0; font-size: 1.02rem; }
  & .meta { color: var(--muted); font-size: 0.85rem; }
  & .btn { margin-top: auto; justify-content: center; }
}
.console-packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px; margin-bottom: 30px; }
.empty {
  text-align: center;
  padding: 50px 20px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  & .big { font-size: 3rem; }
}

/* ------------------------------------------------------------ rodapé */
footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 60px;
  color: var(--muted);
  font-size: 0.92rem;
  & .wrap { display: grid; gap: 14px; }
  & .made { font-family: var(--pixel); font-size: 0.7rem; color: var(--text); }
  & nav { display: flex; gap: 16px; flex-wrap: wrap; }
}

/* ------------------------------------------------------------ animações ao rolar */
@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }
  @keyframes reveal {
    from { opacity: 0; translate: 0 40px; scale: 0.97; }
    to { opacity: 1; translate: 0 0; scale: 1; }
  }
}

/* Konami: "+30 vidas" */
.konami-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  display: grid;
  place-items: center;
  font-family: var(--pixel);
  font-size: clamp(1.2rem, 5vw, 3rem);
  color: var(--orange-2);
  text-shadow: 4px 4px 0 #000;
  animation: burst 2.2s ease-out forwards;
}
@keyframes burst {
  0% { opacity: 0; scale: 0.4; }
  20% { opacity: 1; scale: 1.15; }
  70% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 1.4; }
}
.pixel-confetti { position: fixed; width: 10px; height: 10px; z-index: 199; pointer-events: none; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { translate: var(--dx) 105vh; rotate: var(--rot); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Blocos de código e o sumário não podem alargar a página no celular. */
pre { overflow-x: auto; max-width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
pre code { background: none; border: 0; padding: 0; word-break: normal; }
.manual aside { min-width: 0; }

/* Ajustes: imagens com width/height no HTML seguem a proporção do CSS. */
.consoles img, .tv .screen img, .game .cover { height: auto; }
.tv .screen img { height: 100%; }

@media (max-width: 560px) {
  .topbar .wrap { gap: 8px; min-height: 58px; }
  .topbar .brand img { height: 26px; }
  .topbar nav { flex-wrap: nowrap; gap: 0; }
  .topbar nav a { padding: 6px 7px; font-size: 0.86rem; }
  .sound-toggle { height: 34px; min-width: 34px; }
  .hero .logo { width: min(220px, 55%); }
  .hero .tv { padding: 16px; border-radius: 24px; }
}
.consoles figcaption small { white-space: nowrap; }
