/* assets/css/style.css */

/* ==========================
   01) VARIABLES
   ========================== */
:root{
  --red:#e22323;
  --deep:#b31a1a;
  --white:#ffffff;
  --black:#0b0b0b;
  --muted:#6b6b6b;
  --glass: rgba(0,0,0,0.04);
  --card:#ffffff;
  --radius:16px;
  --footer-height:260px;
  --focus: 3px solid rgba(226,35,35,0.18);

  /* iOS safe-area */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* ==========================
   02) RESET / BASE
   ========================== */
*{box-sizing:border-box}
html,body{height:100%}
html, body { overflow-x: hidden; }
* { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

body{
  margin:0;
  font-family:'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, Arial;
  background:linear-gradient(180deg,#fbfbfb,#f1f1f1);
  color:var(--black);
  -webkit-font-smoothing:antialiased;
  direction: rtl;
}

a{color:inherit}
img{max-width:100%; height:auto;}

/* Focus */
a:focus, button:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: var(--focus);
  border-radius:8px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{transition:none !important; animation:none !important;}
}

/* ==========================
   03) PARTICLES / PAGE
   ========================== */
#particles{position:fixed;inset:0;z-index:0;pointer-events:none;display:block}
.page{position:relative;z-index:1}

/* ==========================
   04) CONTAINER
   ========================== */
.container{max-width:1180px;margin:0 auto;padding:24px}
@media (max-width:768px){ .container{padding:16px} }
@media (max-width:420px){ .container{padding:12px} }

/* ==========================
   05) HEADER (DESKTOP)
   ========================== */
header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  background: rgba(251,251,251,0.78);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-left, .header-right{display:flex;align-items:center;gap:14px}
.brand{display:flex;align-items:center;gap:14px;cursor:pointer}

.logo-wrap{
  width:84px;height:84px;border-radius:18px;
  background:linear-gradient(135deg,var(--red),var(--deep));
  display:flex;align-items:center;justify-content:center;
  /*box-shadow:0 18px 40px rgba(226,35,35,0.12);*/
}
.logo-wrap img{width:72px;height:72px;object-fit:contain;border-radius:12px;display:block}

.site-title h1{margin:0;font-size:18px;font-weight:800;color:var(--black)}
.site-title p{margin:0;font-size:12px;color:var(--muted)}
.site-title h1, .headline, .card h4{ word-break: break-word; }

nav{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.navlink{
  padding:8px 12px;border-radius:10px;color:var(--black);
  font-weight:700;text-decoration:none
}
.navlink:hover{background:rgba(0,0,0,0.04)}
.cta{
  background:linear-gradient(90deg,var(--red),var(--deep));
  padding:10px 14px;border-radius:12px;color:#fff;
  font-weight:800;text-decoration:none;display:inline-flex;
  align-items:center;justify-content:center
}

/* ==========================
   06) PANELS / CARDS
   ========================== */
.panel-white{
  background:var(--card);
  padding:28px;
  border-radius:18px;
  border:1px solid rgba(0,0,0,0.06);
  box-shadow:0 30px 80px rgba(0,0,0,0.06)
}

.card{
  background:var(--card);
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.04);
  transition:transform .24s ease, box-shadow .24s ease
}
.card:hover{transform:translateY(-6px);box-shadow:0 26px 60px rgba(0,0,0,0.06)}
.card img{width:100%;height:320px;object-fit:contain;border-radius:8px;display:block;background:#fff}
.card h4{margin:10px 0 6px;color:var(--black);font-size:16px}
.card p{margin:0;color:var(--muted);font-size:13px}

.section{margin-top:36px}

/* ==========================
   07) HERO
   ========================== */
.hero{padding:40px 0 32px}
.hero-grid{
  display:grid;
  grid-template-columns:1fr 340px;
  gap:28px;
  align-items:start
}
.hero-left{position:relative;padding:8px}
.super-title{display:flex;align-items:center;gap:12px;margin-bottom:12px;flex-wrap:wrap}
.super-title .badge{
  background:var(--red);color:#fff;
  padding:6px 12px;border-radius:999px;
  font-weight:800;letter-spacing:0.4px
}
.headline{
  font-size:34px;color:var(--black);
  margin:6px 0 10px;line-height:1.05;
  font-weight:900
}
.tagline{font-size:18px;color:var(--deep);margin:0 0 16px;font-weight:700}
.slogan{font-size:18px;color:var(--muted);margin:12px 0 18px}

/* ==========================
   08) CAROUSEL
   ========================== */
.carousel-wrap{overflow:hidden;border-radius:12px}
.books-track{
  display:flex;
  gap:18px;
  transition:transform .6s cubic-bezier(.2,.9,.2,1);
  padding:12px;
  will-change:transform
}
.book-card{min-width:260px;flex:0 0 auto}

/* FIX sliders in RTL: keep tracks LTR so translateX behaves predictably */
#heroTrack, #booksTrack { direction:ltr; }
.hero-slide, .book-card { direction:rtl; }

/* ==========================
   09) FOOTER
   ========================== */
.footer{
  background:linear-gradient(180deg,var(--red),var(--deep));
  color:#fff;
  padding:36px 24px;
  margin-top:40px;
  position:relative;
  overflow:hidden;
}

/* Back to top */
#backToTop{
  position:fixed;
  bottom:26px;
  left:26px;
  width:48px;
  height:48px;
  border-radius:12px;
  background:var(--red);
  color:#fff;
  border:none;
  display:none;
  align-items:center;
  justify-content:center;
  box-shadow:0 8px 24px rgba(0,0,0,0.2);
  cursor:pointer;
  z-index:90
}

/* ==========================
   10) FORMS / BUTTONS
   ========================== */
.grid{display:grid;gap:14px}
.grid-2{grid-template-columns:repeat(2,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-4{grid-template-columns:repeat(4,1fr)}

.badge-pill{
  display:inline-flex;align-items:center;gap:8px;
  background:rgba(226,35,35,0.12);
  color:var(--deep);
  padding:6px 10px;border-radius:999px;
  font-weight:900
}

.btn{
  display:inline-flex;align-items:center;justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.08);
  background:#fff;
  color:var(--black);
  font-weight:900;
  cursor:pointer;
  text-decoration:none;
}
.btn:hover{transform:translateY(-1px)}
.btn:disabled{opacity:.6;cursor:not-allowed;transform:none}
.btn-small{padding:8px 10px;border-radius:10px;font-weight:900}
.btn-primary{background:linear-gradient(90deg,var(--red),var(--deep));color:#fff;border:0;}
.btn-outline{background:#fff;color:var(--black)}
.btn-danger{background:#fff;color:var(--deep);border:1px solid rgba(226,35,35,0.25)}
.btn-danger:hover{background:rgba(226,35,35,0.06)}

.input, select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.08);
  background:#fff;
  font-family:inherit;
  font-size:14px;
}
textarea{min-height:140px;resize:vertical}

.form-row{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.form-group{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.form-group label{font-weight:900}

.alert{
  margin:16px 0 0;
  padding:12px 14px;
  border-radius:14px;
  background:rgba(0,0,0,0.04);
  border:1px solid rgba(0,0,0,0.06);
}
.alert-success{background:rgba(32, 160, 84, 0.10); border-color: rgba(32,160,84,0.18)}
.alert-danger{background:rgba(226,35,35,0.10); border-color: rgba(226,35,35,0.18)}

/* ==========================
   11) BOOK IMAGES (GLOBAL)
   ========================== */
.book-img{
  width:44px;
  height:58px;
  object-fit: contain;
  background:#fff;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.06);
  display:block;
}
.book-covers{
  display:flex;
  gap:8px;
  align-items:center;
}
.book-covers .cover-box{
  width:44px;
  height:58px;
  background:#fff;
  border-radius:10px;
  border:1px solid rgba(0,0,0,0.06);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.book-covers .cover-box img{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
}






/* ✅ Enamad place (below cards, centered) */
.rf-enamad{
  grid-column: 1 / -1;           /* کل ستون‌ها */
  display:flex;
  justify-content:center;        /* وسط */
  margin-top: 10px;
}

.rf-enamadBox{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.rf-enamadBox img{
  width: 110px;                  /* اندازه خوب */
  height: auto;
  display:block;
}






/* ==========================
   12) RESPONSIVE (TABLET)
   ========================== */
@media (max-width:1000px){
  .hero-grid{grid-template-columns:1fr}
  .books-track{padding:8px}
  .grid-4{grid-template-columns:repeat(2,1fr)}
  .grid-3{grid-template-columns:repeat(2,1fr)}
  .form-row{grid-template-columns:1fr}
}

/* =========================================================
   13) ✅ MOBILE NAV (FINAL - SINGLE SOURCE OF TRUTH)
   - Drawer (RTL) + equal-sized buttons
   - Overlay (no click-block when closed)
   - Bottom bar
   ========================================================= */

/* desktop hidden */
.menu-btn, .menu-overlay, .mobile-drawer, .mobile-bar { display:none; }

/* Overlay */
.menu-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;

  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.menu-overlay.is-open{
  opacity: 1;
  pointer-events: auto;
}
.menu-overlay[hidden]{
  display: none !important;
}

/* Drawer */
.mobile-drawer{
  position: fixed;
  top: 0;
  right: 0;
  width: min(86vw, 360px);
  height: 100vh;
  background: rgba(255,255,255,0.96);
  border-left: 1px solid rgba(0,0,0,0.08);
  z-index: 1100;

  transform: translateX(110%);
  transition: transform .25s ease;
  box-shadow: -30px 0 80px rgba(0,0,0,0.18);
  overflow-y: auto;
}
.mobile-drawer.is-open{
  transform: translateX(0);
}
.mobile-drawer[hidden]{
  display: none !important;
}

/* Lock scroll when menu open */
body.menu-open{
  overflow: hidden;
}

@media (max-width:560px){

  /* hide old desktop nav on mobile */
  #mainNav{ display:none !important; }

  /* Header layout: brand + hamburger */
  header{
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .header-left{width:auto}
  .header-right{width:auto}

  .logo-wrap{width:56px;height:56px;border-radius:16px}
  .logo-wrap img{width:44px;height:44px}
  .site-title h1{font-size:13px;line-height:1.25}
  .site-title p{font-size:11px}

  /* Hamburger */
  .menu-btn{
    display:inline-flex;
    width:46px;height:46px;
    border-radius:16px;
    border:1px solid rgba(0,0,0,0.08);
    background:rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items:center;
    justify-content:center;
    gap:5px;
    cursor:pointer;
    padding:0;
    box-shadow:0 10px 22px rgba(0,0,0,0.10);
  }
  .menu-btn span{
    display:block;
    width:18px;height:2px;
    background:rgba(0,0,0,0.75);
    border-radius:99px;
  }

  /* Show drawer + bottom bar on mobile */
  .mobile-drawer{ display:block; padding: 12px; }
  .mobile-bar{ display:flex; }

  /* Drawer head */
  .drawer-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    padding:8px 6px 12px;
    border-bottom:1px solid rgba(0,0,0,0.06);
  }
  .drawer-title{ font-weight:950; color:var(--black); font-size:14px; }
  .drawer-close{
    width:40px;height:40px;border-radius:14px;
    border:1px solid rgba(0,0,0,0.08);
    background:#fff;
    cursor:pointer;
    font-weight:950;
  }

  /* ✅ Equal-size buttons (compact & clean) */
  .drawer-nav{
    display:flex;
    flex-direction:column;
    gap:10px;
    padding-top:10px;
  }
  .drawer-link{
    width:100%;
    height:46px;                 /* ✅ همه هم‌قد */
    padding:0 12px;              /* ✅ جمع‌وجور */
    border-radius:16px;
    border:1px solid rgba(0,0,0,0.07);
    background:rgba(0,0,0,0.025);

    display:flex;
    align-items:center;
    justify-content:center;       /* ✅ وسط چین واقعی */
    text-align:center;

    text-decoration:none;
    font-weight:950;
    font-size:13px;
    line-height:1;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;

    box-shadow:0 10px 26px rgba(0,0,0,0.06);
    transition:transform .15s ease, background .15s ease, box-shadow .15s ease;
  }
  .drawer-link:active{
    transform:scale(.99);
    background:rgba(0,0,0,0.04);
    box-shadow:0 8px 18px rgba(0,0,0,0.06);
  }

  /* CTA same size */
  .drawer-cta{
    background:linear-gradient(90deg,var(--red),var(--deep));
    border:0;
    color:#fff;
    box-shadow:0 18px 45px rgba(226,35,35,0.20);
  }

  .drawer-sep{
    height:1px;
    background:rgba(0,0,0,0.06);
    margin:6px 0;
  }

  /* Bottom bar */
  .mobile-bar{
    position:fixed;
    left:10px; right:10px;
    bottom: calc(10px + var(--safe-bottom));
    height:66px;
    padding:10px;
    gap:10px;

    background:rgba(255,255,255,0.86);
    border:1px solid rgba(0,0,0,0.08);
    border-radius:20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:0 20px 70px rgba(0,0,0,0.16);
    z-index:1050;
  }
  .mb-item{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    text-decoration:none;
    color:var(--black);
    font-weight:950;
    border-radius:16px;
  }
  .mb-item svg{width:22px;height:22px;fill:rgba(0,0,0,0.85)}
  .mb-item span{font-size:11px;opacity:.88}
  .mb-item:active{background:rgba(0,0,0,0.04); transform:scale(.99)}

  /* prevent content under bar */
  body{ padding-bottom: calc(92px + var(--safe-bottom)); }

  /* backToTop not overlapping */
  #backToTop{
    left:12px;
    bottom: calc(92px + var(--safe-bottom));
    width:46px;
    height:46px;
    border-radius:16px;
    box-shadow:0 14px 32px rgba(0,0,0,0.22);
  }

  /* Mobile hero tighter */
  .hero{ padding: 12px 0 14px; }
  .hero-left{ padding:0; }
  .panel-white{ padding:14px; border-radius:16px; box-shadow: 0 18px 45px rgba(0,0,0,0.06); }
  .headline{ font-size:20px; line-height:1.25; }
  .tagline{ font-size:13px; margin:0 0 10px; }
  .slogan{ font-size:13px; margin:10px 0 12px; }

  /* Carousel swipe feel */
  .carousel-wrap{ border-radius:18px; }
  .books-track{
    gap:12px;
    padding:12px;
    overflow-x:auto;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .books-track::-webkit-scrollbar{display:none}
  .book-card{
    min-width:82vw;
    scroll-snap-align:start;
  }

  /* Footer compact */
  .footer{ padding: 22px 12px; }
}

/* Reduce hover effects on small screens */
@media (max-width:560px){
  .card:hover{ transform:none; box-shadow: 0 18px 45px rgba(0,0,0,0.06); }
  .btn{ width:100%; justify-content:center; }
  .btn-small{ width:auto; }
}
button,
input,
select,
textarea,
.btn{
  font-family: inherit;
}

