/* ============================================================
   WARAQ | وَرَق — bookstore styles
   Warm, editorial, RTL-first. Palette:
   ivory #F3EBDD · walnut #8B6248 · chocolate #593D2E
   terracotta #A96F55 · olive #77745A
   ============================================================ */

:root {
  --ivory: #F3EBDD;
  --ivory-soft: #FBF7EF;
  --paper: #FFFCF7;
  --walnut: #8B6248;
  --chocolate: #593D2E;
  --terracotta: #A96F55;
  --olive: #77745A;
  --ink: #4C3729;
  --muted: #7C6B5C;
  --line: #E4D8C7;
  --line-strong: #D4C1A9;
  --error: #A34E3B;
  --success: #5E7350;
  --shadow-sm: 0 6px 18px rgba(89, 61, 46, .07);
  --shadow-md: 0 16px 38px rgba(89, 61, 46, .11);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1220px;
  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Inter", "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--ivory-soft);
  font-family: var(--font-ar);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* very subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { max-width: 100%; }
img { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.35; color: var(--chocolate); }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
.latin { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }

:focus-visible { outline: 3px solid var(--terracotta); outline-offset: 3px; }

.container { width: min(calc(100% - 2.5rem), var(--max)); margin-inline: auto; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; top: -100px; right: 1rem; z-index: 200;
  background: var(--chocolate); color: var(--paper); padding: .7rem 1.2rem;
  border-radius: 0 0 10px 10px;
}
.skip-link:focus { top: 0; }

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */
.topbar {
  background: var(--chocolate);
  color: #EFE3D2;
  font-size: .8rem;
}
.topbar-inner {
  min-height: 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.topbar p { margin: 0; display: flex; align-items: center; gap: .55rem; }
.topbar a { color: #F4E9D8; border-bottom: 1px solid rgba(244,233,216,.45); }
.topbar a:hover { color: #fff; }
.topbar-dot { width: 7px; height: 7px; border-radius: 50%; background: #D9A884; display: inline-block; }

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251, 247, 239, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap {
  min-height: 78px;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px 4px 12px 4px;
  display: grid; place-items: center;
  background: var(--walnut); color: #FBF3E6;
  font-size: 1.35rem; font-weight: 700; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-latin { font-family: var(--font-en); font-weight: 700; font-size: 1.12rem; letter-spacing: .16em; color: var(--chocolate); }
.brand-arabic { font-size: .9rem; font-weight: 500; color: var(--terracotta); margin-top: .18rem; }

.desktop-nav { display: flex; align-items: center; gap: clamp(.9rem, 1.7vw, 1.8rem); }
.desktop-nav a {
  position: relative; font-size: .94rem; font-weight: 500; color: var(--ink);
  padding: .4rem 0; white-space: nowrap; transition: color .2s ease;
}
.desktop-nav a::after {
  content: ""; position: absolute; inset-inline-start: 0; bottom: -3px;
  width: 0; height: 2px; background: var(--terracotta); transition: width .25s ease;
}
.desktop-nav a:hover, .desktop-nav a[aria-current="page"] { color: var(--walnut); }
.desktop-nav a:hover::after, .desktop-nav a[aria-current="page"]::after { width: 100%; }
.cart-link { display: inline-flex; align-items: center; gap: .45rem; }
.cart-count, [data-cart-count] {
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--terracotta); color: #fff; font-family: var(--font-en);
  font-size: .72rem; font-weight: 700; line-height: 1;
}

.menu-toggle {
  display: none; width: 44px; height: 44px; padding: 10px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--paper); flex-direction: column; justify-content: center; gap: 5px;
}
.menu-toggle span { display: block; height: 2px; background: var(--chocolate); border-radius: 2px; transition: transform .25s, opacity .2s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  position: absolute; inset-inline: 0; top: 100%;
  background: var(--ivory-soft); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md); padding: .8rem 1.25rem 1.2rem;
  display: flex; flex-direction: column;
}
.mobile-nav a { padding: .8rem .4rem; border-bottom: 1px solid var(--line); font-weight: 500; display: flex; align-items: center; gap: .6rem; }
.mobile-nav a:last-child { border-bottom: 0; }
.mobile-nav a[aria-current="page"] { color: var(--terracotta); }

/* ------------------------------------------------------------
   Shared components
   ------------------------------------------------------------ */
.view[hidden] { display: none !important; }
.page { padding-block: 2.6rem 5rem; }
#main:focus { outline: none; }

.breadcrumb { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--muted); margin-bottom: 1.4rem; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--terracotta); }
.breadcrumb span[aria-hidden] { color: var(--line-strong); }

.page-head { margin-bottom: 2rem; max-width: 760px; }
.page-head h1 { margin-bottom: .55rem; }
.page-head > p:last-child { color: var(--muted); margin-bottom: 0; }

.kicker {
  color: var(--terracotta); font-size: .8rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: .4rem;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: .82rem 1.55rem; font-weight: 600; font-size: .93rem; line-height: 1.4;
  transition: transform .22s ease, background-color .22s ease, border-color .22s ease, color .22s ease, box-shadow .22s ease;
  text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--walnut); color: #FFF9F0; box-shadow: 0 8px 18px rgba(139,98,72,.2); }
.btn-primary:hover { background: var(--chocolate); box-shadow: 0 12px 24px rgba(89,61,46,.23); }
.btn-outline { border-color: var(--walnut); color: var(--walnut); background: transparent; }
.btn-outline:hover { background: var(--walnut); color: #fff; }
.btn-light { background: var(--ivory); color: var(--chocolate); }
.btn-light:hover { background: #fff; }
.btn-block { width: 100%; }
.text-link { color: var(--walnut); font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: .4rem; }
.text-link:hover { color: var(--terracotta); }

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero { position: relative; overflow: hidden; padding-block: clamp(3rem, 6vw, 5.4rem) clamp(3rem, 5vw, 4.6rem); }
.hero::before {
  content: ""; position: absolute; inset-inline-start: -8%; top: -20%;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(169,111,85,.08); filter: blur(20px);
}
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; position: relative; }
.hero-copy { max-width: 620px; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; color: var(--terracotta); font-weight: 600; font-size: .84rem; margin-bottom: 1rem; }
.hero-title { font-family: var(--font-en); font-size: clamp(2.9rem, 6.4vw, 5.4rem); font-weight: 700; letter-spacing: .1em; margin-bottom: .4rem; line-height: 1.1; }
.hero-word { display: block; font-family: var(--font-ar); font-size: .46em; letter-spacing: 0; color: var(--terracotta); font-weight: 600; margin-top: .35rem; }
.hero-welcome { font-size: clamp(1.05rem, 1.8vw, 1.3rem); font-weight: 600; color: var(--chocolate); margin-bottom: .3rem; }
.hero-tagline { font-size: clamp(1.2rem, 2.3vw, 1.7rem); font-weight: 600; color: var(--terracotta); margin-bottom: 1rem; }
.hero-desc { color: var(--muted); max-width: 520px; margin-bottom: 1.8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.6rem; }
.hero-meta { display: flex; align-items: center; gap: .7rem; font-size: .84rem; color: var(--muted); }

.hero-visual { position: relative; min-height: clamp(320px, 38vw, 470px); border-radius: 24px; }
.hero-photo {
  position: absolute; inset: 18px 0 0 0;
  border-radius: 22px; background-color: var(--walnut);
  background-image: linear-gradient(180deg, rgba(60,40,28,.05), rgba(60,40,28,.5)), url("https://images.unsplash.com/photo-1497633762265-9d179a990aa6?w=1100&q=85");
  background-size: cover; background-position: center;
  box-shadow: var(--shadow-md);
}
.hero-visual::after {
  content: ""; position: absolute; inset-inline: -10px; bottom: -12px; height: 26px;
  border-radius: 8px; background: #6D4A34; box-shadow: 0 12px 22px rgba(89,61,46,.25); z-index: 0;
}
.hero-covers { position: absolute; inset: 0; z-index: 2; }
.hero-covers .cover-frame {
  position: absolute; width: 112px; height: 168px; padding: 0;
  background: transparent; box-shadow: 0 16px 26px rgba(43,28,18,.35); border-radius: 4px;
}
.hero-covers .cover-frame:nth-child(1) { inset-inline-start: 8%; bottom: 8%; transform: rotate(-8deg); }
.hero-covers .cover-frame:nth-child(2) { inset-inline-start: 33%; bottom: 14%; width: 124px; height: 186px; transform: rotate(2deg); }
.hero-covers .cover-frame:nth-child(3) { inset-inline-start: 60%; bottom: 7%; transform: rotate(9deg); }
.hero-covers .cover-inner { height: 100%; }
.hero-covers .cover-img { width: 100%; height: 100%; object-fit: cover; }
.hero-covers .cover-fallback { width: 100%; height: 100%; border-radius: 4px; }
.hero-covers .cover-fallback-title { font-size: .72rem; }
.hero-covers .cover-fallback-author, .hero-covers .cover-fallback-brand { font-size: .5rem; }
.hero-stamp {
  position: absolute; z-index: 3; inset-inline-end: -14px; top: 10px;
  width: 124px; height: 124px; border-radius: 50%;
  background: var(--ivory); border: 1px solid var(--line-strong);
  display: grid; place-content: center; text-align: center;
  color: var(--chocolate); font-size: .82rem; font-weight: 600; line-height: 1.6;
  box-shadow: var(--shadow-sm); transform: rotate(7deg);
}
.hero-stamp span { color: var(--terracotta); font-weight: 500; font-size: .75rem; }

/* ------------------------------------------------------------
   Feature strip & section headings
   ------------------------------------------------------------ */
.feature-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.5rem; margin-bottom: 4.5rem; box-shadow: var(--shadow-sm);
}
.feature-item { display: flex; align-items: center; gap: .9rem; }
.feature-icon, .delivery-icon, .contact-icon, .aside-icon {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; background: #F3E7DA; color: var(--walnut);
}
.feature-icon svg, .delivery-icon svg, .contact-icon svg, .aside-icon svg { width: 24px; height: 24px; }
.feature-item h3 { margin-bottom: .1rem; font-size: .98rem; }
.feature-item p { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.6; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 1.6rem; }
.section-head h2 { margin-bottom: 0; }

/* ------------------------------------------------------------
   Book cards & grids
   ------------------------------------------------------------ */
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.35rem; margin-bottom: 4.5rem; }
.book-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-grid { margin-bottom: 1.5rem; }

.book-card {
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
  min-width: 0;
}
.book-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.cover-link { display: block; position: relative; }
.cover-frame {
  position: relative; height: 268px; padding: 22px;
  display: grid; place-items: center; overflow: hidden;
  background: #F1E6D7;
  background-image: radial-gradient(circle at 30% 20%, rgba(255,255,255,.7), transparent 60%);
}
.cover-frame::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 5px;
  background: rgba(139,98,72,.14);
}
.cover-inner { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.cover-img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; box-shadow: 7px 10px 22px rgba(62,42,29,.24);
  transition: transform .4s ease;
}
.book-card:hover .cover-img { transform: scale(1.045) rotate(-1.2deg); }
.cover-fallback {
  position: relative; width: 68%; height: 90%; border-radius: 3px 11px 11px 3px;
  background: var(--chocolate); color: #F6EAD9;
  box-shadow: inset 8px 0 0 rgba(255,255,255,.06), 7px 10px 22px rgba(62,42,29,.22);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .6rem; padding: 1rem .8rem; overflow: hidden;
  transition: transform .4s ease;
}
.cover-fallback::before, .cover-fallback::after {
  content: ""; position: absolute; inset-inline-start: 13px; inset-inline-end: 13px; height: 1px;
  background: rgba(246,234,217,.35);
}
.cover-fallback::before { top: 18px; }
.cover-fallback::after { bottom: 18px; }
.book-card:hover .cover-fallback { transform: scale(1.03) rotate(-1deg); }
.cover-fallback-brand { font-family: var(--font-en); font-size: .58rem; letter-spacing: .16em; color: #D9BFA5; }
.cover-fallback-title { font-size: .98rem; font-weight: 700; line-height: 1.45; max-height: 4.5em; overflow: hidden; }
.cover-fallback.is-en .cover-fallback-title { font-family: var(--font-en); font-size: .85rem; }
.cover-fallback-rule { width: 32px; height: 2px; background: var(--terracotta); }
.cover-fallback-author { font-size: .72rem; color: #E3CCB5; line-height: 1.5; max-height: 3em; overflow: hidden; }
.cover-fallback.is-en .cover-fallback-author { font-family: var(--font-en); }

.book-badge {
  position: absolute; top: 14px; inset-inline-start: 14px; z-index: 2;
  background: var(--terracotta); color: #fff; padding: .25rem .7rem;
  border-radius: 999px; font-size: .7rem; font-weight: 600;
}
.book-body { padding: 1.2rem 1.25rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.book-meta { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.lang-chip { font-size: .68rem; font-weight: 600; border-radius: 999px; padding: .2rem .6rem; }
.lang-chip.ar { background: #EFE4D5; color: var(--walnut); }
.lang-chip.en { background: #E7E8DC; color: var(--olive); font-family: var(--font-en); }
.book-cat { font-size: .72rem; color: var(--muted); }
.book-title { font-size: 1.08rem; margin-bottom: .18rem; }
.book-title.latin { font-family: var(--font-en); font-size: 1rem; line-height: 1.45; }
.book-author { color: var(--walnut); font-size: .84rem; margin-bottom: .7rem; }
.book-author.latin { font-family: var(--font-en); }
.book-desc {
  color: var(--muted); font-size: .82rem; line-height: 1.8; margin-bottom: 1.1rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; }
.price { color: var(--chocolate); font-size: .85rem; white-space: nowrap; }
.price strong { font-family: var(--font-en); font-size: 1.25rem; font-weight: 700; }
.btn-add {
  background: #F3E7DA; color: var(--walnut); border-color: transparent;
  border-radius: 10px; padding: .6rem .9rem; font-size: .8rem; font-weight: 600;
}
.btn-add:hover { background: var(--walnut); color: #fff; transform: translateY(-2px); }

/* ------------------------------------------------------------
   Delivery banner
   ------------------------------------------------------------ */
.delivery-banner { background: var(--walnut); color: #FBF1E4; padding-block: 3.2rem; margin-top: 1rem; }
.delivery-banner-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.delivery-banner .kicker { color: #E2BFA4; }
.delivery-banner h2 { color: #FFF9F0; margin-bottom: .4rem; font-size: clamp(1.4rem, 2.5vw, 2rem); }
.delivery-banner p:not(.kicker) { margin: 0; color: #EFDFCE; }
.delivery-banner .btn { flex-shrink: 0; }

/* ------------------------------------------------------------
   Shop toolbar
   ------------------------------------------------------------ */
.shop-toolbar { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.2rem; }
.search-box { position: relative; display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--ivory-soft); padding: .3rem .5rem .3rem 1rem; }
.search-box > svg { width: 19px; height: 19px; color: var(--walnut); flex-shrink: 0; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: .55rem .2rem; color: var(--ink); font-size: .92rem; }
.search-box input::placeholder { color: #A29284; }
.search-submit { background: var(--walnut); color: #fff; border: 0; border-radius: 999px; padding: .55rem 1.2rem; font-size: .85rem; font-weight: 600; transition: background .2s; }
.search-submit:hover { background: var(--chocolate); }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.filter-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-btn { background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: .45rem 1rem; font-size: .85rem; color: var(--ink); transition: .2s; }
.filter-btn:hover { border-color: var(--walnut); color: var(--walnut); }
.filter-btn.is-active { background: var(--chocolate); border-color: var(--chocolate); color: #FFF8EE; }
.sort-wrap { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--muted); }
.sort-wrap select { border: 1px solid var(--line-strong); background: var(--ivory-soft); color: var(--ink); border-radius: 10px; padding: .45rem .7rem; font-size: .82rem; }
.result-count { color: var(--muted); font-size: .85rem; margin-bottom: 1.1rem; }
.no-results { text-align: center; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 3rem 1.5rem; margin-bottom: 3rem; }
.no-results h3 { margin-bottom: .3rem; }
.no-results p { color: var(--muted); margin-bottom: 1.2rem; }

/* ------------------------------------------------------------
   Book detail
   ------------------------------------------------------------ */
.detail-grid { display: grid; grid-template-columns: minmax(280px, .85fr) 1.15fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; margin-bottom: 4rem; }
.cover-frame--detail { height: 470px; border-radius: var(--radius); border: 1px solid var(--line); background-color: #EFE2D1; }
.cover-frame--detail .cover-fallback { width: 66%; }
.detail-info .lang-chip { display: inline-block; margin-bottom: 1rem; }
.detail-info h1 { margin-bottom: .25rem; }
.detail-info h1.latin { font-family: var(--font-en); font-size: clamp(1.7rem, 3.5vw, 2.6rem); letter-spacing: -.02em; }
.detail-author { color: var(--walnut); font-size: 1.05rem; margin-bottom: 1.4rem; }
.detail-author.latin { font-family: var(--font-en); }
.detail-desc { color: var(--muted); line-height: 2; margin-bottom: 1.5rem; max-width: 640px; }
.detail-facts { display: flex; gap: 1.5rem; flex-wrap: wrap; border-block: 1px solid var(--line); padding-block: 1rem; margin-bottom: 1.5rem; }
.detail-fact span { display: block; font-size: .75rem; color: var(--muted); }
.detail-fact strong { font-size: .95rem; color: var(--chocolate); }
.detail-buy { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.detail-buy .price strong { font-size: 1.8rem; }
.detail-note { font-size: .84rem; color: var(--muted); }
.detail-note a { color: var(--walnut); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); overflow: hidden; direction: ltr; }
.qty button { width: 38px; height: 38px; border: 0; background: transparent; color: var(--walnut); font-size: 1.2rem; line-height: 1; display: grid; place-items: center; }
.qty button:hover { background: #F3E7DA; }
.qty span, .qty input { min-width: 30px; width: 30px; text-align: center; font-family: var(--font-en); font-weight: 600; color: var(--chocolate); }
.qty input { border: 0; outline: 0; background: transparent; padding: 0; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty--sm button { width: 30px; height: 30px; font-size: 1rem; }
.qty--sm span { min-width: 24px; font-size: .85rem; }

/* ------------------------------------------------------------
   Cart & summary
   ------------------------------------------------------------ */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 1.6rem; align-items: start; }
.cart-list, .summary-card, .checkout-form-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.cart-list { padding: .4rem 1.3rem; }
.cart-item { display: grid; grid-template-columns: 78px minmax(120px, 1fr) auto auto auto; gap: 1rem; align-items: center; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-thumb { display: block; }
.cart-thumb .cover-frame { width: 78px; height: 104px; padding: 4px; border-radius: 6px; background: #F1E6D7; }
.cart-thumb .cover-fallback { width: 90%; height: 92%; padding: .4rem; gap: .2rem; }
.cart-thumb .cover-fallback::before, .cart-thumb .cover-fallback::after, .cart-thumb .cover-fallback-brand, .cart-thumb .cover-fallback-author { display: none; }
.cart-thumb .cover-fallback-title { font-size: .6rem; height: auto; max-height: 3.6em; }
.cart-thumb .cover-fallback-rule { width: 18px; height: 1px; }
.cart-info h3 { font-size: .96rem; margin-bottom: .1rem; }
.cart-info h3.latin { font-family: var(--font-en); font-size: .9rem; }
.cart-info p { color: var(--muted); font-size: .78rem; margin-bottom: .25rem; }
.cart-info .price { font-size: .78rem; }
.cart-info .price strong { font-size: 1rem; }
.line-total { font-family: var(--font-en); color: var(--chocolate); font-size: .95rem; white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; border-radius: 9px; color: var(--muted); transition: .2s; }
.icon-btn:hover { background: #F7E7E0; border-color: #E0B9AC; color: var(--error); }
.icon-btn svg { width: 17px; height: 17px; }

.summary-card, .checkout-form-card { padding: 1.5rem; }
.summary-card { position: sticky; top: 105px; }
.summary-card h2, .checkout-form-card h2 { font-size: 1.25rem; margin-bottom: 1.1rem; }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; font-size: .9rem; }
.summary-row span:first-child { color: var(--muted); }
.summary-row.total { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: 1rem; font-size: 1rem; font-weight: 700; color: var(--chocolate); }
.summary-row.total strong { font-family: var(--font-en); font-size: 1.4rem; }
.summary-note { background: var(--ivory); border-radius: var(--radius-sm); padding: .9rem 1rem; font-size: .8rem; color: var(--muted); line-height: 1.8; margin: 1.2rem 0; }
.summary-actions { display: grid; gap: .7rem; }
.empty-state { text-align: center; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 4rem 1.5rem; }
.empty-state .empty-icon { width: 74px; height: 74px; margin: 0 auto 1.2rem; border-radius: 50%; background: #F3E7DA; color: var(--walnut); display: grid; place-items: center; }
.empty-state .empty-icon svg { width: 34px; height: 34px; }
.empty-state h2 { margin-bottom: .4rem; }
.empty-state p { color: var(--muted); margin-bottom: 1.4rem; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .87rem; font-weight: 600; color: var(--chocolate); margin-bottom: .4rem; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line-strong); background: var(--ivory-soft);
  border-radius: var(--radius-sm); padding: .8rem .9rem; color: var(--ink); font-size: .92rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input::placeholder { color: #A29284; }
.field input:focus, .field select:focus { outline: 0; border-color: var(--walnut); box-shadow: 0 0 0 3px rgba(139,98,72,.12); background: #fff; }
.field input.invalid { border-color: var(--error); background: #FFF8F5; }
.field-error { display: block; min-height: 1.1rem; color: var(--error); font-size: .76rem; margin-top: .25rem; }
.form-message { border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .86rem; margin-top: .5rem; line-height: 1.8; }
.form-message.info { background: #EEEFE6; color: #4F5B42; border: 1px solid #D5DAC6; }
.form-message.error { background: #FBEDE8; color: var(--error); border: 1px solid #EBC6BB; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .4rem; }
.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.checkout-grid .field--full { grid-column: 1 / -1; }
.whatsapp-btn { background: #5B8C6B; color: #fff; }
.whatsapp-btn:hover { background: #4A7457; }
.whatsapp-btn svg { width: 19px; height: 19px; }

.auth-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 1.6rem; align-items: start; }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: clamp(1.5rem, 4vw, 2.6rem); }
.auth-card h1 { font-size: 1.8rem; margin-bottom: .25rem; }
.auth-intro { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.auth-tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: .7rem 1rem; color: var(--muted); font-weight: 600; font-size: .92rem; margin-bottom: -1px; }
.auth-tab:hover { color: var(--walnut); }
.auth-tab.is-active { color: var(--walnut); border-bottom-color: var(--terracotta); }
.auth-aside { background: #EEEFE5; border: 1px solid #DBDFC9; border-radius: var(--radius); padding: 1.7rem; }
.auth-aside .aside-icon { background: #DFE3D0; color: var(--olive); margin-bottom: 1rem; }
.auth-aside h2 { font-size: 1.2rem; margin-bottom: .7rem; }
.auth-aside p { font-size: .85rem; color: #5F6452; line-height: 1.9; }

.auth-switch { text-align: center; font-size: .86rem; color: var(--muted); margin-top: 1.1rem; }
.auth-switch button { background: transparent; border: 0; color: var(--walnut); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------
   About / contact / delivery
   ------------------------------------------------------------ */
.about-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; margin-bottom: 3.5rem; }
.about-photo {
  min-height: 420px; border-radius: 22px; background-color: var(--walnut);
  background-image: linear-gradient(180deg, rgba(60,40,28,.05), rgba(60,40,28,.4)), url("https://images.unsplash.com/photo-1507842217343-583bb7270b66?w=1000&q=85");
  background-size: cover; background-position: center; box-shadow: var(--shadow-md);
}
.about-copy h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); margin-bottom: 1rem; }
.about-lead { font-size: 1.02rem; line-height: 2.15; color: var(--chocolate); margin-bottom: 1rem; }
.about-copy > p:not(.about-lead) { color: var(--muted); line-height: 2; margin-bottom: 1.4rem; }
.values-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.value-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); }
.value-card > span { font-family: var(--font-en); color: var(--terracotta); font-weight: 700; font-size: 1.1rem; }
.value-card h3 { margin: .6rem 0 .4rem; }
.value-card p { color: var(--muted); font-size: .88rem; margin: 0; }

.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem; margin-bottom: 2rem; }
.contact-card { display: flex; flex-direction: column; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); transition: .25s; }
.contact-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.contact-card .contact-icon { width: 52px; height: 52px; margin-bottom: 1rem; }
.contact-label { font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }
.contact-card strong { font-family: var(--font-en); font-size: 1.1rem; color: var(--chocolate); word-break: break-all; }
.contact-action { color: var(--walnut); font-size: .85rem; font-weight: 600; margin-top: 1rem; }
.contact-note { background: #EEEFE5; border-radius: var(--radius); padding: 1.6rem; }
.contact-note h2 { font-size: 1.15rem; margin-bottom: .4rem; }
.contact-note p { color: #5F6452; font-size: .9rem; margin: 0; }

.delivery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-bottom: 2rem; }
.delivery-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-sm); }
.delivery-icon { width: 52px; height: 52px; margin-bottom: 1rem; background: #EFE4D5; }
.delivery-card h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.delivery-card p { color: var(--muted); font-size: .87rem; margin: 0; }
.delivery-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.8rem; }
.delivery-cta p { margin: 0; color: var(--chocolate); font-weight: 600; }

/* ------------------------------------------------------------
   Footer & toast
   ------------------------------------------------------------ */
.site-footer { background: var(--chocolate); color: #E9DCCB; padding-top: 3.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 2rem; padding-bottom: 2.5rem; }
.site-footer .brand-mark { background: #A67C5F; color: #FFF6EA; }
.site-footer .brand-latin { color: #FFF6EA; }
.site-footer .brand-arabic { color: #D6B295; }
.footer-brand > p { font-size: .9rem; margin: 1rem 0 .3rem; }
.footer-small { font-size: .78rem; color: #C4B29F; line-height: 1.9; }
.site-footer h2 { color: #FFF6EA; font-size: 1rem; margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a { font-size: .86rem; color: #D9C8B5; }
.footer-links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.13); padding-block: 1.2rem; font-size: .78rem; color: #C4B29F; }
.footer-bottom p { margin: 0; }

.toast {
  position: fixed; z-index: 120; bottom: 24px; inset-inline-start: 50%; transform: translate(-50%, 18px);
  background: var(--chocolate); color: #FFF8EE; padding: .85rem 1.4rem; border-radius: 999px;
  box-shadow: 0 14px 32px rgba(50,32,22,.3); font-size: .88rem; font-weight: 500;
  opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s, visibility .25s;
  max-width: calc(100% - 2rem); text-align: center;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ------------------------------------------------------------
   Responsive — tablet
   ------------------------------------------------------------ */
@media (max-width: 1080px) {
  .book-grid, .book-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .desktop-nav { gap: .9rem; }
  .desktop-nav a { font-size: .85rem; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .menu-toggle { display: flex; }
  .nav-wrap { min-height: 70px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 100%; }
  .hero-visual { min-height: 360px; max-width: 560px; width: 100%; margin-inline: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .cover-frame--detail { max-width: 420px; height: 440px; margin-inline: auto; }
  .cart-layout, .checkout-layout, .auth-layout { grid-template-columns: 1fr; }
  .summary-card { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { min-height: 300px; }
}

@media (max-width: 720px) {
  .book-grid, .book-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .feature-strip { grid-template-columns: 1fr; gap: .9rem; margin-bottom: 3.2rem; }
  .delivery-banner-inner { flex-direction: column; align-items: flex-start; }
  .values-grid, .delivery-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .checkout-grid { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 64px 1fr auto; gap: .7rem; padding-block: 1rem; }
  .cart-thumb .cover-frame { width: 64px; height: 86px; }
  .cart-item .qty { grid-column: 2; }
  .cart-item .line-total { grid-column: 3; grid-row: 2; }
  .cart-item .icon-btn { grid-column: 3; grid-row: 1; justify-self: end; }
  .delivery-cta { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .container { width: min(calc(100% - 1.6rem), var(--max)); }
  .topbar-inner { justify-content: center; text-align: center; }
  .topbar a { display: none; }
  .topbar p { font-size: .72rem; }
  .hero { padding-top: 2.4rem; }
  .hero-title { font-size: 2.9rem; }
  .hero-visual { min-height: 300px; }
  .hero-stamp { width: 92px; height: 92px; font-size: .68rem; inset-inline-end: -4px; }
  .hero-covers .cover-frame { width: 88px; height: 132px; }
  .hero-covers .cover-frame:nth-child(2) { width: 98px; height: 146px; }
  .book-grid, .book-grid--three { grid-template-columns: 1fr; }
  .cover-frame { height: 290px; }
  .book-foot { flex-direction: row; }
  .section-head { align-items: flex-start; flex-direction: column; gap: .3rem; }
  .page { padding-block: 1.8rem 3.5rem; }
  .toolbar-row { align-items: stretch; flex-direction: column; }
  .sort-wrap { justify-content: space-between; }
  .search-box { padding-inline-start: .8rem; }
  .search-submit { padding-inline: .9rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .detail-buy { align-items: stretch; }
  .detail-buy .btn { width: 100%; }
  .auth-card { padding: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
