/* ============================================================
   MISTÉRIO & FICÇÃO — editorial noir + stellar sci-fi
   Paleta: papel sobre quase-preto; âmbar noir (Caso Encerrado)
   e cian estelar (Fronteiras Estelares).
   ============================================================ */

:root {
  --bg: #0a0a0d;
  --bg-2: #101016;
  --bg-3: #16161d;
  --paper: #efeae2;
  --muted: #9b958a;
  --faint: #847d72; /* was #6d675e (~3.5:1 on --bg, fails WCAG AA); now ~4.9:1 */
  --line: rgba(239, 234, 226, 0.12);
  --line-soft: rgba(239, 234, 226, 0.07);

  --amber: #d9a441;
  --amber-hot: #f0c065;
  --amber-deep: #8c5e1e;
  --cyan: #6fc3df;
  --cyan-deep: #2e6f85;
  --red: #b3402f;

  --font-display: "Fraunces", Georgia, serif;
  --font-alt: "Syne", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
  --font-mono: "Space Mono", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

:focus-visible {
  outline: 2px solid var(--amber-hot);
  outline-offset: 2px;
}

body {
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--amber); color: #14100a; }

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* ---------- grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem clamp(1.2rem, 4vw, 3rem);
  background: rgba(10, 10, 13, 0);
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: rgba(10, 10, 13, 0.86);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line-soft);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.logo-mark {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  object-fit: cover;
}

.logo-amp { opacity: 0.75; }

.logo-text { font-size: 0.95rem; letter-spacing: 0.01em; }

.site-nav {
  display: flex;
  gap: 1.6rem;
  margin-left: auto;
  font-size: 0.86rem;
  color: var(--muted);
}

.site-nav a { transition: color 0.25s; }
.site-nav a:hover { color: var(--paper); }

.lang-toggle {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}

.lang-toggle:hover { border-color: var(--amber); background: rgba(217, 164, 65, 0.08); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  width: 2.2rem;
  height: 2.2rem;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  margin: 0 0.55rem;
  background: var(--paper);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 96vh;
  display: flex;
  align-items: center;
  padding: 8rem clamp(1.2rem, 4vw, 3rem) 5rem;
  overflow: hidden;
}

.hero-inner { position: relative; z-index: 2; max-width: 62rem; }

.hero-kicker {
  font-size: 0.72rem;
  color: var(--faint);
  margin-bottom: 1.6rem;
  animation: rise 0.9s var(--ease) both;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 5.6vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.hero-line { display: block; }

.hero-line:first-child {
  color: var(--amber-hot);
  font-style: italic;
  animation: rise 1s 0.08s var(--ease) both;
}

.hero-line-alt {
  font-family: var(--font-alt);
  font-weight: 600;
  font-size: 0.82em;
  color: var(--cyan);
  animation: rise 1s 0.2s var(--ease) both;
}

.hero-sub {
  max-width: 34rem;
  margin-top: 1.8rem;
  color: var(--muted);
  font-size: 1.02rem;
  animation: rise 1s 0.32s var(--ease) both;
}

.hero-brands {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.6rem;
  animation: rise 1s 0.44s var(--ease) both;
}

.brand-chip {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.4rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.005));
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
}

.brand-chip:hover { transform: translateY(-3px); }

.chip-label { font-size: 0.62rem; color: var(--faint); }

.chip-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.chip-noir:hover { border-color: var(--amber-deep); background: rgba(217, 164, 65, 0.06); }
.chip-noir .chip-name { color: var(--amber-hot); }

.chip-star:hover { border-color: var(--cyan-deep); background: rgba(111, 195, 223, 0.06); }
.chip-star .chip-name { color: var(--cyan); font-family: var(--font-alt); }

.hero-fog {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(42rem 24rem at 12% 108%, rgba(217, 164, 65, 0.16), transparent 65%),
    radial-gradient(30rem 18rem at 38% 118%, rgba(179, 64, 47, 0.1), transparent 70%);
  animation: drift 14s ease-in-out infinite alternate;
}

.hero-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 22% 18%, rgba(111,195,223,0.9), transparent 100%),
    radial-gradient(1px 1px at 64% 9%, rgba(239,234,226,0.7), transparent 100%),
    radial-gradient(1.2px 1.2px at 81% 30%, rgba(111,195,223,0.8), transparent 100%),
    radial-gradient(1px 1px at 47% 24%, rgba(239,234,226,0.5), transparent 100%),
    radial-gradient(1.6px 1.6px at 90% 14%, rgba(111,195,223,0.7), transparent 100%),
    radial-gradient(1px 1px at 33% 6%, rgba(239,234,226,0.6), transparent 100%),
    radial-gradient(1.3px 1.3px at 71% 21%, rgba(240,192,101,0.6), transparent 100%);
  animation: twinkle 5s ease-in-out infinite alternate;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  from { opacity: 0.85; transform: translateX(0); }
  to { opacity: 1; transform: translateX(2.5%); }
}

@keyframes twinkle {
  from { opacity: 0.5; }
  to { opacity: 1; }
}

/* ---------- brand sections ---------- */
.brand-section {
  position: relative;
  padding: clamp(4rem, 8vw, 7rem) clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line-soft);
  --accent: var(--amber);
  --accent-soft: rgba(217, 164, 65, 0.09);
  --accent-line: rgba(217, 164, 65, 0.35);
}

.brand-fronteiras {
  --accent: var(--cyan);
  --accent-soft: rgba(111, 195, 223, 0.09);
  --accent-line: rgba(111, 195, 223, 0.35);
  background:
    radial-gradient(60rem 30rem at 85% 0%, rgba(46, 111, 133, 0.1), transparent 60%),
    var(--bg);
}

.brand-caso {
  background:
    radial-gradient(60rem 30rem at 8% 0%, rgba(140, 94, 30, 0.1), transparent 60%),
    var(--bg);
}

.brand-head { max-width: 46rem; margin-bottom: 3.5rem; }

.brand-kicker { font-size: 0.7rem; color: var(--accent); opacity: 0.85; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.05;
  margin-top: 0.8rem;
}

.brand-fronteiras .brand-name { font-family: var(--font-alt); }

.brand-tagline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
  margin-top: 0.6rem;
  font-size: 1.05rem;
}

.brand-desc {
  color: var(--muted);
  margin-top: 1.1rem;
  max-width: 40rem;
}

/* ---------- series block ---------- */
.series-block {
  margin-bottom: 4.5rem;
  animation: rise 0.9s var(--ease) both;
}
.series-block:last-child { margin-bottom: 0; }

.series-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--accent-line);
}

.series-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.18em;
}

.series-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
}

.brand-fronteiras .series-title { font-family: var(--font-alt); }

.series-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--faint);
}

.series-author {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--accent);
  opacity: 0.8;
  letter-spacing: 0.1em;
}

.series-lead {
  color: var(--muted);
  font-size: 0.95rem;
  flex-basis: 100%;
  max-width: 46rem;
}

/* ---------- book grid / card ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 2rem 1.6rem;
}

.book-card {
  position: relative;
  cursor: pointer;
  animation: rise 0.8s var(--ease) both;
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 0.45rem;
  overflow: hidden;
  background: var(--bg-3);
  box-shadow: 0 18px 42px -18px rgba(0, 0, 0, 0.75);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.book-card:hover .book-cover-wrap {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 28px 56px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--accent-line);
}

.book-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.book-card:hover .book-cover-wrap img { transform: scale(1.045); }

.book-vol {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: #14100a;
  background: var(--accent);
  padding: 0.28rem 0.55rem;
  border-radius: 0.25rem;
}

.book-meta { padding: 0.95rem 0.15rem 0; }

.book-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.06rem;
  line-height: 1.25;
}

.brand-fronteiras .book-title { font-family: var(--font-alt); }

.book-hook {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-more {
  display: inline-block;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.book-more::after { content: " →"; transition: transform 0.25s var(--ease); display: inline-block; }
.book-card:hover .book-more::after { transform: translateX(4px); }

/* ---------- personagens ---------- */
.char-section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1.4rem;
}

.char-card {
  position: relative;
  padding: 1.5rem 1.4rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.006));
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease);
  animation: rise 0.8s var(--ease) both;
}

.char-card:hover { transform: translateY(-4px); border-color: var(--char-accent, var(--line)); }

.char-id {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--faint);
  margin-bottom: 0.9rem;
}

.char-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--char-accent, var(--paper));
}

.char-role {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-display);
}

.char-traits {
  margin: 1rem 0 0;
  padding: 1rem 0 0;
  list-style: none;
  border-top: 1px dashed var(--line);
}

.char-traits li {
  position: relative;
  padding: 0.32rem 0 0.32rem 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.char-traits li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--char-accent, var(--accent));
}

/* ---------- sobre ---------- */
.about-section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1.2rem, 4vw, 3rem);
  border-top: 1px solid var(--line-soft);
}

.about-inner { max-width: 62rem; margin: 0 auto; }

.about-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin-bottom: 1.8rem;
}

.about-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 2.5rem;
  color: var(--muted);
}

.about-note {
  margin-top: 2.5rem;
  font-size: 0.68rem;
  color: var(--faint);
}

/* ---------- footer ---------- */
.site-footer {
  padding: 3rem clamp(1.2rem, 4vw, 3rem) 3.5rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.footer-note {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--faint);
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 9, 0.82);
  backdrop-filter: blur(6px);
  animation: fade 0.3s var(--ease) both;
}

.modal-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) 1fr;
  gap: 2rem;
  width: min(52rem, 100%);
  max-height: min(88vh, 44rem);
  overflow: auto;
  padding: 2rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  animation: rise 0.4s var(--ease) both;
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 1rem;
  z-index: 3;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover { color: var(--paper); }

.modal-media {
  align-self: start;
  border-radius: 0.4rem;
  overflow: hidden;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.85);
}

.modal-media img { width: 100%; }

.modal-kicker { font-size: 0.64rem; color: var(--muted); }

.modal-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.15;
  margin-top: 0.7rem;
}

.modal-sub {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

.modal-blurb {
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.modal-blurb p + p { margin-top: 0.8rem; }

.modal-blurb .why {
  margin-top: 1rem;
  padding-left: 0;
  list-style: none;
}

.modal-blurb .why li {
  position: relative;
  padding: 0.28rem 0 0.28rem 1.15rem;
}

.modal-blurb .why li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--modal-accent, var(--amber));
}

.modal-buy {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.buy-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.75rem 1.2rem;
  border-radius: 0.35rem;
  border: 1px solid var(--line);
  transition: transform 0.25s var(--ease), background 0.25s, color 0.25s, border-color 0.25s;
}

.buy-us { color: var(--paper); }
.buy-us:hover { background: var(--paper); color: #14100a; transform: translateY(-2px); }

.buy-br {
  color: #14100a;
  background: var(--modal-accent, var(--amber));
  border-color: var(--modal-accent, var(--amber));
}

.buy-br:hover { background: var(--paper); border-color: var(--paper); transform: translateY(-2px); }

.buy-btn[aria-disabled="true"] {
  cursor: default;
  opacity: 0.5;
  pointer-events: none;
}

.modal-price {
  margin-top: 1rem;
  font-size: 0.64rem;
  color: var(--faint);
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .site-nav {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    background: rgba(10, 10, 13, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
  }
  .site-nav.nav-open { max-height: 16rem; }
  .site-nav a { padding: 0.9rem clamp(1.2rem, 4vw, 3rem); border-top: 1px solid var(--line-soft); }
  /* clipped by max-height but still in the DOM — hide from keyboard/AT until open */
  .site-nav:not(.nav-open) a { visibility: hidden; }
  .modal-card { grid-template-columns: 1fr; max-height: 92vh; padding: 1.6rem; }
  .modal-media { max-width: 14rem; }
}

@media (max-width: 560px) {
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.5rem 1rem; }
  .hero { min-height: 88vh; }
  .series-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
