/* ═══════════════════════════════════════════════════════════════
   Design Tokens — Kuwait Autism Center | Academic Light Theme
   palette: Sky-Blue #1E9FCC · Orange #E8720C · Slate #475569
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  /* ── Brand Palette ── */
  --sky:         #1E9FCC;
  --sky-dark:    #14749A;
  --sky-deep:    #0D4F6E;
  --sky-soft:    #E1F4FB;
  --sky-mist:    #F0F9FE;

  --orange:      #E8720C;
  --orange-dark: #B85709;
  --orange-soft: #FEF0E4;
  --orange-glow: rgba(232, 114, 12, 0.18);

  --slate:       #475569;
  --slate-dark:  #1E293B;
  --slate-light: #64748B;
  --slate-mist:  #F1F5F9;

  /* ── Surface ── */
  --page-bg:     #F4F8FC;
  --surface:     #FFFFFF;
  --surface-2:   #FAFCFE;
  --border:      rgba(30, 159, 204, 0.15);
  --border-soft: rgba(71, 85, 105, 0.10);

  /* ── Text ── */
  --ink:         #0F2136;
  --ink-soft:    #334155;
  --muted:       #64748B;

  /* ── Shadows ── */
  --card-shadow: 0 2px 12px rgba(14, 79, 110, 0.08), 0 1px 4px rgba(14, 79, 110, 0.04);
  --card-hover:  0 8px 32px rgba(14, 79, 110, 0.14), 0 2px 8px rgba(14, 79, 110, 0.06);
  --modal-shadow:0 32px 80px rgba(14, 79, 110, 0.20), 0 8px 24px rgba(14, 79, 110, 0.10);

  /* ── Motion ── */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);

  /* ── Layout ── */
  --radius-sm:   10px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-xl:   32px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body  { margin: 0; }
img   { display: block; max-width: 100%; }
button, a { font: inherit; }

/* ── Body ─────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", "Tajawal", "Geeza Pro", "Tahoma", sans-serif;
  color: var(--ink);
  background-color: var(--page-bg);
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(30,159,204,0.08) 0%, transparent 70%),
    linear-gradient(180deg, #EEF6FC 0%, var(--page-bg) 100%);
  background-attachment: fixed;
}

/* ── Page Shell ──────────────────────────────────────────── */
.page-shell {
  width: min(1300px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 80px;
}

/* ════════════════════════════════════════════════
   TOP BAR
   ════════════════════════════════════════════════ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0;
}

.top-bar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(30,159,204,0.35);
}

.logo-mark svg { color: #fff; }

.logo-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--sky-deep);
  line-height: 1.2;
}

.logo-name span {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
}

.top-bar-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(232,114,12,0.2);
}

/* ════════════════════════════════════════════════
   HERO SECTION
   ════════════════════════════════════════════════ */
.hero {
  position: relative;
  padding: 56px 52px 48px;
  margin-top: 28px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

/* geometric decoration */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 600px at 90% 50%, rgba(30,159,204,0.07) 0%, transparent 70%),
    radial-gradient(circle 300px at 10% 80%, rgba(232,114,12,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* grid lines decoration */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(30,159,204,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,159,204,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  border-radius: inherit;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 100% at 80% 50%, black 0%, transparent 70%);
}

.hero-inner { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: var(--sky-soft);
  border: 1px solid rgba(30,159,204,0.25);
  color: var(--sky-dark);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sky);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%        { opacity: 0.6; transform: scale(0.75); }
}

.hero h1 {
  margin: 0 0 16px;
  font-family: "Tajawal", "IBM Plex Sans Arabic", sans-serif;
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--slate-dark);
  letter-spacing: -0.02em;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--sky) 20%, var(--sky-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy {
  max-width: 680px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 2;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: var(--sky-mist);
  border: 1px solid var(--border);
}

.stat-pill.orange {
  background: var(--orange-soft);
  border-color: rgba(232,114,12,0.18);
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--sky-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-pill.orange .stat-number { color: var(--orange); }

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ════════════════════════════════════════════════
   SEARCH & FILTER BAR
   ════════════════════════════════════════════════ */
.catalog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.catalog-title-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.catalog-controls h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--slate-dark);
}

.catalog-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.catalog-meta strong {
  color: var(--sky);
  font-weight: 700;
}

/* Tabs */
.catalog-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--slate);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
}

.filter-tab:hover {
  background: var(--sky-mist);
  color: var(--sky-dark);
  border-color: rgba(30,159,204,0.3);
}

.filter-tab.active {
  background: var(--sky);
  color: #fff;
  border-color: var(--sky-dark);
  box-shadow: 0 4px 12px rgba(30,159,204,0.25);
}

/* ════════════════════════════════════════════════
   CATALOG GRID
   ════════════════════════════════════════════════ */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 22px;
}

/* ════════════════════════════════════════════════
   PUBLICATION CARD
   ════════════════════════════════════════════════ */
.publication-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition:
    transform 280ms var(--ease-out),
    box-shadow 280ms var(--ease-out),
    border-color 280ms ease;
  cursor: default;
}

.publication-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover);
  border-color: rgba(30,159,204,0.30);
}

/* Cover frame */
.cover-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(160deg, var(--sky-mist) 0%, #E8F4FB 100%);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  transition: transform 400ms var(--ease-out);
}

.publication-card:hover .cover-image {
  transform: scale(1.03);
}

/* Price chip */
.cover-price-chip {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* free = blue, priced = orange */
.chip-free {
  background: rgba(30,159,204,0.88);
  color: #fff;
}

.chip-priced {
  background: rgba(232,114,12,0.90);
  color: #fff;
}

/* No-cover placeholder */
.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--sky);
  opacity: 0.55;
}

.cover-placeholder svg { width: 52px; height: 52px; }
.cover-placeholder span { font-size: 0.8rem; font-weight: 500; }

/* Card body */
.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 18px 18px 16px;
  text-align: right;
}

/* Issue badge */
.issue-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--slate-mist);
  color: var(--slate);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-soft);
}

.publication-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.publication-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 0 0;
}

.card-actions {
  padding: 12px 18px 16px;
}

/* ── Buttons ─────────────────────────────────── */
.more-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--sky) 0%, var(--sky-dark) 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(30,159,204,0.30);
  transition:
    transform 180ms var(--ease-out),
    box-shadow 180ms ease,
    background 180ms ease;
}

.more-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,159,204,0.40);
  background: linear-gradient(135deg, var(--sky-dark) 0%, var(--sky-deep) 100%);
}

.more-button:active { transform: translateY(0); }

.more-button svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ════════════════════════════════════════════════
   DETAILS MODAL
   ════════════════════════════════════════════════ */
.details-modal {
  width: min(860px, calc(100% - 28px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
  overflow: visible;
}

.details-modal::backdrop {
  background: rgba(15, 33, 54, 0.55);
  backdrop-filter: blur(6px);
}

.details-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--modal-shadow);
  overflow: hidden;
  max-height: 90vh;
}

/* Modal header stripe */
.modal-header-stripe {
  padding: 18px 26px 16px;
  background: linear-gradient(135deg, var(--sky-mist) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sky-dark);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.modal-close {
  position: static;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--slate);
  font-size: 1.25rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: rgba(232,114,12,0.25);
  transform: rotate(90deg);
}

/* Modal body */
.modal-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  overflow: auto;
  max-height: calc(90vh - 60px);
}

.modal-cover-col {
  padding: 24px 20px 24px 24px;
  background: var(--sky-mist);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.details-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(14,79,110,0.10);
}

.details-cover img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.modal-price-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  width: 100%;
}

.modal-price-badge.free {
  background: var(--sky-soft);
  color: var(--sky-deep);
  border: 1px solid rgba(30,159,204,0.25);
}

.modal-price-badge.priced {
  background: var(--orange-soft);
  color: var(--orange-dark);
  border: 1px solid rgba(232,114,12,0.22);
}

.modal-text-col {
  padding: 28px 30px 28px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.details-meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.details-title {
  margin: 0;
  font-family: "Tajawal", "IBM Plex Sans Arabic", sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--slate-dark);
  letter-spacing: -0.01em;
}

.details-title-line {
  width: 48px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sky), var(--orange));
  margin: 0;
}

.details-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sky);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.details-description {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 2;
  white-space: pre-wrap;
}

/* ════════════════════════════════════════════════
   EMPTY & LOADING STATES
   ════════════════════════════════════════════════ */
.empty-state {
  grid-column: 1 / -1;
  padding: 48px 28px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
}

/* ════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════ */
.site-footer {
  margin-top: 60px;
  padding: 24px 0 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-size: 0.83rem;
  color: var(--muted);
}

.footer-brand {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--sky-dark);
}

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .modal-body {
    grid-template-columns: 1fr;
  }

  .modal-cover-col {
    padding: 20px;
    border-inline-end: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    align-items: flex-start;
  }

  .details-cover {
    max-width: 160px;
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 24px);
    padding-bottom: 48px;
  }

  .hero {
    padding: 32px 24px;
    margin-top: 18px;
    border-radius: var(--radius-lg);
  }

  .hero h1 { font-size: 2rem; }

  .catalog-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .pub-info {
    padding: 12px 10px;
    gap: 8px;
  }

  .pub-title {
    font-size: 0.95rem;
  }

  .pub-desc {
    font-size: 0.85rem;
  }

  .hero-stats { gap: 12px; }

  .stat-pill { padding: 10px 18px; }

  .details-modal {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px auto;
  }

  .details-panel {
    max-height: calc(100dvh - 16px);
    border-radius: 28px;
  }

  .modal-header-stripe {
    padding: 14px 18px;
  }

  .modal-close {
    width: 42px;
    height: 42px;
  }

  .modal-body {
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
  }

  .modal-cover-col {
    flex-direction: column;
    align-items: center;
    padding: 18px 18px 12px;
  }

  .details-cover {
    max-width: min(230px, 68vw);
    width: 100%;
  }

  .modal-price-badge {
    width: min(100%, 320px);
  }

  .modal-text-col {
    padding: 18px 18px 24px;
    overflow: visible;
  }

  .details-meta {
    gap: 12px;
  }

  .details-title {
    font-size: 1.3rem;
    line-height: 1.55;
  }

  .details-description {
    font-size: 0.94rem;
    line-height: 1.9;
  }

  .order-box {
    margin-top: 8px;
  }
}

/* ════════════════════════════════════════════════
   SUBTLE ENTRANCE ANIMATIONS
   ════════════════════════════════════════════════ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.publication-card {
  animation: fadeSlideUp 380ms var(--ease-out) both;
}

/* stagger via JS-added --i custom property */
.publication-card { animation-delay: calc(var(--i, 0) * 40ms); }

/* ════════════════════════════════════════════════
   ORDER BOX
   ════════════════════════════════════════════════ */
.order-box {
  margin-top: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  border-right: 4px solid var(--sky);
}

.order-contact {
  font-size: 0.95rem;
  color: var(--slate-dark);
  font-weight: 600;
  margin-bottom: 8px;
}

.order-contact a {
  color: var(--sky);
  text-decoration: none;
  font-weight: 700;
  direction: ltr;
  display: inline-block;
}

.order-contact a:hover {
  text-decoration: underline;
}

.pickup-notice {
  font-size: 0.9rem;
  color: #d32f2f;
  font-weight: 700;
}
