/**
 * HEADER.CSS v2.2
 * Fix: Seletores CSS ajustados para usar underscores (match com Django slugify)
 */

/* ============================================
   MASTHEAD (Cabeçalho editorial)
   ============================================ */

.masthead {
  text-align: center;
  padding-top: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: var(--border-medium) solid var(--preview-card-border);
  position: relative;
  contain: layout;
}

.masthead__title {
  font-family: var(--font-masthead, 'Anton', sans-serif);
  color: var(--site-title);
  margin-bottom: var(--space-xs);
  line-height: 1.1;
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
}

.masthead__title-main {
  display: inline-block;
  font-size: var(--size-masthead-title, 4rem);
  font-weight: var(--weight-normal);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  max-width: 100%;
}

.masthead__title-sub {
  display: inline-block;
  font-family: var(--font-masthead-sub, 'Libre Baskerville', serif);
  font-size: var(--size-masthead-sub, 1.5rem);
  color: var(--site-subtitle);
  position: relative;
  z-index: 3;
  transition: all 0.3s ease;
}

.masthead__tagline {
  font-family: var(--font-masthead-tagline, 'Crimson Pro', serif);
  font-size: var(--size-masthead-tagline, 1rem);
  font-style: italic;
  color: var(--text-2);
  letter-spacing: 0.03em;
  margin-top: var(--space-xs);
}

/* --- ESTILO: PULP I (Estronho Original) --- */
.masthead--pulp_1 .masthead__title-sub {
  position: absolute;
  right: -0.5em;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  background-color: rgba(26, 25, 22, 0.65);
  padding: 0.2em 0.5em;
  border: 2px solid var(--site-subtitle);
  box-shadow: 
    3px 3px 0 rgba(0, 0, 0, 0.4),
    0 0 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  font-weight: var(--weight-normal);
  text-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.8),
    0 0 4px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  border-radius: 4px 5px 4px 5px;
  filter: drop-shadow(0.3px 0.2px 0.2px rgba(0, 0, 0, 0.2));
}

.masthead--pulp_1 .masthead__title-sub::before {
  content: ""; position: absolute; top: 15%; left: 20%; width: 3px; height: 3px;
  background: rgba(0, 0, 0, 0.15); border-radius: 50%; z-index: 1;
}
.masthead--pulp_1 .masthead__title-sub::after {
  content: ""; position: absolute; bottom: 25%; right: 15%; width: 2px; height: 4px;
  background: rgba(0, 0, 0, 0.12); border-radius: 2px; transform: rotate(25deg); z-index: 1;
}

.masthead--pulp_1 .masthead__glitch {
  position: relative;
  top: 3.8px;
  display: inline-block;
  animation: glitch-twitch 16s ease-in-out infinite;
}
@keyframes glitch-twitch {
  0%, 94% { top: 3.5px; }
  95%, 96% { top: 5.5px; }
  96.5%, 100% { top: 3.5px; }
}

@media (min-width: 768px) {
  .masthead--pulp_1 .masthead__title-sub {
    right: -0.8em;
    transform: translateY(-50%) rotate(-10deg);
    padding: 0.25em 0.6em;
    font-weight: var(--weight-bold);
  }
}

/* --- ESTILO: STANDARD (Default / Becodonunca) --- */
.masthead--default .masthead__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.masthead--default .masthead__title-sub {
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: calc(var(--size-masthead-sub) * 0.8);
  opacity: 0.9;
}

/* --- ESTILO: PULP II (Poster) --- */
.masthead--pulp_2 .masthead__title-main {
    text-shadow: 3px 3px 0px var(--site-subtitle), 5px 5px 0px rgba(0,0,0,0.5);
    transform: skewY(-2deg);
}
.masthead--pulp_2 .masthead__title-sub {
    display: block;
    width: fit-content;
    margin: -15px auto 0;
    background: var(--site-subtitle);
    color: var(--bg);
    padding: 0.2em 1em;
    transform: skewY(-2deg);
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

/* --- ESTILO: MODERN I (Clean) --- */
.masthead--modern_1 .masthead__title-main {
    font-weight: 200;
    letter-spacing: -0.05em;
    text-transform: none;
}
.masthead--modern_1 .masthead__title-sub {
    display: block;
    margin-top: 0.5rem;
    font-size: calc(var(--size-masthead-sub) * 0.7);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-weight: 600;
    opacity: 0.7;
}
.masthead--modern_1 .masthead__tagline {
    font-style: normal;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

/* --- ESTILO: MODERN II (Bold Pill) --- */
.masthead--modern_2 .masthead__title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.masthead--modern_2 .masthead__title-main {
    font-weight: 800;
    color: var(--site-title);
    letter-spacing: -0.03em;
}
.masthead--modern_2 .masthead__title-sub {
    display: inline-block;
    color: var(--bg);
    background-color: var(--site-subtitle);
    padding: 0.3em 1.2em;
    font-weight: bold;
    text-transform: uppercase;
    font-size: calc(var(--size-masthead-sub) * 0.6);
    letter-spacing: 0.15em;
    border-radius: 50px;
    width: auto;
    text-align: center;
}

/* --- ESTILO: VINTAGE I (Classic) --- */
.masthead--vintage_1 .masthead__title {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--site-subtitle);
}
.masthead--vintage_1 .masthead__title-main {
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}
.masthead--vintage_1 .masthead__title-sub {
    display: block;
    font-style: italic;
    font-weight: normal;
    margin-top: 0.2em;
}

/* --- ESTILO: VINTAGE II (Ornate) --- */
.masthead--vintage_2 .masthead__title {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.masthead--vintage_2 .masthead__title-main {
    order: 2;
    border-top: 2px solid var(--site-subtitle);
    border-bottom: 2px solid var(--site-subtitle);
    padding: 0.1em 0.5em;
    margin: 0.2em 0;
}
.masthead--vintage_2 .masthead__title-sub {
    order: 1;
    font-size: calc(var(--size-masthead-sub) * 0.8);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.5em;
}
.masthead--vintage_2 .masthead__tagline::before,
.masthead--vintage_2 .masthead__tagline::after {
    content: " ~ ";
    color: var(--site-subtitle);
}


/* ============================================
   NAVEGAÇÃO EDITORIAL HIERÁRQUICA (sumário de revista)
   ============================================ */

@media (max-width: 768px) {
  .masthead {
    overflow-x: hidden;
  }

  .masthead__title-main {
    font-size: clamp(2rem, 14vw, var(--size-masthead-title, 4rem));
    line-height: 0.95;
    letter-spacing: 0.01em;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .masthead__title-sub {
    font-size: clamp(0.95rem, 4.8vw, var(--size-masthead-sub, 1.5rem));
    max-width: min(92vw, 34rem);
  }

  .masthead__tagline {
    font-size: clamp(0.85rem, 3.2vw, var(--size-masthead-tagline, 1rem));
    max-width: min(92vw, 36rem);
    margin-left: auto;
    margin-right: auto;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }

  .masthead--pulp_1 .masthead__title-sub {
    position: static;
    transform: none;
    right: auto;
    top: auto;
    display: inline-block;
    margin: 0.35rem auto 0;
    white-space: normal;
  }

  .masthead--pulp_2 .masthead__title-main {
    transform: none;
    text-shadow: 2px 2px 0px var(--site-subtitle), 3px 3px 0px rgba(0, 0, 0, 0.35);
  }

  .masthead--pulp_2 .masthead__title-sub {
    margin-top: 0.25rem;
    transform: none;
    padding: 0.15em 0.6em;
    max-width: min(92vw, 30rem);
    font-size: clamp(0.9rem, 4.2vw, calc(var(--size-masthead-sub, 1.5rem) * 0.9));
    letter-spacing: 0.04em;
  }
}

.nav {
  background-color: transparent;
  border-bottom: var(--border-thin) solid var(--preview-card-border);
  padding-top: var(--space-sm);
  padding-bottom: var(--space-xs);
}

.nav__container {
  max-width: var(--width-wide);
  margin: 0 auto;
  padding: 0 var(--padding-mobile);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  position: relative;
}

.nav__hamburger {
  display: none; /* Escondido em desktop */
  flex-direction: column;
  justify-content: space-around;
  --nav-hamburger-size: calc(var(--menu-font-size, 0.8rem) * 2.2);
  --nav-hamburger-line: clamp(2px, calc(var(--menu-font-size, 0.8rem) * 0.18), 3px);
  --nav-hamburger-shift: calc(var(--nav-hamburger-size) * 0.28);
  width: var(--nav-hamburger-size);
  height: var(--nav-hamburger-size);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  align-self: flex-start;
  margin-bottom: var(--space-xs);
}

.nav__hamburger-line {
  width: 100%;
  height: var(--nav-hamburger-line);
  background-color: var(--text);
  border-radius: 2px;
  transition: all var(--transition-base);
}

.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(var(--nav-hamburger-shift), var(--nav-hamburger-shift));
}

.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(var(--nav-hamburger-shift), calc(var(--nav-hamburger-shift) * -1));
}

.nav__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1.75rem;
}

@media (min-width: 768px) {
  .nav__container {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 var(--padding-tablet);
  }

  .nav__hamburger {
    display: none; /* Sempre escondido em desktop */
  }

  .nav__list {
    justify-content: flex-start;
    display: flex !important; /* Força exibição em desktop */
  }

  .nav__controls {
    margin-left: auto;
  }
}
