/* ==========================================================================
   084 · FOLIO (دار المطويّة — Folio Press) — 1:1 Literary House & Clothbound Editions
   Parchment #F3ECDD · Ivory Sheet #FAF6EC · Slate Ink #2B3A55 · Midnight #16213A · Vermilion #C84B31 · Gold #E6B655
   ========================================================================== */

:root {
  --cream: #F3ECDD;
  --page: #FAF6EC;
  --ink: #2B3A55;
  --ink-deep: #16213A;
  --vermilion: #C84B31;
  --gold: #E6B655;
  --green: #4E7D5B;
  --rule: 1px solid rgba(43, 58, 85, 0.26);
  --serif: 'Amiri', Georgia, serif;
  --sans: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  letter-spacing: 0;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input { font-family: var(--sans); letter-spacing: 0; }
.bidi { unicode-bidi: isolate; font-family: var(--mono); }

/* Signature Bookmark-Tab CTA (.tab-btn) */
.fl-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: var(--ink);
  color: var(--page);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.fl-tab-btn::after {
  content: "";
  width: 14px;
  height: 100%;
  position: absolute;
  top: 0;
  inset-inline-end: -10px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%);
  transition: transform 0.22s ease;
}

.fl-tab-btn:hover { background: var(--ink-deep); }
.fl-tab-btn:hover::after { transform: translateX(-4px); }

/* ======================== FIXED 3-COLUMN NAVBAR ======================== */
.fl-nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: 64px;
  z-index: 70;
  padding: 0 clamp(18px, 3.5vw, 52px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  color: var(--cream);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.fl-nav.stuck {
  background: rgba(243, 236, 221, 0.94);
  backdrop-filter: blur(10px);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(43, 58, 85, 0.2);
}

.fl-brand {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap;
}

.fl-brand strong { font-family: var(--serif); font-size: 20px; }
.fl-brand small { font-family: var(--mono); font-size: 10px; opacity: 0.78; }

.fl-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-style: italic;
  font-size: 16.5px;
  white-space: nowrap;
}

.fl-links a:hover { color: var(--gold); }
.fl-nav.stuck .fl-links a:hover { color: var(--vermilion); }

.fl-nav-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  white-space: nowrap;
}

.fl-bag-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: inherit;
  background: transparent;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.fl-bag-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--vermilion);
  color: #FFFFFF;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.fl-preorder-top {
  padding: 8px 16px;
  background: var(--gold);
  color: var(--ink-deep);
  font-weight: 800;
  font-size: 12.5px;
}

/* Slide-Over Bag Drawer */
.fl-drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  bottom: 0;
  width: min(420px, 92vw);
  z-index: 95;
  background: var(--page);
  color: var(--ink);
  border-inline-start: 1px solid rgba(43, 58, 85, 0.25);
  box-shadow: -16px 0 40px rgba(22, 33, 58, 0.28);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateX(-105%);
  transition: transform 0.28s ease;
}

.fl-drawer.open { transform: translateX(0); }

/* ======================== 1. HERO (100svh POP-UP DIORAMA + BOOK FLAP) ======================== */
.fl-hero {
  position: relative;
  min-height: 100dvh;
  background: var(--ink-deep);
  color: var(--cream);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fl-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
}

.fl-hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22,33,58,0.72) 0%, rgba(22,33,58,0.18) 46%, rgba(22,33,58,0.85) 100%);
  pointer-events: none;
}

/* Halftone Print Lens Ring */
.fl-lens-ring {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1.5px dashed var(--vermilion);
  pointer-events: none;
  z-index: 4;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(rgba(230, 182, 85, 0.24) 1.5px, transparent 2px);
  background-size: 8px 8px;
}

.fl-lens-ring.on { opacity: 1; }

.fl-lens-ring span {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--page);
  color: var(--vermilion);
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  white-space: nowrap;
}

.fl-hero-rules {
  position: relative;
  z-index: 3;
  margin: 68px clamp(18px, 3.5vw, 52px) 0;
  padding-top: 8px;
  border-top: 1px solid rgba(243, 236, 221, 0.3);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(243, 236, 221, 0.78);
}

.fl-masthead {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 18px 24px;
  max-width: 980px;
  margin: 0 auto;
}

.fl-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gold);
  display: inline-block;
  margin-bottom: 10px;
}

.fl-h1 {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 6.2vw, 5.5rem);
  font-weight: 400;
  line-height: 1.08;
}

.fl-h1 em {
  font-style: italic;
  color: var(--gold);
}

/* Inset Cream Book Flap Bar (.flap) */
.fl-flap {
  position: relative;
  z-index: 5;
  margin: 0 clamp(18px, 3.5vw, 52px);
  background: var(--page);
  color: var(--ink);
  border-radius: 4px 4px 0 0;
  padding: 22px 28px;
  box-shadow: 0 -18px 40px -20px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: 1.3fr auto auto;
  align-items: center;
  gap: 28px;
}

.fl-flap-sub {
  font-style: italic;
  font-size: 18.5px;
  line-height: 1.45;
}

.fl-flap-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: rgba(43, 58, 85, 0.72);
  margin-top: 4px;
}

.fl-countdown {
  padding-inline-start: 24px;
  border-inline-start: var(--rule);
  text-align: center;
}

.fl-countdown strong {
  display: block;
  font-family: var(--serif);
  font-size: 46px;
  line-height: 0.95;
  color: var(--vermilion);
}

.fl-countdown small {
  font-family: var(--sans);
  font-size: 11.5px;
}

/* ======================== 2. RIBBON CHAPTER & LETTER ======================== */
.fl-sec {
  max-width: 1180px;
  margin: 0 auto;
  padding: 88px 28px;
  border-bottom: var(--rule);
  position: relative;
}

.fl-ribbon-mark {
  position: absolute;
  top: 0;
  inset-inline-start: 38px;
  width: 20px;
  height: 110px;
  background: var(--vermilion);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
}

.fl-split-letter {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 42px;
  align-items: start;
  margin-top: 18px;
}

.fl-h2 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  font-weight: 400;
  line-height: 1.15;
}

.fl-h2 em { color: var(--vermilion); font-style: italic; }

.fl-dropcap::first-letter {
  font-size: 3.2em;
  line-height: 0.85;
  float: right;
  margin-inline-end: 10px;
  color: var(--vermilion);
}

.fl-beats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 42px;
}

.fl-beat-card {
  background: var(--page);
  border: var(--rule);
  padding: 20px;
}

/* ======================== 3. EDITIONS 3-COLUMN GRID (.editions) ======================== */
.fl-editions-wrap {
  background: var(--page);
  border-bottom: var(--rule);
}

.fl-ed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 38px;
}

.fl-ed-card {
  position: relative;
  background: var(--cream);
  border: var(--rule);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fl-swallowtail {
  position: absolute;
  top: 0;
  inset-inline-end: 20px;
  background: var(--gold);
  color: var(--ink-deep);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  padding: 8px 10px 16px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  z-index: 2;
}

.fl-ed-cover {
  aspect-ratio: 4 / 4.3;
  background: var(--ink-deep);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fl-ed-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fl-scarcity-bar {
  height: 6px;
  background: rgba(43, 58, 85, 0.14);
  overflow: hidden;
}

.fl-scarcity-bar i {
  display: block;
  height: 100%;
  background: var(--vermilion);
}

.fl-ed-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fl-price {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--ink-deep);
}

/* ======================== 4. INTERACTIVE CHAPTER ONE READER ======================== */
.fl-reader-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 40px;
  align-items: center;
}

.fl-page-card {
  background: var(--page);
  border: var(--rule);
  box-shadow: inset -18px 0 32px -20px rgba(0, 0, 0, 0.22), 0 18px 40px -24px rgba(22, 33, 58, 0.3);
  padding: 36px 34px 28px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fl-reader-controls {
  margin-top: 22px;
  padding-top: 14px;
  border-top: var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 13px;
}

.fl-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: var(--rule);
  background: var(--cream);
  cursor: pointer;
  font-size: 16px;
}

.fl-circle-btn:hover { background: var(--vermilion); color: #FFFFFF; }

/* ======================== 5. DARK NAVY AUTHOR BAND + PRESS TICKER ======================== */
.fl-author-band {
  background: var(--ink-deep);
  color: var(--cream);
  padding-top: 84px;
}

.fl-press-ticker {
  margin-top: 56px;
  border-top: 1px solid rgba(243, 236, 221, 0.2);
  border-bottom: 1px solid rgba(243, 236, 221, 0.2);
  padding: 16px 0;
  overflow: hidden;
}

.fl-press-track {
  display: flex;
  gap: 44px;
  width: max-content;
  animation: flTicker 34s linear infinite;
}

@keyframes flTicker {
  from { transform: translateX(0); }
  to { transform: translateX(50%); }
}

/* Tour Filter Rows & Footer */
.fl-city-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0;
}

.fl-city-pill {
  padding: 7px 16px;
  border: var(--rule);
  border-radius: 999px;
  background: var(--page);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fl-city-pill.active {
  background: var(--ink);
  color: var(--cream);
}

.fl-tour-row {
  padding: 16px 6px;
  border-bottom: var(--rule);
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 16px;
  font-family: var(--sans);
  font-size: 14.5px;
}

.fl-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 52px 28px 36px;
  font-family: var(--sans);
  font-size: 13.5px;
}

.fl-showcase-nav {
  margin-top: 28px;
  padding-top: 20px;
  border-top: var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .fl-links, .fl-hero-rules { display: none; }
  .fl-flap,
  .fl-split-letter,
  .fl-beats-row,
  .fl-ed-grid,
  .fl-reader-grid,
  .fl-tour-row {
    grid-template-columns: 1fr;
  }
}
