/* ==========================================================================
   Page-specific styles — home, auth, scenario, checkout, order, dashboard, legal
   ========================================================================== */

/* ---------------------------------------------------------------- home hero */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(94vh, 900px);
  padding: calc(var(--header-h) + var(--sp-12)) 0 var(--sp-16);
  background:
    var(--contours) 70% 20% / 820px repeat,
    radial-gradient(70% 80% at 78% 30%, rgba(34, 53, 85, 0.75) 0%, rgba(10, 19, 34, 0) 70%),
    radial-gradient(60% 50% at 10% 100%, rgba(176, 40, 31, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, var(--c-navy-950) 0%, var(--c-navy-900) 45%, var(--bg) 100%);
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
.hero__grid { display: grid; gap: var(--sp-12); align-items: center; grid-template-columns: 1fr; }
.hero__title { font-size: var(--fs-5xl); line-height: 1.02; margin-top: var(--sp-5); }
html[lang='ar'] .hero__title { line-height: 1.25; }
.hero__title em { font-style: normal; color: var(--c-beige); }
.hero__lead { margin-top: var(--sp-6); max-width: 54ch; font-size: var(--fs-lg); color: var(--text-muted); }
.hero__ctas { margin-top: var(--sp-8); display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.hero__stats {
  margin-top: var(--sp-12);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  max-width: 560px;
}
.hero__stat b { display: block; white-space: nowrap; font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 500; color: var(--heading); line-height: 1.1; }
.hero__stat span { font-size: var(--fs-xs); color: var(--text-dim); }
.hero__scroll { position: absolute; bottom: var(--sp-6); inset-inline-start: 50%; translate: -50% 0; font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: 0.3em; color: var(--text-dim); text-transform: uppercase; }
html[dir='rtl'] .hero__scroll { translate: 50% 0; }

/* Dossier composition */
.file-stack { position: relative; width: min(100%, 440px); aspect-ratio: 4 / 5; margin-inline: auto; perspective: 1400px; }
.file-stack__sheet {
  position: absolute;
  inset: 4% 6%;
  border-radius: 4px;
  background: var(--paper-fibers), linear-gradient(170deg, #F0E7D6, #DCCDB0);
  box-shadow: var(--shadow-paper);
}
.file-stack__sheet:nth-child(1) { transform: rotate(-7deg) translate(-4%, 2%); opacity: 0.55; }
.file-stack__sheet:nth-child(2) { transform: rotate(4deg) translate(5%, -1%); opacity: 0.8; }
.file-stack__folder {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  color: var(--paper-ink);
  background: var(--paper-fibers), linear-gradient(165deg, #CDB58A 0%, #B89A68 100%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  padding: 12% 10% 9%;
  display: flex;
  flex-direction: column;
  animation: folder-in 1.1s var(--ease-out) both 0.15s;
}
.file-stack__folder::before {
  content: '';
  position: absolute;
  top: -5.5%;
  inset-inline-start: 8%;
  width: 34%;
  height: 7%;
  border-radius: 6px 6px 0 0;
  background: #C6AC7E;
}
@keyframes folder-in { from { opacity: 0; transform: translateY(26px) rotate(-2deg); } }
.file-stack__label {
  align-self: flex-start;
  padding: 6px 12px;
  background: #F6F0E4;
  border: 1px solid rgba(43, 38, 32, 0.25);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.file-stack__num { margin-top: auto; font-family: var(--font-mono); font-size: clamp(3rem, 2.2rem + 3vw, 5rem); font-weight: 500; line-height: 1; color: #2B2117; }
.file-stack__title { margin-top: var(--sp-3); font-family: var(--font-display); font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); color: #1D1610; line-height: 1.15; }
html[lang='ar'] .file-stack__title { font-weight: 700; }
.file-stack__place { margin-top: var(--sp-2); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(43, 33, 23, 0.7); }
.file-stack__stamp { position: absolute; top: 52%; inset-inline-end: 12%; }
.file-stack__folder .stamp { color: #A3241B; mix-blend-mode: multiply; opacity: 0.8; }
.file-stack__photo {
  position: absolute;
  top: 16%;
  inset-inline-end: -8%;
  width: 42%;
  aspect-ratio: 1;
  padding: 6px 6px 22px;
  background: #F4F1EA;
  box-shadow: 0 18px 30px -12px rgba(0, 0, 0, 0.6);
  transform: rotate(6deg);
  animation: photo-in 1.2s var(--ease-out) both 0.45s;
}
.file-stack__photo-inner {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(60% 50% at 40% 40%, rgba(255, 255, 255, 0.25), transparent 70%),
    linear-gradient(160deg, #4B5563, #1F2733);
  filter: grayscale(1) contrast(1.1);
  position: relative;
}
.file-stack__photo-inner::after { content: ''; position: absolute; inset: 0; background-image: var(--grain); opacity: 0.5; mix-blend-mode: overlay; }
.file-stack__photo-cap { position: absolute; bottom: 4px; inset-inline: 8px; font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.14em; color: #4A4238; }
@keyframes photo-in { from { opacity: 0; transform: translate(20px, -10px) rotate(14deg); } }
.file-stack__clip {
  position: absolute;
  top: 10%;
  inset-inline-end: 22%;
  width: 16px;
  height: 54px;
  border: 2.5px solid #9AA1AA;
  border-radius: 10px;
  z-index: 3;
  transform: rotate(8deg);
}
.file-stack__tag { position: absolute; bottom: 9%; inset-inline-end: -4%; transform: rotate(-4deg); }

/* ---------------------------------------------------------------- newsletter */
.newsletter { display: grid; gap: var(--sp-8); align-items: center; padding: var(--sp-10); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: radial-gradient(80% 120% at 100% 0%, rgba(34, 53, 85, 0.6), transparent 60%), var(--surface); }
.newsletter__form { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.newsletter__form .input { flex: 1 1 240px; }

/* ---------------------------------------------------------------- auth */
.auth { display: grid; min-height: calc(100dvh - var(--header-h)); grid-template-columns: 1fr; }
.auth__visual {
  display: none;
  position: relative;
  padding: var(--sp-16);
  background: var(--contours) center / 700px, radial-gradient(90% 80% at 30% 20%, rgba(34, 53, 85, 0.8), transparent 70%), var(--c-navy-950);
  border-inline-end: 1px solid var(--border);
  overflow: hidden;
}
.auth__visual-inner { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-10); }
.auth__quote { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.2; color: var(--heading); max-width: 18ch; }
html[lang='ar'] .auth__quote { font-weight: 700; line-height: 1.4; }
.auth__main { display: flex; align-items: center; justify-content: center; padding: var(--sp-10) var(--gutter); }
.auth__card { width: min(460px, 100%); }
.auth__card h1 { font-size: var(--fs-3xl); }
.auth__card .lead { margin-top: var(--sp-3); color: var(--text-muted); }
.auth__alt { margin-top: var(--sp-6); text-align: center; font-size: var(--fs-sm); color: var(--text-muted); }
.password-toggle { min-height: 40px; }

/* ---------------------------------------------------------------- scenario page */
.case-hero {
  position: relative;
  padding: var(--sp-10) 0 var(--sp-12);
  background:
    var(--contours) 80% 0 / 760px,
    radial-gradient(80% 90% at 85% 0%, var(--case-glow, rgba(34, 53, 85, 0.7)) 0%, transparent 65%),
    linear-gradient(180deg, var(--case-bg-top, var(--c-navy-900)), var(--bg));
  border-bottom: 1px solid var(--border);
}
.case-hero__grid { display: grid; gap: var(--sp-10); grid-template-columns: 1fr; align-items: start; margin-top: var(--sp-6); }
.case-hero__cover { max-width: 420px; width: 100%; margin-inline: auto; }
.case-hero__cover .cover { box-shadow: var(--shadow-lg); }
.case-hero__title { font-size: var(--fs-4xl); margin-top: var(--sp-3); }
.case-hero__subtitle { margin-top: var(--sp-2); font-family: var(--font-display); font-size: var(--fs-xl); color: var(--c-beige); font-style: italic; }
html[lang='ar'] .case-hero__subtitle { font-style: normal; font-family: var(--font-body); font-weight: 500; }
.case-hero__place { margin-top: var(--sp-4); display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.case-hero__lead { margin-top: var(--sp-5); font-size: var(--fs-lg); color: var(--text-muted); max-width: 62ch; }
.case-hero__actions { margin-top: var(--sp-6); display: flex; flex-wrap: wrap; gap: var(--sp-3); }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: var(--sp-8); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--border); }
/* No empty cells: the last fact stretches across any leftover columns. */
.fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fact { padding: var(--sp-4) var(--sp-5); background: rgba(13, 16, 21, 0.85); display: grid; gap: 4px; }
.fact__value { color: var(--heading); font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); min-height: 26px; }
.fact__value svg { width: 18px; height: 18px; color: var(--c-beige); }

.buy-box { display: grid; gap: var(--sp-5); padding: var(--sp-6); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: linear-gradient(180deg, rgba(244, 238, 227, 0.04), rgba(244, 238, 227, 0)), var(--surface); box-shadow: var(--shadow); }
.buy-box__price { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.access-list { display: grid; gap: var(--sp-3); }
.access-item { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); }
.access-item svg { width: 20px; height: 20px; color: var(--c-beige); flex-shrink: 0; margin-top: 2px; }
.access-item b { display: block; color: var(--heading); font-weight: 600; }
.access-item span { color: var(--text-muted); }

.case-section { padding: var(--sp-10) 0; border-bottom: 1px solid var(--border); }
.case-section:last-child { border-bottom: 0; }
.case-section h2 { font-size: var(--fs-2xl); margin-bottom: var(--sp-5); }
.case-section .prose { color: var(--text-muted); white-space: pre-line; }

.teaser-note {
  position: relative;
  padding: var(--sp-8) var(--sp-8) var(--sp-8);
  color: var(--paper-ink);
  background: var(--paper-fibers), linear-gradient(175deg, #F3ECDD, #E5D9C1);
  border-radius: 3px;
  box-shadow: var(--shadow-paper);
  transform: rotate(-0.6deg);
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  line-height: 1.8;
  white-space: pre-line;
}
html[lang='ar'] .teaser-note { font-family: var(--font-display); font-size: var(--fs-lg); }
.teaser-note::before {
  content: '';
  position: absolute;
  top: -12px;
  inset-inline-start: 40%;
  width: 110px;
  height: 26px;
  background: rgba(230, 220, 190, 0.7);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transform: rotate(-3deg);
}
.teaser-note .label { color: #8A2A1F; margin-bottom: var(--sp-3); display: block; }

.gallery { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.gallery__item { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); padding: 0; background: var(--surface); }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.gallery__item:hover img { transform: scale(1.06); }
.gallery__item .evidence-tag { position: absolute; bottom: 8px; inset-inline-start: 8px; }

.check-list { display: grid; gap: var(--sp-3); }
.check-list li { display: flex; gap: var(--sp-3); align-items: flex-start; color: var(--text); }
.check-list svg { width: 18px; height: 18px; color: var(--c-success); flex-shrink: 0; margin-top: 4px; }

.mobile-buy-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--gutter) calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: rgba(13, 16, 21, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-strong);
  transform: translateY(110%);
  transition: transform var(--dur) var(--ease-out);
}
.mobile-buy-bar.is-visible { transform: none; }

/* ---------------------------------------------------------------- checkout */
.stepper { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-8); overflow-x: auto; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.stepper__item { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-pill); font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; border: 1px solid var(--border); }
.stepper__num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(244, 238, 227, 0.07); font-family: var(--font-mono); font-size: 0.7rem; }
.stepper__item.is-current { color: var(--heading); border-color: var(--c-beige); }
.stepper__item.is-current .stepper__num { background: var(--c-ivory); color: var(--c-ink-900); }
.stepper__item.is-done { color: var(--text-muted); }
.stepper__item.is-done .stepper__num { background: var(--c-success); color: #fff; }

.summary-case { display: flex; gap: var(--sp-4); align-items: center; }
.summary-case .cover { width: 84px; flex-shrink: 0; border-radius: var(--radius-sm); }
.summary-case .dossier { padding: 10%; }
.summary-case .dossier__num { font-size: 1.6rem; }
.summary-case .dossier__title, .summary-case .dossier__place, .summary-case .dossier__stamp, .summary-case .dossier__lines, .summary-case .dossier__top { display: none; }
.summary-lines { display: grid; gap: var(--sp-3); font-size: var(--fs-sm); }
.summary-lines div { display: flex; justify-content: space-between; gap: var(--sp-4); }
.summary-lines .total { padding-top: var(--sp-3); border-top: 1px dashed var(--border-strong); font-size: var(--fs-md); color: var(--heading); font-weight: 600; }
.pay-card { display: grid; gap: var(--sp-4); padding: var(--sp-6); border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: radial-gradient(100% 120% at 0% 0%, rgba(34, 53, 85, 0.55), transparent 60%), var(--surface-2); }
.pay-card__amount { font-family: var(--font-mono); font-size: var(--fs-3xl); color: var(--heading); }

/* ---------------------------------------------------------------- dashboard */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.dash-tabs { margin-top: var(--sp-8); position: sticky; top: var(--header-h); z-index: 20; background: var(--bg); }
.dash-panel { padding-top: var(--sp-8); }
.mycase { display: grid; gap: var(--sp-5); padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); grid-template-columns: 1fr; }
.mycase + .mycase { margin-top: var(--sp-5); }
.mycase__cover { width: 120px; }
.mycase__cover .dossier__stamp, .mycase__cover .dossier__lines { display: none; }
.mycase__head { display: flex; gap: var(--sp-4); align-items: flex-start; }
.mycase__title { font-size: var(--fs-xl); }
.mycase__files { display: grid; gap: var(--sp-3); }
.notif { display: flex; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.notif + .notif { margin-top: var(--sp-3); }
.notif.is-unread { border-inline-start: 3px solid var(--accent); }
.notif__icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(244, 238, 227, 0.05); color: var(--c-beige); flex-shrink: 0; }
.notif__icon svg { width: 18px; height: 18px; }
.notif__time { font-size: var(--fs-xs); color: var(--text-dim); margin-top: 4px; }
.purchase-row { display: grid; gap: var(--sp-2) var(--sp-4); grid-template-columns: 1fr auto; align-items: center; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.purchase-row + .purchase-row { margin-top: var(--sp-3); }

/* ---------------------------------------------------------------- legal & 404 */
.doc-paper { padding: clamp(1.5rem, 1rem + 4vw, 4.5rem); border-radius: 4px; box-shadow: var(--shadow-paper); }
.doc-paper .doc-body { white-space: pre-line; font-size: var(--fs-md); line-height: 1.85; }
.doc-paper h1 { font-size: var(--fs-3xl); margin: var(--sp-4) 0 var(--sp-6); }
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.notfound__code { font-family: var(--font-mono); font-size: clamp(4rem, 3rem + 8vw, 9rem); line-height: 1; color: transparent; -webkit-text-stroke: 1px var(--border-strong); }

/* ---------------------------------------------------------------- responsive (pages) */
@media (min-width: 600px) {
  .hero__stats { grid-template-columns: repeat(4, max-content); column-gap: var(--sp-10); }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fact:last-child:nth-child(odd) { grid-column: auto; }
  .fact:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
  .fact:last-child:nth-child(3n + 2) { grid-column: span 2; }
  .mycase { grid-template-columns: 120px 1fr; }
  .mycase__head .cover { display: none; }
}
@media (min-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .auth { grid-template-columns: 1fr 1fr; }
  .auth__visual { display: block; }
  .case-hero__grid { grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: var(--sp-12); }
  .case-hero__cover { position: sticky; top: calc(var(--header-h) + var(--sp-6)); }
  .newsletter { grid-template-columns: 1fr 1fr; padding: var(--sp-12); }
  .mobile-buy-bar { display: none; }
}
@media (max-width: 899.98px) {
  .hero__visual { order: -1; width: 100%; max-width: 300px; margin-inline: auto; }
  .file-stack__photo { inset-inline-end: -4%; }
}
@media (max-width: 599.98px) {
  .hero { min-height: auto; padding-top: calc(var(--header-h) + var(--sp-8)); }
  .hero__visual { max-width: 230px; }
  .hero__ctas .btn { flex: 1 1 auto; }
  .teaser-note { padding: var(--sp-6) var(--sp-5); }
  .newsletter { padding: var(--sp-6); }
  .buy-box { padding: var(--sp-5); }
  body.has-buy-bar { padding-bottom: 76px; }
}
