/* ============================================================
   HAKAYA GP CHILD — hakaya.css
   Palette: cream #ede8de | ink #1c1a17 | ink-light #3d3a35 | muted #8c897f
   Fonts:   IBM Plex Sans Arabic (400,700) + PT Serif (400)
   Layout:  100dvh, no scroll — fully fluid across all screen sizes
   ============================================================ */

:root {
  --cream: #ede8de;
  --cream-dark: #e4ddd1;
  --ink: #1c1a17;
  --ink-light: #3d3a35;
  --ink-muted: #8c897f;

  /* Desktop card sizing */
  --card-w: clamp(200px, 14vw, 300px);
  --card-gap: clamp(40px, 4vw, 80px);
  --vp-w: calc(var(--card-w) * 2 + var(--card-gap));
}

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

body {
  background-color: var(--cream) !important;
  color: var(--ink) !important;
  font-family: "IBM Plex Sans Arabic", "PT Serif", serif !important;
  font-weight: 400;
  margin: 0;
  padding: 0;
}

/* Hide GP theme chrome */
.main-navigation,
.nav-menu,
#site-navigation,
.navigation-branding,
.site-description,
.site-footer .copyright,
.generated-columns-container,
#footer-widgets {
  display: none !important;
}

.site-header {
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  border: none !important;
}
.inside-header {
  padding: 0 !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

/* ── Wrap ───────────────────────────────────────────────────── */
.hk-wrap {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
.hk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 2.2vh, 48px) clamp(36px, 3.5vw, 80px);
}

.hk-logo {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
}
.hk-logo img {
  height: clamp(52px, 4.5vw, 80px);
  width: auto;
  display: block;
}

.hk-logo-arabic {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  font-size: clamp(20px, 1.6vw, 30px);
  letter-spacing: 1px;
  direction: rtl;
}
.hk-logo-latin {
  font-family: "PT Serif", serif;
  font-weight: 400;
  font-size: clamp(12px, 0.9vw, 18px);
  letter-spacing: 6px;
  margin-top: 2px;
}

.hk-insta-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.hk-insta-link:hover {
  opacity: 0.5;
}
.hk-insta-link svg {
  width: clamp(24px, 1.8vw, 36px);
  height: clamp(24px, 1.8vw, 36px);
  display: block;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hk-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  padding: 0 6%;
}

.hk-intro-arabic {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-weight: 400;
  font-size: clamp(12px, 1.1vw, 20px);
  line-height: 2.1;
  direction: rtl;
  color: var(--ink-light);
  max-width: 900px;
  margin: 0 auto clamp(12px, 1.2vh, 24px);
}

.hk-intro-english {
  font-family: "PT Serif", serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(12px, 1vw, 19px);
  line-height: 1.9;
  color: var(--ink-light);
  max-width: 800px;
  margin: 0 auto;
}

/* ── Books ──────────────────────────────────────────────────── */
.hk-books {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-bottom: clamp(20px, 2.5vh, 48px);
}

/* ── Stage ──────────────────────────────────────────────────── */
.hk-stage {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.2vw, 28px);
}

/* ── Arrows ─────────────────────────────────────────────────── */
.hk-arrow {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: clamp(6px, 0.5vw, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  opacity: 0.5;
}
.hk-arrow:hover,
.hk-arrow:focus {
  opacity: 1;
}
.hk-arrow svg {
  width: clamp(18px, 1.4vw, 28px);
  height: clamp(18px, 1.4vw, 28px);
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* ── Viewport ───────────────────────────────────────────────── */
.hk-viewport {
  overflow: hidden;
  width: var(--vp-w);
  flex-shrink: 0;
}

/* ── Track ──────────────────────────────────────────────────── */
.hk-track {
  display: flex;
  gap: var(--card-gap);
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  flex-wrap: nowrap;
}

/* ── Card ───────────────────────────────────────────────────── */
.hk-card {
  flex: 0 0 var(--card-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 0.7vh, 14px);
}

.hk-card-number {
  font-size: clamp(11px, 0.75vw, 15px);
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--ink-muted);
}

/* ── Card cover — ALWAYS 3/4 aspect ratio ───────────────────── */
.hk-card-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
}

.hk-card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s ease;
}

.hk-no-cover {
  position: absolute;
  inset: 0;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 0.6vw, 13px);
  letter-spacing: 3px;
  color: var(--ink-muted);
}

.hk-card-cover:hover img {
  transform: scale(1.025);
}

.hk-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 26, 23, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  z-index: 1;
}
.hk-card-cover:hover .hk-card-overlay {
  background: rgba(28, 26, 23, 0.15);
}

.hk-btn-preview {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.25s, transform 0.25s;
  background: var(--cream);
  border: none;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: clamp(9px, 0.65vw, 13px);
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: clamp(8px, 0.6vw, 13px) clamp(16px, 1.4vw, 26px);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  position: relative;
  z-index: 2;
}
.hk-card-cover:hover .hk-btn-preview {
  opacity: 1;
  transform: translateY(0);
}

.hk-btn-download {
  font-size: clamp(9px, 0.65vw, 13px);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  margin-top: clamp(2px, 0.3vh, 6px);
  cursor: pointer;
  font-family: "PT Serif", serif;
  -webkit-appearance: none;
  appearance: none;
  display: inline-block;
  transition: letter-spacing 0.2s;
}
.hk-btn-download:hover,
.hk-btn-download:focus {
  letter-spacing: 2.5px;
  outline: none;
}

/* ── Footer ─────────────────────────────────────────────────── */
.hk-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.2vh, 22px) clamp(36px, 3.5vw, 80px);
  border-top: 1px solid rgba(28, 26, 23, 0.08);
}

.hk-footer-text {
  font-size: clamp(9px, 0.65vw, 13px);
  letter-spacing: 4px;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.hk-footer-insta {
  display: none !important;
}

/* ── Hidden Real3D holder ───────────────────────────────────── */
.hk-r3d-holder {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

/* ============================================================
   MOBILE — everything on one screen, no scroll, 3/4 ratio kept
   Strategy:
     - Header shrinks (logo smaller)
     - Intro text tightens to 2 lines max
     - Card width = auto-calculated so cover + text + footer all fit
     - aspect-ratio: 3/4 always enforced via CSS
   ============================================================ */
@media (max-width: 768px) {

  /* Full-height grid: header | intro | books | footer */
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  .hk-wrap {
    display: grid !important;
    grid-template-rows: auto auto 1fr auto !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    gap: 0 !important;
  }

  /* ── Header ── */
  .hk-header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 20px !important;
    flex-shrink: 0 !important;
  }

  .hk-logo img {
    height: 38px !important;
  }
  .hk-logo-arabic {
    font-size: 16px !important;
    letter-spacing: 0.5px !important;
  }
  .hk-logo-latin {
    font-size: 9px !important;
    letter-spacing: 4px !important;
  }
  .hk-insta-link svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* ── Hero / intro — full text, no clipping, breathing room from header ── */
  .hk-hero {
    padding: 20px 24px 0 !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
    max-height: none !important;
  }

  .hk-intro-arabic {
    font-size: 13px !important;
    line-height: 1.75 !important;
    margin-bottom: 6px !important;
    display: block !important;
    overflow: visible !important;
  }

  .hk-intro-english {
    font-size: 13px !important;
    line-height: 1.65 !important;
    display: block !important;
    overflow: visible !important;
  }

  /* ── Books section fills remaining space ── */
  .hk-books {
    padding: 6px 0 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    min-height: 0 !important;
  }

  .hk-stage {
    gap: 8px !important;
    align-items: center !important;
    height: 100% !important;
  }

  /* Arrow sizing on mobile */
  .hk-arrow {
    padding: 4px !important;
    opacity: 0.4 !important;
  }
  .hk-arrow svg {
    width: 16px !important;
    height: 16px !important;
  }

  /*
    Viewport: show 1 card at a time.
    Width = screen - 2 arrows (16px each) - 2 arrow paddings (8px each) - 2 gaps (8px each) - side margins (20px each)
    ≈ 100vw - 104px
  */
  .hk-viewport {
    width: calc(100vw - 104px) !important;
    /* height fills available space */
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
  }

  .hk-track {
    gap: 0 !important;
    align-items: center !important;
    height: 100% !important;
  }

  /* Card: full viewport width, height-constrained to keep 3/4 ratio */
  .hk-card {
    flex: 0 0 calc(100vw - 104px) !important;
    width: calc(100vw - 104px) !important;
    gap: 6px !important;
    justify-content: center !important;
    height: 100% !important;
    /* allow card to use available height */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .hk-card-number {
    font-size: 10px !important;
    letter-spacing: 2px !important;
  }

  /*
    Cover: always 3/4 aspect ratio.
    Sized by height — width derives automatically from aspect-ratio.
    Max-height accounts for: header ~60px + hero ~auto + card-number ~18px + download ~22px + gaps ~16px + footer ~38px
    Using 38vh as a reliable safe value that leaves room above and below.
  */
  .hk-card-cover {
    aspect-ratio: 3 / 4 !important;
    width: auto !important;
    max-height: 38vh !important;
    height: 38vh !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* On mobile show preview overlay always visible (tap-friendly) */
  .hk-card-overlay {
    background: rgba(28, 26, 23, 0.08) !important;
  }
  .hk-btn-preview {
    opacity: 1 !important;
    transform: none !important;
    font-size: 8px !important;
    letter-spacing: 2px !important;
    padding: 8px 14px !important;
  }

  .hk-btn-download {
    font-size: 9px !important;
    letter-spacing: 1.5px !important;
    margin-top: 4px !important;
  }

  /* ── Footer — tight, minimal gap from book ── */
  .hk-footer {
    padding: 6px 20px 8px !important;
    border-top: 1px solid rgba(28, 26, 23, 0.08) !important;
    flex-shrink: 0 !important;
  }
  .hk-footer-text {
    font-size: 8px !important;
    letter-spacing: 3px !important;
  }
}

/* Extra small phones (≤380px) — tighten further */
@media (max-width: 380px) {
  .hk-header {
    padding: 10px 16px !important;
  }
  .hk-logo img {
    height: 32px !important;
  }
  .hk-logo-arabic {
    font-size: 14px !important;
  }
  .hk-hero {
    padding: 16px 16px 0 !important;
  }
  .hk-intro-arabic,
  .hk-intro-english {
    font-size: 12px !important;
  }
  .hk-card-cover {
    max-height: 34vh !important;
    height: 34vh !important;
  }
}
