/* ============================================================
   CASBAH ALGERIA — MAIN DESIGN SYSTEM
   main.css — Variables, Reset, Typography, Layout Utilities
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Color Palette */
  --ivory: #F5F0E8;
  --terracotta: #C1440E;
  --terracotta-light: #D4623A;
  --terracotta-dark: #9E3309;
  --casbah-blue: #1B4F72;
  --casbah-blue-light: #2471A3;
  --casbah-blue-dark: #154360;
  --mosaic-teal: #0E7C7B;
  --mosaic-teal-light: #148F8E;
  --gold: #C9A84C;
  --gold-light: #D4BB6E;
  --gold-dark: #A8882A;
  --ink: #1A1208;
  --ink-light: #2D2010;
  --plaster: #E8DCC8;
  --plaster-light: #F0E8D8;
  --shadow-warm: rgba(193, 68, 14, 0.15);
  --shadow-dark: rgba(26, 18, 8, 0.25);
  --shadow-gold: rgba(201, 168, 76, 0.2);

  /* Transparent overlays */
  --overlay-blue: rgba(27, 79, 114, 0.85);
  --overlay-terracotta: rgba(193, 68, 14, 0.85);
  --overlay-ink: rgba(26, 18, 8, 0.7);

  /* Typography */
  --font-arabic: 'Amiri', serif;
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'EB Garamond', serif;

  /* Font Sizes */
  --text-xs: clamp(0.7rem, 1.5vw, 0.8rem);
  --text-sm: clamp(0.85rem, 1.8vw, 0.95rem);
  --text-base: clamp(1rem, 2vw, 1.1rem);
  --text-lg: clamp(1.1rem, 2.2vw, 1.25rem);
  --text-xl: clamp(1.3rem, 2.8vw, 1.5rem);
  --text-2xl: clamp(1.6rem, 3.5vw, 2rem);
  --text-3xl: clamp(2rem, 4.5vw, 2.8rem);
  --text-4xl: clamp(2.5rem, 6vw, 3.8rem);
  --text-hero: clamp(4rem, 10vw, 8rem);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Layout */
  --container-max: 1280px;
  --container-wide: 1440px;
  --container-narrow: 900px;
  --nav-height: 70px;

  /* Border & Shape */
  --arch-radius: 50% 50% 0 0 / 60% 60% 0 0;
  --border-ornament: 2px solid var(--gold);
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;

  /* Transitions */
  --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Shadows */
  --shadow-sm: 0 2px 8px var(--shadow-dark);
  --shadow-md: 0 6px 24px var(--shadow-dark);
  --shadow-lg: 0 12px 48px var(--shadow-dark);
  --shadow-warm-md: 0 6px 24px var(--shadow-warm);
  --shadow-warm-lg: 0 12px 48px var(--shadow-warm);

  /* Z-index layers */
  --z-base: 1;
  --z-above: 10;
  --z-nav: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-top: 1000;
}

/* ============================================================
   CSS RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--ink);
  background-color: var(--ivory);
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  border: none;
  outline: none;
  background: none;
  cursor: pointer;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

/* Arabic text */
.text-arabic,
[lang="ar"],
.ar {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  font-size: 1.1em;
}

/* Display headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  font-family: var(--font-body);
  line-height: 1.85;
  color: var(--ink);
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.7;
  font-weight: 400;
}

.caption {
  font-size: var(--text-sm);
  color: rgba(26, 18, 8, 0.6);
  font-style: italic;
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding: var(--space-5xl) 0;
  position: relative;
}

.section--sm {
  padding: var(--space-3xl) 0;
}

.section--lg {
  padding: calc(var(--space-5xl) * 1.5) 0;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xl);
}

.grid-masonry {
  columns: 3;
  column-gap: var(--space-xl);
}

.grid-masonry > * {
  break-inside: avoid;
  margin-bottom: var(--space-xl);
}

/* Flex utilities */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.flex-gap { gap: var(--space-md); }
.flex-gap-lg { gap: var(--space-xl); }

/* ============================================================
   COLOR UTILITIES
   ============================================================ */
.bg-ivory { background-color: var(--ivory); }
.bg-plaster { background-color: var(--plaster); }
.bg-terracotta { background-color: var(--terracotta); }
.bg-casbah-blue { background-color: var(--casbah-blue); }
.bg-mosaic-teal { background-color: var(--mosaic-teal); }
.bg-gold { background-color: var(--gold); }
.bg-ink { background-color: var(--ink); }

.text-ivory { color: var(--ivory); }
.text-gold { color: var(--gold); }
.text-terracotta { color: var(--terracotta); }
.text-casbah-blue { color: var(--casbah-blue); }
.text-mosaic-teal { color: var(--mosaic-teal); }
.text-ink { color: var(--ink); }

/* ============================================================
   ORNAMENTAL ELEMENTS
   ============================================================ */

/* Gold divider */
.ornament-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) auto;
  width: fit-content;
}

.ornament-divider::before,
.ornament-divider::after {
  content: '';
  height: 1px;
  width: 60px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

.ornament-divider::after {
  background: linear-gradient(90deg, var(--gold), transparent);
}

.ornament-divider-inner {
  width: 8px;
  height: 8px;
  background: var(--gold);
  transform: rotate(45deg);
}

/* Section title ornament */
.section-title-wrap {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-title-wrap .arabic-title {
  display: block;
  font-family: var(--font-arabic);
  font-size: var(--text-2xl);
  color: var(--gold);
  direction: rtl;
  margin-bottom: var(--space-sm);
}

.section-title-wrap h2 {
  font-size: var(--text-3xl);
  color: inherit;
  position: relative;
  display: inline-block;
}

.section-title-wrap h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  height: 2px;
  width: 0;
  background: var(--gold);
  transition: width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-title-wrap h2.line-revealed::after {
  width: 80%;
}

.section-title-wrap .subtitle {
  display: block;
  margin-top: var(--space-md);
  font-style: italic;
  color: rgba(26, 18, 8, 0.6);
  font-size: var(--text-lg);
}

/* Terracotta accent line */
.accent-line {
  width: 4px;
  height: 60px;
  background: linear-gradient(180deg, var(--terracotta), var(--gold));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================================
   ARCH SHAPES
   ============================================================ */

.arch-container {
  position: relative;
  overflow: hidden;
  border-radius: 50% 50% 0 0 / 40% 40% 0 0;
}

.arch-frame {
  position: relative;
  border-radius: 50% 50% 0 0 / 60% 60% 0 0;
  overflow: hidden;
}

.arch-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   ZELLIGE TILE PATTERN (CSS)
   ============================================================ */

.zellige-bg {
  position: relative;
}

.zellige-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(201, 168, 76, 0.08) 10px,
      rgba(201, 168, 76, 0.08) 11px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 10px,
      rgba(201, 168, 76, 0.08) 10px,
      rgba(201, 168, 76, 0.08) 11px
    );
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   GRAIN TEXTURE OVERLAY
   ============================================================ */

.grain-overlay {
  position: relative;
}

.grain-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-xl);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.05em;
  border-radius: 40px 40px 40px 40px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  opacity: 0;
  transition: var(--transition);
  border-radius: inherit;
}

.btn:hover::before {
  opacity: 0.15;
}

.btn-primary {
  background: var(--terracotta);
  color: var(--ivory);
  box-shadow: 0 4px 20px var(--shadow-warm);
  border: 2px solid transparent;
}

.btn-primary:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--shadow-warm);
}

.btn-outline {
  background: transparent;
  color: var(--ivory);
  border: 2px solid var(--gold);
}

.btn-outline:hover {
  background: var(--gold);
  color: var(--ink);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 76, 0.3);
}

.btn-ghost:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
}

/* Arch-shaped CTA button */
.btn-arch {
  border-radius: 50px 50px 20px 20px;
  padding: var(--space-md) var(--space-2xl);
}

/* ============================================================
   CARDS BASE
   ============================================================ */

.card {
  background: white;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-warm-lg);
}

.card-body {
  padding: var(--space-xl);
}

.card-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.3);
  padding: 2px var(--space-sm);
  border-radius: 20px;
  margin-bottom: var(--space-sm);
}

/* Gold corner ornaments */
.corner-ornament {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.corner-ornament—tl {
  top: 8px;
  left: 8px;
  border-top: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
}

.corner-ornament—tr {
  top: 8px;
  right: 8px;
  border-top: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
}

.corner-ornament—bl {
  bottom: 8px;
  left: 8px;
  border-bottom: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
}

.corner-ornament—br {
  bottom: 8px;
  right: 8px;
  border-bottom: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
}

/* ============================================================
   SECTION HEADERS WITH ZELLIGE PATTERN
   ============================================================ */

.section-header {
  position: relative;
  overflow: hidden;
  padding: var(--space-2xl) 0;
  text-align: center;
}

.section-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../assets/patterns/arabesque.svg');
  background-size: 120px;
  background-repeat: repeat;
  opacity: 0.08;
  pointer-events: none;
}

/* ============================================================
   MARQUEE / TICKER
   ============================================================ */

.marquee-wrap {
  overflow: hidden;
  white-space: nowrap;
  background: var(--gold);
  padding: var(--space-sm) 0;
}

.marquee-track {
  display: inline-flex;
  animation: marquee 30s linear infinite;
  white-space: nowrap;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xl);
  padding: 0 var(--space-xl);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--ink);
  font-weight: 500;
}

.marquee-item .sep {
  color: var(--terracotta);
  font-size: 1.2em;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--plaster);
}

::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--terracotta);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-masonry { columns: 1; }
  .container { padding: 0 var(--space-md); }
  .section { padding: var(--space-3xl) 0; }
  .section--lg { padding: var(--space-3xl) 0; }
}

@media (min-width: 481px) and (max-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-masonry { columns: 2; }
  .container { padding: 0 var(--space-lg); }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-masonry { columns: 2; }
}

@media (min-width: 1025px) {
  /* Full desktop — defaults apply */
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
  nav, footer, .btn, .mobile-menu { display: none !important; }
  body { color: #000; background: white; }
}

/* ============================================================
   PLACEHOLDER & MISSING IMAGES
   ============================================================ */

.img-placeholder {
  font-family: var(--font-body);
  color: var(--gold);
  font-size: 0.85rem;
  opacity: 0.6;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.img-missing {
  background: var(--plaster) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.img-missing img {
  display: none !important;
}
