/* styles.css (global + utilities) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  min-width: 0;
  /* Prevent grid/flex children from overflowing */
}

:root {
  --primary: #FF6B9D;
  --secondary: #C44569;
  --accent: #FFA07A;
  --dark: #1a1a2e;
  --light: #f8f9fa;

  /* Safe-area aware fixed UI offsets (iOS notch etc.) */
  --ui-top: calc(10px + env(safe-area-inset-top));
  --ui-right: calc(10px + env(safe-area-inset-right));
  --ui-left: calc(10px + env(safe-area-inset-left));
  --ui-bottom: calc(14px + env(safe-area-inset-bottom));
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow-x: clip) {

  html,
  body {
    overflow-x: clip;
  }
}

/* Make media always scale */
img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Animated Background */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Floating Shapes
   IMPORTANT: fixed (not absolute) so they never increase page scrollWidth on mobile */
.shape {
  position: fixed;
  opacity: 0.1;
  animation: float 20s infinite;
  will-change: transform;
  z-index: -1;
  pointer-events: none;
}

.shape1 {
  width: 300px;
  height: 300px;
  background: var(--primary);
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.shape2 {
  width: 200px;
  height: 200px;
  background: var(--accent);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  top: 60%;
  right: 10%;
  animation-delay: 5s;
}

.shape3 {
  width: 250px;
  height: 250px;
  background: var(--secondary);
  border-radius: 50% 40% 60% 50% / 50% 60% 40% 50%;
  top: 40%;
  left: 50%;
  animation-delay: 10s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(30px, -30px) rotate(120deg);
  }

  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

/* Spray Canvas (realistic paint spray) */
#sprayCanvas {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

/* =========================================================
   Language Switcher (ONE consistent behavior)
   Desktop: buttons | Mobile: dropdown
========================================================= */
.lang-switcher {
  position: fixed;
  top: var(--ui-top);
  right: var(--ui-right);
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* RTL positioning */
[dir="rtl"] .lang-switcher {
  left: var(--ui-left);
  right: auto;
}

/* Desktop buttons (default visible) */
.lang-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  white-space: nowrap;
  max-width: 100%;
}

.lang-btn:hover,
.lang-btn.active {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Mobile dropdown hidden by default (desktop) */
.lang-switcher__select {
  display: none;
}

/* Also hide the select itself by default (fallback if no wrapper) */
.lang-switcher select#langSelect {
  display: none;
}

/* Mobile: switch to dropdown and prevent overflow */
@media (max-width: 600px) {
  .lang-switcher {
    left: var(--ui-left);
    right: var(--ui-right);
    width: auto;
    display: block;
  }

  /* Hide buttons on mobile */
  .lang-switcher .lang-btn {
    display: none;
  }

  /* Show wrapper if it exists */
  .lang-switcher__select {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;

    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  }

  /* Show select even if wrapper is missing */
  .lang-switcher select#langSelect {
    display: block;
    width: 100%;
  }

  .lang-switcher__select select,
  .lang-switcher select#langSelect {
    width: 100%;
    min-width: 0;

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    border: 0;
    outline: 0;
    background: transparent;

    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;

    /* room for arrow */
    padding-right: 44px;

    /* prevent long language text from forcing overflow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Arrow icon: ABSOLUTE (NO negative margins = no overflow) */
  .lang-switcher__select i {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    margin: 0 !important;
    color: rgba(255, 255, 255, 0.92);
  }

  [dir="rtl"] .lang-switcher__select i {
    right: auto;
    left: 12px;
  }

  [dir="rtl"] .lang-switcher__select select,
  [dir="rtl"] .lang-switcher select#langSelect {
    text-align: right;
    padding-right: 12px;
    padding-left: 44px;
  }
}

/* =========================================================
   Back to Top Brush (safe-area + responsive sizing)
========================================================= */
.back-to-top {
  position: fixed;
  bottom: var(--ui-bottom);
  right: calc(16px + env(safe-area-inset-right));
  z-index: 1200;

  width: clamp(46px, 12vw, 60px);
  height: clamp(46px, 12vw, 60px);

  background: rgba(255, 107, 157, 0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, background 0.25s, transform 0.25s;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);

  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: rgba(196, 69, 105, 0.95);
  transform: translateY(-2px);
}

.brush-icon {
  font-size: 2rem;
  color: white;
  transition: transform 0.5s ease;
}

.back-to-top.rotating .brush-icon {
  transform: rotate(210deg);
}

/* RTL support */
[dir="rtl"] .back-to-top {
  left: calc(16px + env(safe-area-inset-left));
  right: auto;
}

/* Section Styling */
section {
  padding: 80px 20px;
  position: relative;
}

.glass-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 40px;
  margin: 20px 0;
  transition: all 0.35s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.glass-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  background: rgba(255, 255, 255, 0.23);
}

.section-title {
  font-size: 3rem;
  font-weight: 800;
  color: white;
  margin-bottom: 50px;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.28);
}

/* Responsive */
@media (max-width: 768px) {
  .section-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  section {
    padding: 56px 14px;
  }

  .glass-card {
    padding: 22px;
    border-radius: 18px;
  }

  .section-title {
    font-size: clamp(1.55rem, 6.2vw, 2.2rem);
    margin-bottom: 26px;
    padding-inline: 6px;
    text-wrap: balance;
  }

  .brush-icon {
    font-size: 1.7rem;
  }
}

/* RTL Support */
[dir="rtl"] {
  text-align: right;
}

/* Long translated text handling */
.section-title,
.hero h1,
.hero-desc,
.gallery-overlay h3,
.gallery-overlay p,
.exhibition-info h4,
.exhibition-info p,
.contact-box h4,
.contact-box p,
.sketchbook-toggle,
.newsletter-text,
.mini-canvas-text {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
