/* Swahiba Studios - Custom styles (fluid type, balance, overrides) */

/* ========== Critical layout fallback (when Tailwind doesn't load, e.g. file://) ========== */
#navbar-root img,
#swahiba-nav img {
  max-height: 3rem !important;
  max-width: 200px !important;
  object-fit: contain;
  height: auto;
  width: auto;
  display: block;
}
#swahiba-nav {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0 1rem;
  box-sizing: border-box;
}
#swahiba-nav > div {
  max-width: 80rem;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
/* Inner row: logo left, links right (fallback when Tailwind not loaded) */
#swahiba-nav > div > div:first-child {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
  min-height: 4rem;
}
/* Mobile: hide desktop links so only hamburger + mobile menu show */
@media (max-width: 767px) {
  #swahiba-nav > div > div:first-child > div:last-of-type {
    display: none !important;
  }
}
/* Desktop: ensure links container is visible from 768px (override Tailwind .hidden) */
@media (min-width: 768px) {
  #swahiba-nav > div > div:first-child > div:last-of-type {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
  }
  #swahiba-nav > div > div:first-child > button[data-nav-toggle] {
    display: none !important;
  }
}
#swahiba-nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem 1rem;
}
#swahiba-nav .nav-link {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}
#swahiba-nav .nav-placeholder + div,
.nav-placeholder > nav > div {
  max-width: 80rem;
  margin: 0 auto;
  width: 100%;
}
/* Hero: prevent overlap, center content */
main > section {
  position: relative;
  box-sizing: border-box;
}
main > section > div {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  box-sizing: border-box;
}
main > section.relative {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
main > section.relative > div.absolute {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
main > section.relative > div.relative {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
}
/* Section containers */
main section > div.max-w-7xl,
main section > div[class*="max-w"] {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}
/* Services / card grids */
main section .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
main section .flex {
  display: flex;
  flex-wrap: wrap;
}
main section .flex-wrap {
  flex-wrap: wrap;
}
main section .gap-4 { gap: 1rem; }
main section .gap-6 { gap: 1.5rem; }
main section .gap-12 { gap: 3rem; }
main section .items-center { align-items: center; }
main section .justify-center { justify-content: center; }
main section .text-center { text-align: center; }
/* Paukwa / two-column grid */
main section .lg\:grid-cols-2 > * { min-width: 0; }
@media (min-width: 1024px) {
  main section .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  main section .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  main section .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 640px) {
  main section .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  main section .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Hero logo – blended with hero background */
.hero-logo {
  display: block;
  max-width: min(280px, 60vw);
  max-height: 140px;
  width: auto;
  height: auto;
  margin: 0 auto 1.5rem;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}
.dark .hero-logo {
  opacity: 0.95;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.2));
}

/* Partnership hero image – blended beside “Become a Partner” */
.partner-hero-img {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  opacity: 0.95;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}
.dark .partner-hero-img {
  opacity: 0.9;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

/* Featured product image cards – fit and blend */
.featured-product-card {
  aspect-ratio: 4/3;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(249, 250, 251, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dark .featured-product-card {
  background: rgba(31, 41, 55, 0.6);
  border-color: rgba(75, 85, 99, 0.4);
}
.featured-product-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.08);
}
.featured-product-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Gallery cards – fill card, no empty space (cover) */
.gallery-card {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(249, 250, 251, 0.9);
  aspect-ratio: 4/3;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dark .gallery-card {
  background: rgba(31, 41, 55, 0.7);
  border-color: rgba(75, 85, 99, 0.4);
}
.gallery-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.08);
}
.gallery-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Nav: transparent over hero, solid on scroll (light + dark) */
.nav-transparent {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
}
.dark .nav-transparent {
  background: rgba(3, 7, 18, 0.6);
}

/* Fluid typography */
h1, .text-display {
  font-size: clamp(2rem, 4vw + 1rem, 4rem);
  line-height: 1.2;
  text-wrap: balance;
}

h2, .section-title {
  font-size: clamp(1.5rem, 2vw + 1rem, 2.5rem);
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.25rem, 1.5vw + 0.75rem, 1.875rem);
}

body {
  line-height: 1.6;
}

/* Readable prose */
.max-w-prose p {
  max-width: 65ch;
}

/* Scroll-reveal (toggled by JS) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Sticky nav placeholder to avoid layout shift */
body { padding-top: 0; }
.nav-placeholder { height: 72px; }

@media (max-width: 768px) {
  .nav-placeholder { height: 64px; }
}

/* ========== Forms – modern standards ========== */
.form-card {
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid var(--form-border, #e5e7eb);
  background: var(--form-bg, #fff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
}
.dark .form-card {
  --form-border: rgba(55, 65, 81, 0.8);
  --form-bg: rgba(17, 24, 39, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.form-card .form-group,
.form-card > div {
  margin-bottom: 1.25rem;
}
.form-card .form-group:last-child,
.form-card > div:last-child {
  margin-bottom: 0;
}
.form-card .form-group.pt-1 {
  padding-top: 0.25rem;
}
.form-card label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--form-label, #374151);
  margin-bottom: 0.375rem;
  line-height: 1.4;
}
.dark .form-card label {
  --form-label: #d1d5db;
}
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card select,
.form-card textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--form-text, #111827);
  background: var(--form-input-bg, #f9fafb);
  border: 1px solid var(--form-input-border, #d1d5db);
  border-radius: 0.5rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dark .form-card input[type="text"],
.dark .form-card input[type="email"],
.dark .form-card input[type="tel"],
.dark .form-card select,
.dark .form-card textarea {
  --form-text: #f3f4f6;
  --form-input-bg: rgba(31, 41, 55, 0.8);
  --form-input-border: #4b5563;
}
.form-card input::placeholder,
.form-card textarea::placeholder {
  color: var(--form-placeholder, #9ca3af);
}
.dark .form-card input::placeholder,
.dark .form-card textarea::placeholder {
  --form-placeholder: #6b7280;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
.form-card textarea {
  min-height: 5rem;
  resize: vertical;
}
.form-card button[type="submit"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  background: #f59e0b;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-top: 0.25rem;
}
.form-card button[type="submit"]:hover {
  background: #fbbf24;
}
.form-card button[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4);
}
/* Form card wide variant (e.g. contact page with more fields) */
.form-card.form-card--wide {
  max-width: 32rem;
  padding: 1.75rem 1.5rem;
}
/* Request Demo modal – comfortable width, clear close X */
#demo-modal-dialog {
  max-width: 28rem;
  width: 100%;
  margin: auto;
  margin-top: 4.5rem;
  border-radius: 1rem;
  overflow: visible;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  position: relative;
}
.dark #demo-modal-dialog {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
/* Prominent X close button – hard to miss */
.demo-modal-close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: #374151;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 0;
}
.demo-modal-close:hover {
  background: #1f2937;
  transform: scale(1.05);
}
.demo-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.5);
}
.dark .demo-modal-close {
  background: #4b5563;
  border-color: rgba(31, 41, 55, 0.9);
}
.dark .demo-modal-close:hover {
  background: #374151;
}
#demo-modal-dialog .demo-modal-inner {
  padding: 1.5rem 1.5rem;
  text-align: center;
  overflow-y: auto;
  max-height: calc(90vh - 2rem);
}
.demo-modal-logo {
  display: block;
  max-width: 140px;
  max-height: 64px;
  width: auto;
  height: auto;
  margin: 0 auto 1rem;
  object-fit: contain;
  opacity: 0.95;
}
.dark .demo-modal-logo {
  opacity: 0.9;
}
#demo-modal-dialog .demo-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
#demo-modal-dialog .demo-modal-desc {
  font-size: 0.875rem;
  color: var(--form-label, #6b7280);
  margin-bottom: 1.25rem;
}
.dark #demo-modal-dialog .demo-modal-desc {
  color: #9ca3af;
}
/* Demo modal form – same input style */
#demo-modal-dialog input[type="text"],
#demo-modal-dialog input[type="email"],
#demo-modal-dialog input[type="tel"],
#demo-modal-dialog select,
#demo-modal-dialog textarea {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--form-text, #111827);
  background: var(--form-input-bg, #f9fafb);
  border: 1px solid var(--form-input-border, #d1d5db);
  border-radius: 0.5rem;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.dark #demo-modal-dialog input,
.dark #demo-modal-dialog select,
.dark #demo-modal-dialog textarea {
  --form-text: #f3f4f6;
  --form-input-bg: rgba(31, 41, 55, 0.8);
  --form-input-border: #4b5563;
}
#demo-modal-dialog input:focus,
#demo-modal-dialog select:focus,
#demo-modal-dialog textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
#demo-modal-dialog .form-group,
#demo-modal-dialog form > div {
  margin-bottom: 1rem;
}
#demo-modal-dialog .form-group:last-child,
#demo-modal-dialog form > div:last-child {
  margin-bottom: 0;
}
#demo-modal-dialog .form-group.pt-1 {
  padding-top: 0.25rem;
}
#demo-modal-dialog label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--form-label, #374151);
  margin-bottom: 0.375rem;
}
.dark #demo-modal-dialog label {
  color: #d1d5db;
}
#demo-modal-dialog button[type="submit"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  background: #f59e0b;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
#demo-modal-dialog button[type="submit"]:hover {
  background: #fbbf24;
}
#demo-modal-dialog button[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.4);
}
/* Newsletter inline form */
.newsletter-form {
  max-width: 24rem;
  margin-left: auto;
  margin-right: auto;
}
.newsletter-form input[type="email"] {
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--form-input-border, #d1d5db);
  background: var(--form-input-bg, #f9fafb);
  color: var(--form-text, #111827);
  min-width: 0;
}
.newsletter-form button[type="submit"] {
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  border-radius: 0.5rem;
  white-space: nowrap;
}

/* Focus ring for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Modal backdrop */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* Lightbox */
.lightbox-overlay {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

/* Toast */
.toast-holder {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
}

.toast-holder .toast {
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Mobile & responsive – adapts well on phones ========== */
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
  min-width: 0;
}

/* Touch-friendly targets (min 44px) */
@media (max-width: 768px) {
  #swahiba-nav .nav-link,
  #swahiba-nav [data-nav-toggle],
  #swahiba-nav a[href="#request-demo"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
  }
  #swahiba-nav [data-nav-mobile] a,
  #swahiba-nav [data-nav-mobile] button {
    min-height: 44px;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
  }
  main section .form-card button[type="submit"],
  #demo-modal-dialog button[type="submit"] {
    min-height: 48px;
  }
}

/* Request Demo modal – fits viewport on small screens */
@media (max-width: 480px) {
  #demo-modal-dialog {
    max-width: calc(100vw - 1.5rem);
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }
  #demo-modal-dialog .demo-modal-inner {
    padding: 1.25rem 1rem;
  }
  .demo-modal-close {
    top: -0.5rem;
    right: -0.5rem;
    width: 2rem;
    height: 2rem;
    font-size: 1.125rem;
  }
}

/* Tables – horizontal scroll on mobile with smooth touch */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}
.overflow-x-auto table {
  min-width: 400px;
}

/* Images and media – never overflow */
main img,
.partner-hero-img,
.hero-logo,
.featured-product-card img,
.gallery-card img {
  max-width: 100%;
  height: auto;
}

/* Partnership hero – image smaller on mobile */
@media (max-width: 1023px) {
  .partner-hero-img {
    max-height: 260px;
  }
}

/* Footer – stack on very small screens */
@media (max-width: 640px) {
  #swahiba-footer .grid,
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* Section padding and spacing on mobile */
@media (max-width: 768px) {
  main section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  main section .py-20,
  main section .sm\:py-24 {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* Back to top – safe area on mobile */
#back-to-top {
  bottom: 1.5rem;
  right: 1rem;
}
@media (max-width: 480px) {
  #back-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* Prevent long words from breaking layout */
h1, h2, h3, p, li, a {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
