:root{
  --paper:#ffffff;
  --paper2:#f6f8fb;
  --ink:#111318;
  --muted:#5a6475;
  --edge:#e7ebf2;
  --r:18px;
  --shadow: 0 28px 70px rgba(0,0,0,.22);
  --shadow2: 0 12px 30px rgba(0,0,0,.16);
  --accent:#0ea5e9;
}

/* Keep emag from being affected by template overflow rules */
.emag * { box-sizing: border-box; }

.emag-shell{
  width: min(1100px, 100%);
  margin: 0 auto;
}

.emag-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin: 0 auto 14px;
}

.emag-btn{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #fff;
  display:grid;
  place-items:center;
  cursor:pointer;
}

.emag-meta{ text-align:center; }
.emag-title{ font-weight: 900; letter-spacing:-.3px; }
.emag-sub{ color: rgba(255,255,255,.75); font-weight:700; font-size: 13px; }

/* ===============================
   TRUE FLIPBOOK
   Each .sheet has 2 faces: front/back
================================== */
.book{
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  perspective: 1800px;
  transform-style: preserve-3d;
  /* important: let the "peek" show on mobile */
  overflow: visible;
}

/* click zones */
.book-zone{
  position:absolute;
  top:0; bottom:0;
  width: 18%;
  z-index: 200;
  background: transparent;
  border:0;
  cursor:pointer;
}
.book-zone-left{ left:0; }
.book-zone-right{ right:0; }

.sheet{
  position:absolute;
  inset:0;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 780ms cubic-bezier(.18,.82,.12,1);
  z-index: calc(100 - var(--i, 0));
}

/* When flipped, the entire sheet turns */
.sheet.is-flipped{
  transform: rotateY(-180deg);
}

/* faces */
.face{
  position:absolute;
  inset:0;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

/* Back face is rotated so it appears correct after flipping */
.face.back{
  transform: rotateY(180deg);
}

/* Paper look */
.paper{
  position:absolute;
  inset:0;
  border-radius: calc(var(--r) + 10px);
  background: linear-gradient(180deg, #fff, var(--paper2));
  box-shadow: var(--shadow);
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.45);
}

/* Reflection / sheen */
.paper::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.62;
  background:
    radial-gradient(900px 520px at 18% 18%, rgba(255,255,255,.95), transparent 58%),
    radial-gradient(700px 420px at 92% 30%, rgba(255,255,255,.75), transparent 60%),
    linear-gradient(120deg, rgba(255,255,255,0) 42%, rgba(255,255,255,.42) 50%, rgba(255,255,255,0) 58%);
}

/* Edge shading (page curl illusion) */
.paper::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius: calc(var(--r) + 10px);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.05),
    inset 0 18px 40px rgba(0,0,0,.06);
}

.paper-inner{
  position:absolute;
  inset: 14px;
  border-radius: var(--r);
  background: var(--paper);
  border: 1px solid var(--edge);
  color: var(--ink);
  padding: 18px;
  overflow:hidden;
}

/* subtle spine highlight */
.spine{
  position:absolute;
  top: 2.5%;
  bottom: 2.5%;
  left: 50%;
  width: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(0,0,0,.10), rgba(255,255,255,.40));
  opacity: .28;
  z-index: 150;
  pointer-events:none;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: #0b2c3b;
  border: 1px solid rgba(14,165,233,.25);
  background: rgba(14,165,233,.10);
}

.paper-title{
  margin: 10px 0 6px;
  font-weight: 900;
  font-size: 34px;
  letter-spacing: -0.5px;
}
.paper-sub{
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.paper-title-sm{
  margin: 0;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.4px;
}
.paper-sub-sm{
  margin: 6px 0 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

/* Cover layout */
.cover-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 12px;
}

.info-card{
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(17,19,24,.10);
  background: #fbfcfe;
}
.info-card .label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}
.info-card .value{
  margin-top: 6px;
  font-weight: 900;
  color: #1a1f27;
}
.info-card a{ font-weight: 900; color: #0b2c3b; text-decoration:none; }

.cover-photo{
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(17,19,24,.10);
  background: #eef3fb;
}
.cover-photo img{ width:100%; height: 260px; object-fit:cover; display:block; }

/* Image grid */
.mag-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mag-card{
  margin:0;
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(17,19,24,.12);
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
  background: #fff;
}
.mag-card img{
  width:100%;
  height: 190px;
  object-fit: cover;
  display:block;
  background:#eef3fb;
}
.mag-card figcaption{
  padding: 10px 12px;
  font-weight: 900;
  font-size: 13px;
  color: #121520;
}

.two-col{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quote{
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(17,19,24,.10);
  background: #fbfcfe;
  font-weight: 900;
}

.note{
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(17,19,24,.18);
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 800;
}

.cta-strip{
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid rgba(17,19,24,.10);
  background: #fbfcfe;
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.cta-title{ font-weight: 900; color: #141824; }
.cta-sub{ color: var(--muted); font-weight: 800; font-size: 13px; margin-top: 4px; }
.cta-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 900;
  text-decoration:none;
  color:#0b0b0d;
  background: linear-gradient(180deg, #fff, #dfe6f0);
  border: 1px solid rgba(17,19,24,.12);
}

/* ===============================
   RESPONSIVE
   Mobile: show "peek" by shrinking book width
================================== */
@media (max-width: 992px){
  .mag-grid{ grid-template-columns: repeat(2, 1fr); }
  .two-col{ grid-template-columns: 1fr; }
  .book-zone{ width: 22%; }
}

@media (max-width: 780px){
  .emag-shell{
    width: 100%;
  }

  /* Make book narrower so next page peeks */
  .book{
    width: 86%;
    margin-left: 0;
  }

  /* Give a visible peek to the right */
  .book::after{
    content:"";
    position:absolute;
    top: 6%;
    bottom: 6%;
    right: -14%;
    width: 16%;
    border-radius: 22px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: var(--shadow2);
    opacity: .55;
    pointer-events:none;
  }

  .mag-grid{ grid-template-columns: 1fr; }
  .mag-card img{ height: 210px; }
}
