/* ============ Mei · MathMage ============
   Cores do Carrd da Mei (mathmage.carrd.co):
   fundo #0a0204 com hexágonos #5B1729, quadro branco a 75%, botões #0a0004.
   Fontes: Fredoka (títulos) + Nunito (texto).
   Escala de letra: 13 / 15 / 17 / 20 / 24 px + título da abertura e título de seção.
   Cantos: quadros, molduras, cartões e miniaturas têm os cantos cortados a 45° (--cut-lg/md/sm);
   botões e etiquetas pequenas ficam arredondados (--r-small).
   Cartão só em volta do que é clicável; o resto se separa por espaço e pelo pontilhado do Carrd.
   Hexágono inteiro (mesmo ângulo do fundo) no avatar, nas setas e nos ícones de marca.
*/
:root {
  --night: #0a0204;
  --wine: #5b1729;
  --wine-light: #7d2640;
  --black: #0a0004;
  --card: rgba(255, 255, 255, .75);
  --paper: rgba(255, 255, 255, .9);
  --text: #0a0004;
  --muted: #3e3237;
  --dots: 1px dotted var(--black);
  --white: #ffffff;

  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-title: clamp(30px, 4.2vw, 42px);
  --fs-hero: clamp(36px, 5.6vw, 60px);

  /* cantos cortados a 45°: quadro das seções / molduras e cartões / miniaturas e imagens pequenas */
  --cut-lg: 26px;
  --cut-md: 16px;
  --cut-sm: 10px;
  --cut-xs: 7px;   /* botões e etiquetas */
  --r-small: 6px;
  --hex: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
button { font: inherit; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
[hidden] { display: none !important; }

body {
  margin: 0; color: var(--text); background: var(--night);
  font: 400 var(--fs-md)/1.6 "Nunito", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* hexágonos fixos atrás de tudo, como no Carrd; parados para quem pediu menos movimento */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--night) url("../img/hex-bg.svg") center / cover no-repeat;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { background-image: url("../img/hex-bg-parado.svg"); }
}

h1, h2, h3 { font-family: "Fredoka", "Nunito", sans-serif; line-height: 1.15; margin: 0; }
a { color: var(--wine); }
a:hover { color: var(--wine-light); }
img { max-width: 100%; display: block; }
img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
:focus-visible { outline: 3px solid var(--wine-light); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--white); color: var(--black); padding: 8px 12px; z-index: 100; border-radius: var(--r-small); }
.skip:focus { left: 8px; }

/* ---------- Botões (pretos, como no Carrd) ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: transparent; color: var(--black); border: 2px solid transparent; --line: var(--black);
  font: 600 var(--fs-md)/1.2 "Fredoka", sans-serif; text-decoration: none; cursor: pointer;
  transition: background .1s, color .1s;
}
.btn:hover { background: var(--black); color: var(--white); }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--wine); color: var(--white); --line: var(--wine); }

/* Botões e etiquetas com canto cortado (--cut-xs).
   Os que têm contorno ganham uma "moldura" (::before) no formato do corte, na cor --line,
   porque a borda normal do CSS sumiria nos cantos cortados. */
.btn, .back, .nav > a.other-site, .lang, .hero-cap, .art-cap {
  --cut: var(--cut-xs);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.btn::before, .nav > a.other-site::before, .lang::before {
  content: ""; position: absolute; inset: -2px; pointer-events: none; background: var(--line);
  --b: 2px; --ci: calc(var(--cut) - 1.2px);
  clip-path: polygon(evenodd,
    var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut), var(--cut) 0,
    calc(var(--b) + var(--ci)) var(--b), calc(100% - var(--b) - var(--ci)) var(--b),
    calc(100% - var(--b)) calc(var(--b) + var(--ci)), calc(100% - var(--b)) calc(100% - var(--b) - var(--ci)),
    calc(100% - var(--b) - var(--ci)) calc(100% - var(--b)), calc(var(--b) + var(--ci)) calc(100% - var(--b)),
    var(--b) calc(100% - var(--b) - var(--ci)), var(--b) calc(var(--b) + var(--ci)), calc(var(--b) + var(--ci)) var(--b));
}
.btn:focus-visible, .back:focus-visible, .nav > a.other-site:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }
.btn-small { padding: 7px 14px; font-size: var(--fs-sm); }

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(16px, calc((100% - var(--max)) / 2));
  background: rgba(10, 2, 4, .9);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.topbar :focus-visible { outline-color: var(--white); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font: 700 var(--fs-xl) "Fredoka", sans-serif; }
.brand:hover { color: var(--white); }
.avatar { width: 48px; height: 42px; flex: none; display: grid; place-items: center; background: var(--white); clip-path: var(--hex); }
.avatar img { width: 42px; height: 36px; object-fit: cover; image-rendering: pixelated; clip-path: var(--hex); }
.nav { display: flex; align-items: center; gap: 22px; }
.nav > a { color: var(--white); text-decoration: none; font-weight: 700; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav > a:hover { color: var(--white); border-bottom-color: var(--wine-light); }
.nav > a[aria-current] { border-bottom-color: var(--white); }
.nav > a.other-site { position: relative; border: 2px solid transparent; padding: 4px 12px; --line: rgba(255, 255, 255, .7); }
.nav > a.other-site:hover { background: var(--white); color: var(--black); --line: var(--white); }
.lang { position: relative; display: flex; border: 2px solid transparent; --line: rgba(255, 255, 255, .7); }
.lang button { background: transparent; color: var(--white); border: 0; cursor: pointer; font: 700 var(--fs-xs) "Fredoka", sans-serif; padding: 6px 10px; }
.lang button[aria-pressed="true"] { background: var(--white); color: var(--black); }
.menu-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.menu-toggle span { display: block; width: 24px; height: 3px; background: var(--white); margin: 5px 0; }

/* ---------- Quadros (o cartão translúcido do Carrd) ---------- */
main { padding: 0 16px; }
.hero, .section {
  max-width: var(--max); margin: 32px auto; padding: 48px;
  background: var(--card); --cut: var(--cut-lg);
}

/* Cantos cortados a 45° em quadros, molduras e cartões (os tamanhos ficam no :root).
   --cut = quanto do canto é cortado. Cada elemento abaixo define o seu --cut.
   Molduras com linha preta: o elemento de fora é preto e o de dentro fica 2–3px menor,
   com --cut um pouco menor também, para a linha acompanhar o corte. */
.hero, .section, .hero-stage, .hero-stage::before, .now-frame, .now-img,
.proj-card, .art-tile, .art-tile::before, .game, .lightbox img, .lightbox video {
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.back {
  display: inline-block; margin-bottom: 18px;
  background: var(--black); color: var(--white); text-decoration: none;
  font: 600 var(--fs-xs) "Fredoka", sans-serif; padding: 5px 14px;
}
.back:hover { background: var(--wine); color: var(--white); }

/* ---------- Abertura ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; margin-top: 40px; }
.hero.no-art { grid-template-columns: 1fr; }
.hello { font: 600 var(--fs-lg) "Fredoka", sans-serif; color: var(--wine); margin: 0 0 10px; }
.hero h1 { font-size: var(--fs-hero); font-weight: 700; }
.lead { font-size: var(--fs-lg); color: var(--muted); max-width: 34em; margin: 18px 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-stage {
  position: relative; aspect-ratio: 1 / 1; max-width: 400px; width: 100%; justify-self: center;
  display: block; overflow: hidden;
  /* moldura: fundo preto por fora e o "papel" 2px para dentro */
  background: var(--black); --cut: var(--cut-md);
}
.hero-stage::before { content: ""; position: absolute; inset: 2px; background: var(--paper); --cut: calc(var(--cut-md) - 1px); }
.hero-stage:hover, .hero-stage:focus-visible { background: var(--wine); outline: none; }
.hero-stage img { position: relative; width: 100%; height: 100%; object-fit: contain; padding: 14px 14px 44px; }
.hero-cap {
  position: absolute; left: 14px; bottom: 12px;
  background: var(--black); color: var(--white);
  font: 600 var(--fs-xs) "Fredoka", sans-serif; padding: 4px 12px;
}

.now { grid-column: 1 / -1; display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; border-top: var(--dots); padding-top: 22px; }
.now-frame { display: block; background: var(--black); padding: 2px; --cut: var(--cut-sm); }
.now-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; --cut: calc(var(--cut-sm) - 1px); }
.now-label { margin: 0 0 2px; font: 600 var(--fs-xs) "Fredoka", sans-serif; color: var(--wine); }
.now h2 { font-size: var(--fs-lg); margin-bottom: 4px; }
.now p:last-child { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.hero.no-art .now { max-width: 760px; }

/* ---------- Seções ---------- */
.section-head { margin-bottom: 28px; padding-bottom: 22px; border-bottom: var(--dots); }
.section-head h1 { font-size: var(--fs-title); }
.section-head p { color: var(--muted); margin: 10px 0 0; font-size: var(--fs-md); max-width: 46em; }
.note { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0 14px; }
.note.center { text-align: center; margin-top: 24px; }

/* ---------- Arte: projetos (clicáveis, então são cartões) ---------- */
.art-sub { font-size: var(--fs-lg); margin: 0 0 12px; }
.art-projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 18px; }
.proj-card {
  display: flex; flex-direction: column; padding: 0; cursor: pointer; text-align: left;
  border: 2px solid var(--black); overflow: hidden;
  background: var(--black); color: var(--white); --cut: var(--cut-md);
}
/* a capa corta só em cima, um pouco menos que o cartão, para a linha da borda aparecer no corte */
.proj-card img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #f4eff1;
  --c: calc(var(--cut-md) - 3px);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%, 0 var(--c));
}
.proj-card:focus-visible { outline: none; }
.proj-info { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.proj-info strong { font: 600 var(--fs-lg) "Fredoka", sans-serif; }
.proj-info span { font-size: var(--fs-sm); color: rgba(255, 255, 255, .78); }
.proj-info .proj-count { font: 600 var(--fs-xs) "Fredoka", sans-serif; color: rgba(255, 255, 255, .62); }
.proj-card:hover, .proj-card:focus-visible, .proj-card[aria-expanded="true"] { background: var(--wine); border-color: var(--wine); }
.proj-open { margin: 0 0 28px; padding-bottom: 22px; border-bottom: var(--dots); }

/* ---------- Arte: categorias (linhas com o pontilhado do Carrd) ---------- */
.bands { border-top: var(--dots); }
.band { border-bottom: var(--dots); }
.band-head {
  width: 100%; display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 12px 4px; border: 0; background: transparent; color: var(--black); text-align: left;
}
.band-name { flex: 1; font: 600 var(--fs-xl)/1.2 "Fredoka", sans-serif; }
.band-count { font: 600 var(--fs-xs) "Fredoka", sans-serif; color: var(--muted); }
.band-arrow { width: 34px; height: 30px; background: var(--black); flex: none; display: grid; place-items: center; clip-path: var(--hex); }
.band-arrow::before {
  content: ""; width: 8px; height: 8px; border-right: 2.5px solid var(--white); border-bottom: 2.5px solid var(--white);
  transform: translateY(-2px) rotate(45deg);
}
.band-head:hover .band-name { color: var(--wine); }
.band.open .band-arrow { background: var(--wine); }
.band.open .band-arrow::before { transform: translateY(2px) rotate(-135deg); }
.band-body { padding: 4px 0 20px; }

/* a arte inteira, sem corte; o título aparece ao passar o mouse */
.art-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.art-tile {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; padding: 6px; border: 0;
  overflow: hidden; cursor: zoom-in; background: #f1ecee; --cut: var(--cut-sm);
}
/* fundo claro por dentro; ao passar o mouse, o de fora fica preto e vira uma borda que acompanha o corte */
.art-tile::before { content: ""; position: absolute; inset: 3px; background: #f1ecee; --cut: calc(var(--cut-sm) - 2px); }
.art-tile img, .art-tile video { position: relative; width: 100%; height: 100%; object-fit: contain; }
.art-tile:hover, .art-tile:focus-visible { background: var(--black); outline: none; }
.art-cap {
  position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px);
  background: var(--black); color: var(--white); padding: 3px 10px;
  font: 600 var(--fs-xs) "Fredoka", sans-serif; text-align: left; opacity: 0;
}
.art-tile:hover .art-cap, .art-tile:focus-visible .art-cap { opacity: 1; }
@media (hover: none) { .art-cap { opacity: 1; } }

/* ---------- Tela cheia ---------- */
.lightbox {
  border: 0; padding: 0; background: transparent; color: var(--white);
  position: fixed; inset: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none;
}
.lightbox[open] { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox::backdrop { background: rgba(10, 2, 4, .92); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; grid-column: 2; }
.lightbox img, .lightbox video { max-height: 80vh; max-width: 100%; width: auto; object-fit: contain; --cut: var(--cut-sm); }
.lightbox img { min-width: min(480px, 100%); }
.lightbox figcaption { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 46em; padding: 0 8px; }
.lightbox figcaption strong { font: 600 var(--fs-lg) "Fredoka", sans-serif; }
.lightbox figcaption span { font-size: var(--fs-sm); color: rgba(255, 255, 255, .8); }
.lightbox button {
  background: var(--white); color: var(--black); border: 0; cursor: pointer;
  width: 56px; height: 48px; padding: 0; justify-self: center; display: grid; place-items: center;
  clip-path: var(--hex);
}
.lightbox button svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.lightbox button:hover, .lightbox button:focus-visible { background: var(--wine); color: var(--white); outline: none; }
.lb-close { position: absolute; top: 16px; right: 16px; }
.lb-prev { grid-column: 1; grid-row: 1; }
.lb-next { grid-column: 3; grid-row: 1; }

/* ---------- Jogos (o cartão leva ao itch.io) ---------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.game { background: var(--paper); overflow: hidden; display: flex; flex-direction: column; --cut: var(--cut-md); }
.game-cover { aspect-ratio: 4 / 3; background: #f1ecee; overflow: hidden; }
.game-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-body h3 { font-size: var(--fs-lg); }
.game-body p { margin: 0; color: var(--muted); font-size: var(--fs-sm); flex: 1; }
.game-body .meta { flex: none; font-size: var(--fs-xs); font-weight: 700; color: var(--wine); }
.game-body .btn { align-self: flex-start; margin-top: 4px; }

/* ---------- Dev (sem caixas: espaço e pontilhado) ---------- */
.dev-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 48px; align-items: start; }
.dev-about p { margin: 0 0 16px; }
.dev-about h3 { font-size: var(--fs-lg); margin: 24px 0 8px; }
.stack { margin: 0 0 24px; font-weight: 700; line-height: 1.8; }
.projects { list-style: none; margin: 0; padding: 0; }
.project { padding: 18px 0; border-bottom: var(--dots); }
.project:first-child { padding-top: 0; }
.project:last-child { border-bottom: 0; }
.project h3 { font-size: var(--fs-lg); }
.project p { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.project .tech { color: var(--wine); font-size: var(--fs-xs); font-weight: 700; }

/* ---------- Encomendas (sem caixas) ---------- */
.com-note { margin: 0 0 24px; }
.com-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-bottom: 32px; padding-bottom: 28px; border-bottom: var(--dots); }
.way h3, .price-block h3 { font-size: var(--fs-lg); margin-bottom: 6px; }
.way p { color: var(--muted); margin: 0 0 16px; }
.prices { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
th { text-align: left; font: 600 var(--fs-xs) "Fredoka", sans-serif; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--black); }
td { padding: 10px 8px; border-bottom: var(--dots); }
td:nth-child(2) { color: var(--wine); font-weight: 800; white-space: nowrap; }
th:last-child, td:last-child { text-align: right; }
tr:last-child td { border-bottom: 0; }
.rules-title { font-size: var(--fs-xl); margin: 40px 0 8px; padding-top: 28px; border-top: var(--dots); }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; margin: 0; }
.rule { padding: 12px 0; border-bottom: var(--dots); }
.rule dt { font: 600 var(--fs-md) "Fredoka", sans-serif; }
.rule dd { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Contato (lista; ícone só nas marcas) ---------- */
.links { list-style: none; margin: -12px 0 0; padding: 0; }
.links li { border-bottom: var(--dots); }
.link-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; text-decoration: none; color: var(--black); }
.link-row:hover strong { color: var(--wine); }
.link-text { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; }
.link-text strong { font: 600 var(--fs-lg) "Fredoka", sans-serif; }
.link-text span { color: var(--muted); font-size: var(--fs-sm); }
.link-icon { width: 40px; height: 35px; flex: none; display: grid; place-items: center; background: var(--black); clip-path: var(--hex); }
.link-icon.empty { background: transparent; }
.link-icon img { width: 20px; height: 20px; filter: invert(1); }
.link-icon img.photo { width: 34px; height: 30px; object-fit: cover; filter: none; clip-path: var(--hex); }

.footer { text-align: center; color: rgba(255, 255, 255, .75); font-size: var(--fs-xs); padding: 16px 16px 40px; }
.footer p { margin: 0; }
.footer .fanart { margin-top: 4px; color: rgba(255, 255, 255, .6); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-stage { max-width: 340px; justify-self: start; }
  .dev-grid, .com-ways, .prices { grid-template-columns: 1fr; gap: 28px; }
  .rules { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--night); border-bottom: 1px solid rgba(255, 255, 255, .12); padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav > a { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .nav > a.other-site { margin-top: 12px; text-align: center; }
  .lang { align-self: flex-start; margin-top: 16px; }
  main { padding: 0 10px; }
  .hero, .section { padding: 32px 20px; margin: 20px auto; --cut: var(--cut-md); }
  .now { grid-template-columns: 1fr; }
  .art-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .art-cap { left: 6px; bottom: 6px; }
  .lightbox[open] { grid-template-columns: 50px 1fr 50px; }
  .lightbox button { width: 46px; height: 40px; }
  th, td { padding: 8px 5px; }
}
