/*
Theme Name: Modelo 4 — Editora UNIFAP Institucional
Theme URI: https://modelo4.itsconnect.com.br
Description: Demo editorial universitário — ITS Connect
Version: 1.0
*/

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Open+Sans:wght@400;600&display=swap');

/* ── Tokens ── */
:root {
  --blue:    #1a3a6b;
  --blue-dk: #122a52;
  --gold:    #c8942a;
  --cream:   #f5f0e8;
  --white:   #ffffff;
  --gray:    #6b7280;
  --text:    #1f2937;
  --radius:  4px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── Demo notice ── */
#m4-demo-notice {
  background: #fef08a;
  color: #713f12;
  font-size: 13px;
  text-align: center;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  z-index: 9999;
}
#m4-demo-notice .m4-dismiss {
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: .7;
  background: none;
  border: none;
  position: absolute;
  right: 16px;
}

/* ── Top bar ── */
.m4-topbar {
  background: var(--blue);
  color: var(--white);
  font-size: 12px;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 max(16px, env(safe-area-inset-left,0px));
}
.m4-topbar-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.m4-topbar-links { display: flex; gap: 16px; }
.m4-topbar-links a { color: rgba(255,255,255,.8); font-size: 11px; }
.m4-topbar-links a:hover { color: var(--white); }

/* ── Main header ── */
.m4-header {
  background: var(--white);
  border-bottom: 1px solid #e5e7eb;
  min-height: 90px;
  display: flex;
  align-items: center;
  padding: 12px max(16px, env(safe-area-inset-left,0px));
}
.m4-header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.m4-logo-wrap { flex-shrink: 0; }
.m4-logo-wrap img { max-height: 72px; width: auto; }
.m4-logo-fallback {
  font-family: 'Merriweather', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}
.m4-logo-fallback span { font-size: 13px; font-weight: 400; display: block; color: var(--gray); }

/* ── Navbar ── */
.m4-navbar {
  background: var(--blue);
  padding: 0 max(16px, env(safe-area-inset-left,0px));
  position: sticky;
  top: 0;
  z-index: 100;
}
.m4-navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.m4-navbar ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}
.m4-navbar ul li a {
  display: block;
  color: rgba(255,255,255,.9);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 14px 18px;
  transition: background .15s;
  text-transform: uppercase;
  font-family: 'Open Sans', sans-serif;
}
.m4-navbar ul li a:hover,
.m4-navbar ul li.current-menu-item a {
  background: rgba(255,255,255,.12);
  color: var(--white);
}
/* Mobile hamburger */
.m4-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 24px;
  cursor: pointer;
  padding: 10px 0;
  margin-left: auto;
}

/* ── Hero ── */
.m4-hero {
  height: 500px;
  background: var(--blue-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* Imagem de fundo via <img> para controle preciso de posição */
.m4-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 70%;
}
.m4-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10,20,50,.20);
  z-index: 1;
}
.m4-hero-box {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--white);
  padding: 32px 48px;
  background: rgba(0,0,0,.18);
  border-left: 4px solid var(--gold);
  max-width: 540px;
  backdrop-filter: blur(2px);
}
.m4-hero-box h1 {
  font-family: 'Merriweather', serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 12px;
}
.m4-hero-box p {
  font-size: clamp(14px, 2vw, 18px);
  opacity: .9;
  font-style: italic;
}

/* ── Logo showcase ── */
.m4-logo-section {
  background: var(--white);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  border-bottom: 1px solid #e5e7eb;
}
.m4-logo-section img {
  max-width: 50%;
  max-height: 160px;
  width: auto;
  margin: 0 auto;
}

/* ── Stats bar ── */
.m4-stats {
  background: var(--blue);
  color: var(--white);
  padding: 24px max(16px, env(safe-area-inset-left,0px));
}
.m4-stats-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.m4-stat { text-align: center; }
.m4-stat strong { display: block; font-size: 32px; font-family: 'Merriweather', serif; color: var(--gold); }
.m4-stat span { font-size: 13px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }

/* ── Catalog section ── */
.m4-catalog {
  background: var(--cream);
  padding: 48px max(16px, env(safe-area-inset-left,0px));
}
.m4-catalog-inner { max-width: 1200px; margin: 0 auto; }

.m4-catalog h2 {
  font-family: 'Merriweather', serif;
  font-size: 28px;
  color: var(--blue);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--gold);
  display: inline-block;
}

/* Year filters */
.m4-year-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.m4-year-btn {
  padding: 7px 18px;
  border: 2px solid var(--blue);
  border-radius: 20px;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Open Sans', sans-serif;
}
.m4-year-btn:hover,
.m4-year-btn.active {
  background: var(--blue);
  color: var(--white);
}

/* Book grid */
.m4-book-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Book card */
.m4-book-card {
  transition: opacity .2s;
}
.m4-book-card.hidden { display: none; }

.m4-book-cover {
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  box-shadow: 3px 4px 12px rgba(0,0,0,.35);
  display: flex;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}
.m4-book-card:hover .m4-book-cover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 5px 8px 20px rgba(0,0,0,.45);
}

/* Spine */
.m4-book-spine {
  width: 10px;
  flex-shrink: 0;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
}

/* Cover body */
.m4-book-face {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px 32px;
  position: relative;
}
.m4-book-title {
  font-family: 'Merriweather', serif;
  font-size: clamp(12px, 1.3vw, 15px);
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 1.35;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.m4-book-imprint {
  position: absolute;
  bottom: 10px;
  font-size: 9px;
  letter-spacing: .15em;
  color: rgba(255,255,255,.65);
  text-transform: uppercase;
}
.m4-book-year-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.35);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: .05em;
}
.m4-book-deco {
  width: 60%;
  height: 1px;
  background: rgba(255,255,255,.25);
  margin: 10px auto;
}

/* Category color map */
.m4-cat-amazonia   { background: #1a4a2e; } .m4-spine-amazonia   { background: #0d2a1a; }
.m4-cat-educacao   { background: #1a3a4a; } .m4-spine-educacao   { background: #0d1e2a; }
.m4-cat-saude      { background: #3a1a4a; } .m4-spine-saude      { background: #1e0d26; }
.m4-cat-humanidades{ background: #4a3a1a; } .m4-spine-humanidades{ background: #261e0d; }
.m4-cat-arte       { background: #3a1040; } .m4-spine-arte       { background: #1e0820; }
.m4-cat-comunicacao{ background: #4a1a1a; } .m4-spine-comunicacao{ background: #260d0d; }
.m4-cat-tecnologia { background: #1a2a4a; } .m4-spine-tecnologia { background: #0d1626; }
.m4-cat-outros     { background: #2a2a3a; } .m4-spine-outros     { background: #16161e; }

.m4-book-meta {
  padding: 10px 4px 0;
}
.m4-book-area {
  font-size: 11px;
  color: var(--gray);
  line-height: 1.3;
}
.m4-book-year-txt {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

/* ── Footer ── */
.m4-footer {
  background: var(--blue-dk);
  color: rgba(255,255,255,.85);
  padding: 48px max(16px, env(safe-area-inset-left,0px)) 0;
}
.m4-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  padding-bottom: 40px;
}
.m4-footer-brand { flex: 2; min-width: 200px; }
.m4-footer-brand strong {
  font-family: 'Merriweather', serif;
  font-size: 20px;
  color: var(--white);
  display: block;
  margin-bottom: 8px;
}
.m4-footer-brand address {
  font-style: normal;
  font-size: 13px;
  line-height: 1.6;
  opacity: .8;
}
.m4-footer-links { flex: 1; min-width: 140px; }
.m4-footer-links h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold);
  margin-bottom: 12px;
}
.m4-footer-links ul { list-style: none; }
.m4-footer-links ul li { margin-bottom: 8px; }
.m4-footer-links ul li a { font-size: 13px; opacity: .8; }
.m4-footer-links ul li a:hover { opacity: 1; color: var(--gold); }
.m4-footer-bar {
  border-top: 1px solid rgba(255,255,255,.12);
  text-align: center;
  font-size: 12px;
  padding: 16px;
  opacity: .6;
}

/* ── Archive sidebar ── */
.m4-archive-wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  padding: 40px max(16px, env(safe-area-inset-left,0px));
  align-items: flex-start;
}
.m4-archive-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: 20px;
}
.m4-archive-sidebar h3 { font-size: 14px; color: var(--blue); margin-bottom: 12px; font-family: 'Merriweather', serif; }
.m4-archive-sidebar ul { list-style: none; }
.m4-archive-sidebar ul li { margin-bottom: 6px; }
.m4-archive-sidebar ul li button {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 0;
  font-family: 'Open Sans', sans-serif;
  text-align: left;
  width: 100%;
}
.m4-archive-sidebar ul li button:hover { text-decoration: underline; }
.m4-archive-sidebar ul li button.active { font-weight: 700; }
.m4-archive-main { flex: 1; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .m4-book-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .m4-topbar-links { display: none; }
  .m4-book-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .m4-stats-inner { gap: 24px; }
  .m4-logo-section img { max-width: 75%; }
  .m4-menu-toggle { display: block; }
  .m4-navbar ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--blue-dk);
    z-index: 200;
  }
  .m4-navbar ul.open { display: flex; }
  .m4-navbar { position: relative; }
  .m4-navbar-inner { flex-wrap: wrap; }
  .m4-archive-wrap { flex-direction: column; }
  .m4-archive-sidebar { width: 100%; }
  .m4-footer-inner { flex-direction: column; gap: 24px; }
}
@media (max-width: 480px) {
  .m4-hero { height: 380px; }
  .m4-hero-box { padding: 24px 20px; }
  .m4-book-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
