/* ============================================================
   home-layout.css — Home Page Frame & Shared Parts
   ─────────────────────────────────────────
   PURPOSE : Page width, section rhythm, headings, buttons and
             utilities shared by every home section
             (html-templates/home/).
   ============================================================ */

/* The decorative hero art is wider than a phone screen; clip it at the
   viewport edge so it never scrolls the page sideways (the search popup
   only overflows vertically, so it is unaffected). */
#tabContentHome {
  overflow-x: clip;
}

.home {
  --home-max-width: 1120px;
  --home-gutter: clamp(16px, 4vw, 32px);
  --home-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --home-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  width: 100%;
  max-width: calc(var(--home-max-width) + 2 * var(--home-gutter));
  margin: 0 auto;
  padding: 0 var(--home-gutter) 48px;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] .home {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', 'Inter', system-ui, sans-serif;
}

/* In-page scroll targets land below the sticky header. */
.home [id] {
  scroll-margin-top: calc(var(--shell-header-h, 64px) + 20px);
}

/* ── Sections ─────────────────────────────────────────────────── */
.home-section {
  padding-top: clamp(48px, 7vw, 88px);
}

.home-section__title {
  margin: 0 0 32px;
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
}

.home-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Arabic has no capitals and must not be letter-spaced. */
html[dir="rtl"] .home-section__title {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
}

html[dir="rtl"] .home-eyebrow {
  font-size: 0.9rem;
  letter-spacing: normal;
  text-transform: none;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.home-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
              box-shadow 0.25s ease, transform 0.25s var(--home-ease);
}

/* A soft light that sweeps across on hover. */
.home-btn::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset-block: 0;
  inset-inline-start: -60%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgb(255 255 255 / 0.26), transparent);
  transform: skewX(-18deg) translateX(-120%);
  transition: transform 0.7s var(--home-ease);
  pointer-events: none;
}

.home-btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.home-btn--primary {
  background: var(--accent);
  color: #FFFFFF !important;
  box-shadow:
    0 1px 2px hsl(var(--shadow-color) / 0.12),
    0 10px 22px -10px hsl(var(--shadow-color) / 0.55);
}

.home-btn--quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.home-btn--amber {
  background: var(--mark-catch);
  color: var(--mark-disc) !important;
  box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.5);
}

.home-btn__arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--home-ease);
}

html[dir="rtl"] .home-btn__arrow {
  transform: scaleX(-1);
}

@media (hover: hover) {
  .home-btn:hover {
    transform: translateY(-2px);
  }

  .home-btn:hover::after {
    transform: skewX(-18deg) translateX(520%);
  }

  .home-btn--primary:hover {
    background: var(--accent-strong);
    box-shadow:
      0 1px 2px hsl(var(--shadow-color) / 0.12),
      0 16px 28px -12px hsl(var(--shadow-color) / 0.6);
  }

  .home-btn--quiet:hover {
    background: var(--surface);
    border-color: var(--text-faint);
  }

  .home-btn--amber:hover {
    box-shadow: 0 16px 30px -12px rgb(0 0 0 / 0.6);
  }

  .home-btn:hover .home-btn__arrow {
    transform: translateX(3px);
  }

  html[dir="rtl"] .home-btn:hover .home-btn__arrow {
    transform: scaleX(-1) translateX(3px);
  }

  .home-btn:hover:active {
    transform: scale(0.97);
  }
}

/* ── Focus ────────────────────────────────────────────────────── */
.home a:focus-visible,
.home button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── Closing call to action ───────────────────────────────────── */
.home-cta {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  margin-top: clamp(64px, 9vw, 112px);
  padding: clamp(28px, 5vw, 52px);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--mark-disc), var(--accent-strong));
  color: #FFFFFF;
  box-shadow: 0 30px 50px -30px hsl(var(--shadow-color) / 0.7);
}

.home-cta__art {
  position: absolute;
  z-index: -1;
  top: 50%;
  inset-inline-end: -110px;
  width: 400px;
  height: 400px;
  translate: 0 -50%;
  stroke: rgb(255 255 255 / 0.13);
  stroke-width: 1.5;
  pointer-events: none;
}

.home-cta__art circle:last-child {
  fill: rgb(254 181 54 / 0.09);
  stroke: none;
}

html[dir="rtl"] .home-cta__art {
  scale: -1 1;
}

.home-cta__body {
  flex: 1 1 280px;
  min-width: 0;
}

.home-cta__title {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  text-wrap: balance;
}

html[dir="rtl"] .home-cta__title {
  font-family: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.4;
}

.home-cta__text {
  margin: 8px 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: rgb(255 255 255 / 0.74);
}

html[dir="rtl"] .home-cta__text {
  line-height: 1.85;
}

.home-cta .home-btn {
  flex: 0 0 auto;
}

/* ── Footer note & utilities ──────────────────────────────────── */
.home-disclaimer {
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-faint);
}

.home-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.home a,
.home button {
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .home {
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  }

  .home-section {
    padding-top: 56px;
  }

  .home-section__title {
    margin-bottom: 24px;
    font-size: 1.55rem;
  }

  .home-disclaimer {
    margin-top: 48px;
  }
}

/* ── Scroll reveal (opt-in: home-motion.js adds .home--js) ─────── */
.home--js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--home-ease), transform 0.8s var(--home-ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

.home--js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (max-width: 640px) {
  .home-cta {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .home-cta__body {
    flex-basis: auto;
  }

  .home-cta__art {
    inset-inline-end: -180px;
    opacity: 0.8;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-btn,
  .home-btn::after,
  .home-btn__arrow {
    transition: none;
  }

  .home--js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
