/* Nouran Dates - Custom Styles
   ─────────────────────────────
   Brand Colors:
     --nouran-green:  #779c57
     --nouran-brown:  #86592f
     --nouran-gold:   #C9A84C
     --nouran-cream:  #FFF9F0
     --nouran-tan:    #E8DDD0
*/

/* ── Tailwind custom theme (loaded via CDN config) ── */

/* ── Fonts are loaded via <link> in the SEO head (preconnect + display=swap). ── */

/* ── Base styles ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* account for sticky header */
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #1A1A2E;
  background: #FFF9F0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-heading {
  font-family: 'Playfair Display', Georgia, serif;
}

/* ── Desktop nav links ── */
.nav-link {
  color: #4A4A4A;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #779c57;
  border-radius: 9999px;
  transition: width 0.25s ease, left 0.25s ease;
}

.nav-link:hover {
  color: #779c57;
}

.nav-link:hover::after {
  width: 60%;
  left: 20%;
}

.nav-link--active {
  color: #779c57;
  font-weight: 600;
}

.nav-link--active::after {
  width: 60%;
  left: 20%;
}

/* ── Mobile nav links ── */
.mobile-nav-link {
  color: #4A4A4A;
  background: transparent;
}

.mobile-nav-link:hover,
.mobile-nav-link--active {
  color: #779c57;
  background: rgba(119, 156, 87, 0.08);
}

.mobile-nav-link--active {
  font-weight: 600;
  background: rgba(119, 156, 87, 0.1);
}

/* ── Header shrink on scroll ── */
#main-header.scrolled {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

#main-header.scrolled .max-w-7xl > div {
  /* Slight height reduction - handled via JS + class toggle */
}

/* ── Scrollbar styling (for mobile menu) ── */
#mobile-menu-panel::-webkit-scrollbar {
  width: 4px;
}

#mobile-menu-panel::-webkit-scrollbar-track {
  background: transparent;
}

#mobile-menu-panel::-webkit-scrollbar-thumb {
  background: #E8DDD0;
  border-radius: 9999px;
}

/* ── Focus visible for accessibility ── */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #779c57;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Selection color ── */
::selection {
  background: rgba(119, 156, 87, 0.25);
  color: #1A1A2E;
}

/* ── Footer styles ── */
.footer-link {
  color: rgba(255, 255, 255, 0.7);
  position: relative;
  padding-left: 0;
  transition: color 0.25s ease, padding-left 0.25s ease;
  font-size: 0.875rem;
}

.footer-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 1.5px;
  background: #C9A84C;
  transform: translateY(-50%);
  transition: width 0.25s ease;
}

.footer-link:hover {
  color: #C9A84C;
  padding-left: 14px;
}

.footer-link:hover::before {
  width: 9px;
}

.social-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.25s ease;
}

.social-icon:hover {
  background: #C9A84C;
  color: #86592f;
  transform: translateY(-2px);
}

/* ── Hide scrollbars on horizontal scrollers (e.g. sticky sub-nav) ── */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.8s ease-out both;
}

.animate-fade-up.delay-1 { animation-delay: 0.15s; }
.animate-fade-up.delay-2 { animation-delay: 0.3s; }
.animate-fade-up.delay-3 { animation-delay: 0.45s; }
.animate-fade-up.delay-4 { animation-delay: 0.6s; }

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  min-width: 0;
  max-width: 100%;
}

.reveal-left.reveal-visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  min-width: 0;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.reveal-right.reveal-visible {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ─── Article body typography ───────────────────────────── */
.prose-nouran {
  color: #4b5563;
  font-size: 1.0625rem;
  line-height: 1.8;
}
.prose-nouran p { margin-bottom: 1.25rem; }
.prose-nouran strong { color: #86592f; font-weight: 600; }
.prose-nouran h2 {
  font-family: 'Playfair Display', Georgia, serif;
  color: #86592f;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 1rem;
}
.prose-nouran h3 {
  font-family: 'Playfair Display', Georgia, serif;
  color: #86592f;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
}
.prose-nouran ul,
.prose-nouran ol { margin: 0 0 1.25rem 1.25rem; }
.prose-nouran li { margin-bottom: 0.5rem; }
.prose-nouran ul { list-style: disc; }
.prose-nouran ol { list-style: decimal; }
.prose-nouran a { color: #779c57; text-decoration: underline; }
.prose-nouran img {
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  width: 100%;
  height: auto;
}
.prose-nouran blockquote {
  border-left: 3px solid #C9A84C;
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #86592f;
}

/* ─── Article tables (nutrition facts, specs) ─────────────── */
.prose-nouran table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(134, 89, 47, 0.12);
}
.prose-nouran caption {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  color: #86592f;
  text-align: left;
  padding: 0.9rem 1rem;
  background: #FFF9F0;
  border: 1px solid #E8DDD0;
  border-bottom: none;
  border-radius: 0.75rem 0.75rem 0 0;
}
.prose-nouran th,
.prose-nouran td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-top: 1px solid #E8DDD0;
}
.prose-nouran thead th {
  background: #779c57;
  color: #fff;
  font-weight: 600;
  border-top: none;
}
.prose-nouran tbody tr:nth-child(even) {
  background: #FFF9F0;
}
.prose-nouran tbody td:first-child {
  font-weight: 600;
  color: #86592f;
}

/* On small screens, let tables inside .prose-nouran scroll horizontally
   instead of overflowing/clipping the layout. */
@media (max-width: 640px) {
  .prose-nouran table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
}

/* ─── Product gallery ────────────────────────────────────── */
.product-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.05rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* Thumbnail rail — always horizontal, below the photo, with prev/next arrows */
.gallery-rail-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
.gallery-rail {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3rem 0.15rem;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.gallery-rail::-webkit-scrollbar { display: none; }

.gallery-arrow {
  flex: 0 0 36px;
  width: 36px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(232, 221, 208, 0.9);
  border-radius: 12px;
  background: #fff;
  color: #86592f;
  box-shadow: 0 10px 22px -12px rgba(134, 89, 47, 0.45);
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.gallery-arrow:hover {
  background: #779c57;
  border-color: #779c57;
  color: #fff;
  transform: scale(1.05);
}
.gallery-arrow:active { transform: scale(0.96); }
.gallery-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}
.gallery-arrow svg { width: 18px; height: 18px; }

.gallery-thumb {
  position: relative;
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 2px solid rgba(232, 221, 208, 0.85);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  opacity: 0.65;
  cursor: pointer;
  scroll-snap-align: start;
  transition: opacity 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-thumb:hover {
  opacity: 1;
  border-color: rgba(201, 168, 76, 0.7);
  transform: translateY(-2px);
}
.gallery-thumb.is-active {
  opacity: 1;
  border-color: #779c57;
  box-shadow: 0 0 0 4px rgba(119, 156, 87, 0.22);
}

/* Main stage */
.gallery-stage {
  position: relative;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.gallery-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: min(72vw, 400px);
  border-radius: 22px;
  overflow: hidden;
  background: #F3EDE2;
  box-shadow: 0 18px 44px -28px rgba(134, 89, 47, 0.5);
  cursor: zoom-in;
}
@media (min-width: 1024px) {
  .gallery-frame {
    height: 540px;
  }
}
@media (min-width: 1280px) {
  .gallery-frame {
    height: 580px;
  }
}
.gallery-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(134, 89, 47, 0.14);
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
}
.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.12s ease;
  will-change: transform, opacity;
}
.gallery-frame:hover .gallery-image {
  transform: scale(1.05);
}
.gallery-image.is-switching {
  opacity: 0;
}

/* Controls row under the image (counter + expand) */
.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
.gallery-count {
  color: #86592f;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gallery-expand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  background: #FFF9F0;
  color: #86592f;
  border: 1px solid rgba(232, 221, 208, 0.9);
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.gallery-expand:hover {
  background: #779c57;
  border-color: #779c57;
  color: #fff;
  transform: translateY(-1px);
}
.gallery-expand svg { width: 15px; height: 15px; }

/* ─── Lightbox ───────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 18, 12, 0.95);
  /* no backdrop-filter: full-screen backdrop blur forces constant
     GPU re-compositing of the whole page and makes the fade-in lag */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease, visibility 0.1s ease;
  cursor: zoom-out;
  will-change: opacity;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 5;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}
.lightbox-close:hover {
  background: #C9A84C;
  color: #86592f;
  transform: rotate(90deg);
}
.lightbox-close svg { width: 20px; height: 20px; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.lightbox-nav:hover {
  background: #C9A84C;
  color: #86592f;
  transform: translateY(-50%) scale(1.06);
}
.lightbox-prev { left: 1.25rem; }
.lightbox-next { right: 1.25rem; }
.lightbox-nav svg { width: 22px; height: 22px; }
@media (max-width: 640px) {
  .lightbox-nav { width: 42px; height: 42px; top: auto; bottom: 5rem; transform: none; }
  .lightbox-nav:hover { transform: scale(1.06); }
  .lightbox-prev { left: 1rem; }
  .lightbox-next { right: 1rem; }
}

.lightbox-figure {
  max-width: min(1200px, 92vw);
  max-height: 84vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.lightbox-figure img {
  max-width: min(1200px, 92vw);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 34px 90px -24px rgba(0, 0, 0, 0.7);
  transition: opacity 0.12s ease, transform 0.12s ease;
  will-change: opacity, transform;
}
.lightbox-figure img.is-switching {
  opacity: 0;
  transform: scale(0.99);
}

.lightbox-count {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  z-index: 5;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.12em;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-frame:hover .gallery-image,
  .gallery-thumb:hover {
    transform: none;
  }
  .gallery-image.is-switching,
  .lightbox-figure img.is-switching {
    opacity: 1;
    transition: none;
  }
}

/* ─── Carton packaging (thumbnails above quote button) ──
   Requested size: 160×130 with object-contain so rectangular carton
   packshots remain legible. No description text under grid. */
.cartons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-start;
}
.carton-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  max-width: 170px;
}
.carton-thumb {
  width: 160px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid rgba(232, 221, 208, 0.95);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 22px -12px rgba(134, 89, 47, 0.35);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  padding: 6px;
}
.carton-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.carton-item:hover .carton-thumb {
  border-color: rgba(201, 168, 76, 0.7);
  box-shadow: 0 0 0 4px rgba(119, 156, 87, 0.18), 0 10px 22px -12px rgba(134, 89, 47, 0.4);
  transform: translateY(-2px);
}
.carton-item:focus-visible .carton-thumb {
  border-color: #779c57;
  box-shadow: 0 0 0 4px rgba(119, 156, 87, 0.28);
  outline: none;
}
.carton-label {
  color: #86592f;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}

/* ─── CTA buttons ───────────────────────────────────────── */
.btn-primary,
.btn-outline {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  background-color: #68934b;
  box-shadow: 0 16px 34px -12px rgba(119, 156, 87, 0.55);
}
.btn-outline:hover {
  transform: translateY(-2px);
  border-color: #779c57;
  color: #779c57;
  background-color: rgba(119, 156, 87, 0.06);
}

/* ─── Contact form fields ─────────────────────────────────
   Guarantee a visible border on every control (some inputs
   could otherwise render borderless). Kept in custom.css so
   it is independent of the purged Tailwind build. */
#contact-form input:not([type="hidden"]):not([type="submit"]),
#contact-form select,
#contact-form textarea {
  border: 1px solid #E8DDD0;
  background-color: #fff;
}
#contact-form input:not([type="hidden"]):not([type="submit"]):focus,
#contact-form select:focus,
#contact-form textarea:focus {
  border-color: #779c57;
  outline: none;
}
/* Keep the red error border added by contact.js on invalid fields */
#contact-form input.border-red-400,
#contact-form select.border-red-400,
#contact-form textarea.border-red-400 {
  border-color: #f87171;
}

/* ─── Arabic (RTL) ──────────────────────────────────────────
   Applies to /ar/ pages only (<html lang="ar" dir="rtl">).
   Cairo covers Arabic; Inter stays as fallback for Latin text. */
html[lang="ar"] body {
  font-family: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
}

html[lang="ar"] .font-heading,
html[lang="ar"] .prose-nouran h2,
html[lang="ar"] .prose-nouran h3,
html[lang="ar"] .prose-nouran caption {
  font-family: 'Cairo', 'Inter', system-ui, sans-serif;
}

/* Letter-spacing and uppercase break Arabic letter joining. */
html[lang="ar"] * {
  letter-spacing: normal !important;
}

html[lang="ar"] .uppercase {
  text-transform: none;
}

/* Arabic needs more vertical room than the Latin tight leading. */
html[lang="ar"] h1 {
  line-height: 1.4 !important;
}

html[lang="ar"] h2,
html[lang="ar"] h3 {
  line-height: 1.5 !important;
}

html[lang="ar"] .prose-nouran {
  line-height: 2;
}

/* Footer link hover indicator on the right-hand side. */
[dir="rtl"] .footer-link {
  padding-left: 0;
}

[dir="rtl"] .footer-link::before {
  left: auto;
  right: 0;
}

[dir="rtl"] .footer-link:hover {
  padding-left: 0;
  padding-right: 14px;
}

/* Article body: lists, quotes and tables mirror. */
[dir="rtl"] .prose-nouran ul,
[dir="rtl"] .prose-nouran ol {
  margin: 0 1.25rem 1.25rem 0;
}

[dir="rtl"] .prose-nouran blockquote {
  border-left: 0;
  border-right: 3px solid #C9A84C;
  padding-left: 0;
  padding-right: 1rem;
}

[dir="rtl"] .prose-nouran caption,
[dir="rtl"] .prose-nouran th,
[dir="rtl"] .prose-nouran td {
  text-align: right;
}

/* Arabic: the hero text sits on the right, so the (language-neutral, text-free)
   hero photo is mirrored to keep its subject on the opposite side. */
[dir="rtl"] img.object-cover[fetchpriority="high"] {
  transform: scaleX(-1);
}
