/* style.css — completo e corrigido
   - Rubricas: desktop 4+3 (3 entre os 4 de cima)
   - Mobile: 2 por linha com o 7º centrado entre os 2 primeiros
   - About: imagem escala verticalmente para acomodar o texto
   - Botões "Voltar" e meta-bar centrados
*/

/* Reset básico */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Variáveis */
:root{
  --bg-gradient: linear-gradient(135deg,#0d0d0d,#1a1a1a,#000);
  --muted: #ddd;
  --text: #f5f5f5;
  --overlay-bg: rgba(13,13,13,0.45);
  --about-max-width: 900px;
  --content-width: 740px;
  --rubrica-gap-row: 18px;
  --rubrica-gap-col: 28px;
}

/* Base */
html,body{height:100%}
body{
  font-family: "Inter", sans-serif;
  background:var(--bg-gradient);
  color:var(--text);
  line-height:1.6;
  padding:20px;
  -webkit-font-smoothing:antialiased;
}

/* Header */
header{ text-align:center; margin-bottom:40px }
.logo{ width:200px; border-radius:8px; margin-bottom:10px; display:inline-block }
h1{ font-size:2rem; margin-bottom:5px }

/* ============================
   Rubricas — layout e posicionamento
   - comportamento mobile mantido
   - Desktop: 4 na primeira linha e 3 na segunda, ocupando os espaços entre
   - Mobile: 2 colunas por defeito; item 7 centralizado entre os 2 primeiros
   ============================ */
.rubricas{
  text-align:center;
  margin:40px auto;
  padding:0 10px;
  max-width:1100px;
}

/* Grid base (usada em mobile e medium) */
.rubrica-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr)); /* fallback: 2 colunas */
  gap: var(--rubrica-gap-row) var(--rubrica-gap-col);
  justify-items:center;
  align-items:start;
  margin: 0 auto;
  width:100%;
  padding: 0 10px;
  box-sizing:border-box;
}

/* Item (âncora .rubrica) */
.rubrica{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-decoration:none;
  color:inherit;
  width:100%;
  max-width:260px;
  box-sizing:border-box;
}
.rubrica img{
  width:110px;
  height:110px;
  object-fit:cover;
  border-radius:50%;
  margin-bottom:6px;
  box-shadow: 0 2px 8px rgba(255,255,255,0.08);
  transition: transform .28s ease, box-shadow .28s ease;
  display:block;
}
.rubrica img:hover{
  transform: scale(1.12);
  box-shadow: 0 10px 25px rgba(255,255,255,0.12);
}
.rubrica span{
  font-weight:600;
  font-size:1.02rem;
  text-align:center;
  padding: 0 6px;
  color:var(--text);
  word-break:break-word;
}

/* ------------------------
   Desktop 4+3 layout (>=1000px)
   ------------------------ */
@media (min-width:1000px) {
  .rubrica-grid{
    grid-template-columns: repeat(8, 1fr);
    gap: 28px 28px;
    justify-content:center;
    align-items:start;
  }

  .rubrica{ width:160px; }
  .rubrica img{ width:120px; height:120px; margin-bottom:8px; }

  /* Top row: 4 items (cada um ocupa 2 colunas) */
  .rubrica-grid > .rubrica:nth-child(1){ grid-column: 1 / span 2; }
  .rubrica-grid > .rubrica:nth-child(2){ grid-column: 3 / span 2; }
  .rubrica-grid > .rubrica:nth-child(3){ grid-column: 5 / span 2; }
  .rubrica-grid > .rubrica:nth-child(4){ grid-column: 7 / span 2; }

  /* Second row: 3 items, ocupam espaços entre os 4 de cima */
  .rubrica-grid > .rubrica:nth-child(5){ grid-column: 2 / span 2; grid-row: 2; }
  .rubrica-grid > .rubrica:nth-child(6){ grid-column: 4 / span 2; grid-row: 2; }
  .rubrica-grid > .rubrica:nth-child(7){ grid-column: 6 / span 2; grid-row: 2; }

  /* Garantia: itens adicionais (se houver) fluem normalmente */
  .rubrica-grid > .rubrica:nth-child(n+8){ grid-column: auto; grid-row: auto; }
}

/* Ajustes finos para ecrãs muito largos */
@media (min-width:1280px){
  .rubrica{ width:180px }
  .rubrica img{ width:140px; height:140px }
  .rubrica span{ font-size:1.03rem }
}

/* ------------------------
   Mobile specific: até 420px
   ------------------------ */
@media (max-width:420px){
  .rubrica-grid{
    grid-template-columns: 1fr 72px 1fr;
    gap: 12px 12px;
    align-items:start;
  }

  .rubrica{ width:100%; max-width:160px; }
  .rubrica img{ width:90px; height:90px; }

  /* Top row: item 1 (esq) e item 2 (dir) */
  .rubrica-grid > .rubrica:nth-child(1){ grid-column: 1; grid-row: 1; justify-self:center; }
  .rubrica-grid > .rubrica:nth-child(2){ grid-column: 3; grid-row: 1; justify-self:center; }

  /* O 7º item fica centralizado entre os dois, na linha 2 */
  .rubrica-grid > .rubrica:nth-child(7){
    grid-column: 2;
    grid-row: 2;
    justify-self:center;
    margin-top:4px;
  }

  /* Continuar a sequência normal: pares (3+4) em seguida, depois (5+6) */
  .rubrica-grid > .rubrica:nth-child(3){ grid-column: 1; grid-row: 3; justify-self:center; }
  .rubrica-grid > .rubrica:nth-child(4){ grid-column: 3; grid-row: 3; justify-self:center; }

  .rubrica-grid > .rubrica:nth-child(5){ grid-column: 1; grid-row: 4; justify-self:center; }
  .rubrica-grid > .rubrica:nth-child(6){ grid-column: 3; grid-row: 4; justify-self:center; }

  /* Tipografia para o espaço reduzido */
  .rubrica span{ font-size:0.92rem; padding:0 6px; }
}

/* Proteções contra floats/resíduos de estilos anteriores */
.rubrica-grid * { float: none; }

/* ============================
   ABOUT - imagem escala verticalmente para acomodar todo o texto
   ============================ */
.about{
  position:relative;
  max-width:var(--about-max-width);
  margin:0 auto 40px;
  color:var(--muted);
  text-align:center;
  background-image: linear-gradient(rgba(13,13,13,0.36), rgba(13,13,13,0.36)), url("/images/jn.jpeg");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: auto 100%;
  border-radius:12px;
  overflow:hidden;
  padding: 28px 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  display:block;
}

/* leve camada para melhorar contraste nas bordas */
.about::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.12));
  pointer-events: none;
}

/* Overlay textual (cresce conforme conteúdo) */
.about__overlay{
  width:100%;
  max-width:var(--content-width);
  margin:0 auto;
  padding: 28px;
  background: var(--overlay-bg);
  border-radius:10px;
  color:var(--text);
  box-sizing:border-box;
  z-index:2;
}

/* Tipografia da secção */
.about__title{ font-size: clamp(1.6rem,2.6vw,2.2rem); margin-bottom:0.6rem; color:#fff; font-weight:700 }
.about-intro{ font-size:1.15rem; font-weight:600; margin-bottom:12px; color:#f0f0f0 }
.about p{ margin:14px 0; color:var(--muted); line-height:1.5; word-break:break-word }
.about-center{ text-align:center; margin:10px 0; font-weight:600; color:#fff }

/* ícones sociais */
.social-icons{ margin-top:18px; display:flex; justify-content:center; gap:20px }
.social-icons img{ width:36px; height:36px; transition:transform .25s ease }
.social-icons img:hover{ transform:scale(1.15) }

/* ============================
   Mobile adjustments (imagem e espaçamentos)
   ============================ */
@media (max-width: 900px) {
  body{ padding:16px }
  .about{
    background-image: linear-gradient(rgba(13,13,13,0.36), rgba(13,13,13,0.36)), url("/images/jn-mobile.jpeg");
    background-position: 50% 22%;
    padding: 22px 12px;
    border-radius:10px;
  }
  .about__overlay{ padding:18px; max-width: calc(100% - 36px) }
  .about__title{ font-size:1.6rem }
  .about p{ font-size:0.98rem }
}

@media (max-width:640px){
  .about{
    background-image: linear-gradient(rgba(13,13,13,0.36), rgba(13,13,13,0.36)), url("/images/jn-mobile.jpeg");
    background-position: 50% 18%;
    padding: 18px 10px;
  }
  .about__overlay{ padding:14px }
  .about__title{ font-size:1.4rem }
  .about p{ font-size:0.96rem }
}

@media (max-width:420px){
  .about{ background-position: 50% 16%; padding:14px 8px }
  .about__overlay{ padding:12px }
  .about__title{ font-size:1.2rem }
  .about p{ font-size:0.92rem }
}

/* ============================
   Footer e restantes estilos
   ============================ */
footer{ width:100%; text-align:center; margin:60px auto 0 auto; font-size:0.9rem; color:#888 }
footer p{ margin:6px 0 }

/* Vídeos / galeria / utilitários (mantidos de versões anteriores) */
.videos{ max-width:1100px; margin:20px auto; padding:0 16px }
.videos-grid{ display:grid; grid-template-columns: repeat(3,1fr); gap:18px; align-items:start }
.video-item{ display:flex; flex-direction:column; gap:8px }
.video-thumb{ display:block; position:relative; width:100%; padding-top:56.25%; background:#000; overflow:hidden; border-radius:8px; cursor:pointer }
.video-thumb img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; display:block }
.video-thumb .play-btn{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:64px; height:64px; border-radius:50%; background:rgba(0,0,0,0.6); display:grid; place-items:center }
.video-thumb .play-btn:after{ content:""; display:block; width:0; height:0; border-left:18px solid #fff; border-top:11px solid transparent; border-bottom:11px solid transparent }
.video-caption{ color:var(--muted); font-size:0.95rem; margin-top:8px; text-align:center }

.video-page{ max-width:1000px; margin:28px auto; padding:0 16px; display:block; text-align:center }
.video-hero{ width:100%; border-radius:10px; overflow:hidden; background:#000; margin-bottom:12px }
.video-hero iframe{ width:100%; aspect-ratio:16/9; border:0; display:block }
.video-meta{ color:var(--muted); margin-bottom:18px; font-size:0.95rem; text-align:center }
.video-description{ color:var(--muted); background:rgba(0,0,0,0.22); padding:14px; border-radius:8px; line-height:1.5; margin-bottom:18px }

@media (max-width:900px){ .videos-grid{ grid-template-columns: repeat(2,1fr) } }
@media (max-width:560px){ .videos-grid{ grid-template-columns: 1fr } }

.container{ max-width:1200px; margin:0 auto; padding:0 16px }
.hidden{ display:none !important }
a{ color:inherit; text-decoration:none }

/* ============================
   Botões e meta bar para páginas de vídeo
   ============================ */
.btn-back{
  display:inline-block;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration:none;
  font-weight:600;
  margin-bottom:12px;
  transition: background .18s ease, transform .12s ease;
}
.btn-back:hover{ background: rgba(255,255,255,0.10); transform: translateY(-2px); }

.btn-primary{
  display:inline-block;
  background: linear-gradient(90deg,#222,#444);
  color: var(--text);
  padding: 8px 14px;
  border-radius:8px;
  text-decoration:none;
  font-weight:600;
  margin-left:10px;
}
.videos-header, .video-meta-bar{ display:flex; align-items:center; gap:18px; justify-content:flex-start; margin-bottom:18px; }
.page-controls{ display:flex; gap:12px; align-items:center; justify-content:flex-start; margin-top:12px; }

/* Centrar meta-bar e controlos de página */
.videos-header,
.video-meta-bar,
.page-controls,
.page-controls.video-controls,
.page-controls.listing-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

/* Ajustes de espaçamento para botão único */
.btn-back { margin: 0; }

/* Garantia para larguras pequenas: manter centralização e evitar overflow */
@media (max-width:560px) {
  .videos-header,
  .video-meta-bar,
  .page-controls {
    padding: 0 12px;
    box-sizing: border-box;
  }
}

/* === Overrides específicos === */

/* Fundo preto sólido em todas as páginas */
html, body {
  background: #000000 !important; /* preto absoluto */
  color: #ffffff;
}

/* Remove a caixa da secção Sobre, mantendo o texto */
.about__overlay {
  background: none !important;
  box-shadow: none !important;
}

/* ============================
   Produtos do carrinho (miniaturas e isolamento das rubricas)
   ============================ */
.rubrica-grid a.produto img {
  width: 160px !important;
  height: auto !important;
  border-radius: 6px !important;
  object-fit: cover !important;
  margin-bottom: 8px;
}
@media (max-width: 600px) {
  .rubrica-grid a.produto img { width: 120px !important; }
}
.produto h3 {
  font-size: 1rem;
  text-align: center;
  margin-top: 6px;
}

/* ============================
   Galeria das páginas de detalhe (miniaturas)
   ============================ */
.linha { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.linha img {
  width: 160px !important;
  height: auto !important;
  border-radius: 6px !important;
  cursor: pointer;
  transition: transform 0.2s;
}
.linha img:hover { transform: scale(1.05); }
@media (max-width: 600px) { .linha img { width: 120px !important; } }

/* ============================
   Modal de imagens (detalhes de instrumentos)
   ============================ */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.95);
  justify-content: center;
  align-items: center;
}
.modal img {
  width: auto !important;
  height: auto !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  object-fit: contain !important;
}
