*{box-sizing:border-box}
:root{--bg:#090b10;--panel:#151923;--panel2:#0f1219;--border:#292e3d;--text:#f5f5f7;--muted:#aeb7c9;--purple:#823cff}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);font-family:Arial,Helvetica,sans-serif}
a{color:inherit;text-decoration:none}

/* CABEÇALHO */
.site-header{min-height:90px;padding:0 max(24px,calc((100% - 1280px)/2));display:flex;align-items:center;justify-content:space-between;background:var(--panel2);border-bottom:1px solid #222633}
.logo{font-size:34px;font-weight:800;letter-spacing:-1.5px}
.logo span{color:var(--purple)}

/* HOME */
.home{width:min(1180px,calc(100% - 40px));margin:auto}
.hero{text-align:center;padding:52px 20px 42px}
.hero h1{font-size:clamp(34px,4vw,48px);margin:0 0 14px}
.hero p{max-width:760px;margin:auto;color:var(--muted);font-size:17px;line-height:1.55}
.section-heading{margin:0 0 20px}
.section-heading h2{margin:0;font-size:28px}

/* POSTS */
.posts,.archive-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;width:100%;align-items:stretch}
.posts{padding-bottom:50px}
.archive-grid{padding-bottom:40px}
.post-card{min-width:0;display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:16px;overflow:hidden}
.post-card img{display:block;width:100%;height:290px;object-fit:contain;object-position:center;background:#0b0e14;border-radius:11px;margin:0 0 14px}
.post-card h2{font-size:20px;line-height:1.3;margin:0 0 10px}
.post-card p{color:#bcc3d5;font-size:14px;line-height:1.55;margin:0 0 16px}
.post-card .button{margin-top:auto;align-self:flex-start}

/* BOTÕES */
.button{display:inline-block;border:0;border-radius:9px;padding:12px 18px;background:var(--purple);color:#fff;font-weight:700;cursor:pointer;transition:.2s ease}
.button:hover{filter:brightness(.92);transform:translateY(-1px)}
.button.secondary{background:#252b39}
.button.small{padding:9px 13px;font-size:14px}
.button.full{width:100%;margin-top:25px}

/* POSTS ANTIGOS */
.old-posters{width:100%;display:flex;justify-content:center;align-items:center;padding:8px 0 60px}
.old-posters .button{display:inline-flex;align-items:center;justify-content:center;padding:14px 24px;background:#252b39;border:1px solid #353b4c}
.old-posters .button:hover{background:var(--purple);border-color:var(--purple)}
.archive-heading{padding:48px 0 26px}
.archive-heading h1{font-size:40px;margin:0 0 10px}
.archive-heading p{color:var(--muted);font-size:17px}
.pagination{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;padding:10px 0 70px}
.pagination a{border:1px solid var(--border);background:var(--panel);padding:10px 14px;border-radius:8px;color:#cbd2e2}
.pagination a.active,.pagination a:hover{background:var(--purple);color:#fff;border-color:var(--purple)}

/* PUBLICAÇÃO */
.article{width:min(950px,calc(100% - 40px));margin:auto;padding:58px 0 90px}
.article>h1{font-size:clamp(34px,4.5vw,52px);line-height:1.08;margin:0 0 18px}
.article-excerpt{color:#bcc3d5;font-size:19px;line-height:1.6;margin-bottom:32px}
.article>.cover-image{display:none!important}
.article-content h2{margin:46px 0 16px;font-size:30px}
.article-text{color:#d4d8e2;font-size:18px;line-height:1.8;margin:22px 0 34px}
.article-image-block{width:100%;margin:30px 0 40px;text-align:center}
.article-image-block img{display:block;width:auto;max-width:100%;height:auto;max-height:700px;object-fit:contain;margin:0 auto;border-radius:14px}
.youtube-wrapper{position:relative;width:100%;aspect-ratio:16/9;margin:26px 0 38px;background:#000;border-radius:16px;overflow:hidden}
.youtube-wrapper iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.video-error{color:#ff7777}
.not-found{min-height:70vh;display:grid;place-content:center;text-align:center;gap:20px}

/* RODAPÉ */
.site-footer{padding:30px;text-align:center;color:#7f8aa2;background:var(--panel2);border-top:1px solid #222633}

/* ADMIN */
.admin-body{min-height:100vh;background:var(--bg)}
.admin-top{min-height:80px;padding:15px 35px;background:var(--panel2);border-bottom:1px solid #252a36;display:flex;align-items:center;justify-content:space-between;gap:20px}
.admin-top nav{display:flex;gap:22px;align-items:center}
.admin-top nav a{color:#cbd2e2}
.admin-main{width:min(1150px,calc(100% - 40px));margin:auto;padding:45px 0 80px}
.admin-heading{display:flex;justify-content:space-between;gap:25px;align-items:center;margin-bottom:30px}
.admin-heading h1{margin:0 0 8px}
.admin-heading p,.muted{color:#9ca5b8}
.editor{display:grid;gap:25px}
.editor-card,.admin-card{background:var(--panel);border:1px solid var(--border);border-radius:18px;padding:30px}
.login-card{width:min(450px,calc(100% - 40px));margin:100px auto}
.login-card .logo{margin-bottom:20px}

/* FORMULÁRIOS */
label{display:block;margin:18px 0 8px;color:#cbd2e2;font-weight:700}
input,textarea,select{width:100%;border:1px solid #353b4c;background:#0e1118;color:var(--text);border-radius:9px;padding:13px 14px;font:inherit;outline:none}
textarea{resize:vertical}
input:focus,textarea:focus,select:focus{border-color:var(--purple)}
.alert{padding:15px 18px;border-radius:10px;margin-bottom:20px}
.alert.success{background:#173c2b;color:#9bf0bd}
.alert.error{background:#431d26;color:#ffabb9}
.back-link{display:block;text-align:center;margin-top:20px;color:#9ca5b8}

/* EDITOR */
.section-title-row{display:flex;justify-content:space-between;gap:25px;align-items:center;margin-bottom:25px}
.section-title-row h2{margin:0 0 7px}
.section-title-row p{margin:0;color:#929bad}
.add-buttons{display:flex;gap:8px;flex-wrap:wrap}
.block{background:#0d1017;border:1px solid #303647;border-radius:13px;padding:18px;margin-bottom:15px}
.block-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.block-controls button{background:#242a38;color:#fff;border:0;border-radius:7px;padding:7px 10px;margin-left:4px;cursor:pointer}
.block-controls button:hover{background:var(--purple)}
.block small{display:block;margin-top:8px;color:#8791a6}
.block[data-type="image"]{border-color:#49366e}
.block[data-type="image"] small{color:#aeb7c9}
.empty-blocks{text-align:center;padding:35px;color:#7f899e;border:1px dashed #353b4c;border-radius:12px}
.save-button{justify-self:start}

/* LISTA ADMIN */
.post-list{display:grid;gap:12px}
.post-row{padding:20px;border-radius:12px;background:#0d1017;border:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;gap:20px}
.post-row h2{margin:0 0 8px;font-size:20px}
.post-info span{font-size:13px}
.status.published{color:#8ee6b0}
.status.draft{color:#ffc56b}
.row-actions{display:flex;gap:12px;align-items:center}
.row-actions a{color:#a978ff}
.row-actions .danger{color:#ff7188}

/* SETA VOLTAR AO TOPO */
.scroll-top{
  position:fixed;
  right:28px;
  bottom:90px;
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border:1px solid rgba(130,60,255,.55);
  border-radius:50%;
  background:rgba(15,18,25,.94);
  color:transparent;
  font-size:0;
  cursor:pointer;
  z-index:9999;
  opacity:0;
  visibility:hidden;
  transform:translateY(8px);
  box-shadow:0 8px 24px rgba(0,0,0,.35),0 0 16px rgba(130,60,255,.18);
  transition:opacity .25s ease,transform .25s ease,background .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.scroll-top::before{
  content:"";
  width:11px;
  height:11px;
  border-top:3px solid #fff;
  border-left:3px solid #fff;
  transform:rotate(45deg) translate(2px,2px);
}
.scroll-top.show{opacity:.9;visibility:visible;transform:translateY(0)}
.scroll-top:hover{
  opacity:1;
  background:var(--purple);
  border-color:#a77aff;
  transform:translateY(-3px);
  box-shadow:0 10px 28px rgba(0,0,0,.4),0 0 22px rgba(130,60,255,.4);
}

/* RESPONSIVO */
@media(max-width:700px){
  .site-header{min-height:72px;padding-left:20px;padding-right:20px}
  .logo{font-size:27px}
  .hero{padding:36px 15px 30px}
  .hero h1{font-size:32px}
  .posts,.archive-grid{grid-template-columns:1fr;gap:18px}
  .post-card img{height:270px}
  .article{padding-top:44px}
  .article-image-block{margin:25px 0 35px}
  .admin-heading,.section-title-row,.post-row{flex-direction:column;align-items:stretch}
  .admin-top{padding:15px 20px}
  .admin-top nav{flex-wrap:wrap;gap:12px}
  .row-actions{flex-wrap:wrap}
  .scroll-top{right:18px;bottom:70px;width:44px;height:44px}
}


/* ===== UPLOAD DE IMAGEM NO PAINEL ===== */
.image-upload-field{
  display:grid;
  gap:12px;
}
.image-upload-field input[type="file"]{
  cursor:pointer;
}
.admin-image-preview{
  display:block;
  width:auto;
  max-width:100%;
  max-height:240px;
  object-fit:contain;
  margin:0 auto 8px;
  border-radius:10px;
  background:#090b10;
}

/* Imagens inseridas no conteúdo: proporcionais e sem corte */
.article-image-block img{
  display:block;
  width:auto;
  max-width:100%;
  height:auto;
  max-height:720px;
  object-fit:contain;
  object-position:center;
  margin:0 auto;
  border-radius:14px;
}


/* ===== UPLOAD E PRÉVIA DA CAPA ===== */
.cover-upload-field,.image-upload-field{display:grid;gap:12px}
.cover-upload-field input[type="file"],.image-upload-field input[type="file"]{cursor:pointer}
.cover-preview-box,.block-image-preview-box{
  width:100%;
  min-height:150px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#090b10;
  border:1px dashed #353b4c;
  border-radius:12px;
  color:#7f899e;
}
.cover-preview-box{min-height:220px}
.cover-preview-box.is-empty,.block-image-preview-box.is-empty{background:#0d1017}
.admin-cover-preview{
  display:block;
  width:100%;
  max-width:760px;
  max-height:420px;
  height:auto;
  object-fit:contain;
  object-position:center;
  margin:auto;
}
.admin-image-preview{
  display:block;
  width:auto;
  max-width:100%;
  max-height:300px;
  height:auto;
  object-fit:contain;
  object-position:center;
  margin:auto;
}
.cover-preview-box span,.block-image-preview-box span{padding:24px;text-align:center}

@media(max-width:700px){
  .cover-preview-box{min-height:170px}
  .admin-cover-preview{max-height:320px}
  .admin-image-preview{max-height:240px}
}