@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600&family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --accent-gold-start: #F1C40F;
  --accent-gold-end: #D4AF37;
  --accent-glow: rgba(212, 175, 55, 0.4);
}

/* Light Theme Variables (Default) */
.light-theme {
  --accent-gold-start: #d4af37; /* Richer gold for light mode */
  --accent-gold-end: #b58800;
  --accent-glow: transparent; /* No glowing in light mode */
  
  --bg-primary: #f5f7fa; /* Cleaner, softer off-white instead of muddy blue-grey */
  --bg-surface: #ffffff; /* Clean white cards */
  --bg-surface-alt: #f0f4f8; /* Very soft grey-blue for footer */
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(200, 210, 220, 0.5); /* Subtle dark border for definition */
  --glass-highlight: rgba(255, 255, 255, 1);
  
  --text-main: #111827; /* Very dark slate, highly readable */
  --text-muted: #4b5563; /* Readable dark grey */
  --text-inverse: #ffffff;
  
  --shadow-color: rgba(17, 24, 39, 0.05);
  --shadow-hover: rgba(17, 24, 39, 0.12);
  
  --header-bg: rgba(255, 255, 255, 0.9);
}

/* Dark Theme Variables */
.dark-theme {
  --bg-primary: #050505;
  --bg-surface: #0a0a0a;
  --bg-surface-alt: #121212;
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  
  --text-main: #ffffff;
  --text-muted: #a0aab2;
  --text-inverse: #1a1a1a;
  
  --shadow-color: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(0, 0, 0, 0.6);
  
  --header-bg: rgba(5, 5, 5, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* RTL Support for Arabic */
body.rtl-mode {
  direction: rtl;
  text-align: right;
}
body.rtl-mode .nav-links li a::after {
  right: 0;
  left: auto;
  background: linear-gradient(-90deg, var(--accent-gold-start), transparent);
}
body.rtl-mode .dropdown-content {
  right: 0;
  left: auto;
}
body.rtl-mode .glass-card {
  text-align: right;
}

/* Typography & Gradients */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-gold-start), var(--accent-gold-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

a {
  color: var(--accent-gold-end);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  color: var(--accent-gold-start);
}

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

/* Header & Nav */
header {
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.4s ease;
}

header.scrolled {
  box-shadow: 0 4px 30px var(--shadow-color);
  border-bottom: 1px solid var(--glass-highlight);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  height: 65px; 
  filter: drop-shadow(0 4px 12px var(--shadow-color));
  transition: all 0.3s ease;
}

header.scrolled .logo img {
  height: 50px;
}

.nav-right-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links li a {
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 600; /* Increased font weight */
  font-size: 1.1rem; /* Increased font size slightly */
  position: relative;
}

.nav-links li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: linear-gradient(90deg, var(--accent-gold-start), transparent);
  transition: width 0.3s ease;
}

.nav-links li a:hover::after {
  width: 100%;
}

.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  min-width: 200px;
  box-shadow: 0 10px 30px var(--shadow-hover);
  z-index: 1;
  top: 100%;
  left: 0;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 0;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.3s ease;
}

/* Ensure the hover area extends down */
.dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 20px;
  background: transparent;
  display: none;
}
.dropdown:hover::after {
  display: block;
}

.dropdown:hover .dropdown-content {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-content a {
  padding: 14px 20px;
  display: block;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-main);
}

.dropdown-content a:hover {
  background: var(--bg-surface-alt);
  padding-left: 25px;
}
body.rtl-mode .dropdown-content a:hover {
  padding-right: 25px;
  padding-left: 20px;
}

/* Controls */
.theme-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-main);
}

.lang-select {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-body);
  outline: none;
}
.lang-select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 2rem;
  cursor: pointer;
}

/* API Ticker / Metals Strip styling (Copied from Data_to_take_from and adapted) */
.metals-marquee-container {
    overflow: hidden;
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 12px 0;
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
}
.metals-marquee-content {
    display: inline-block;
    white-space: nowrap;
    animation: metals-marquee 40s linear infinite;
}
@keyframes metals-marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

#metals-strip {
    background: transparent;
}
.metals-up { color: #4caf7d; }
.metals-down { color: #e0685e; }
.metals-flat { color: #8a9099; }
.metals-card { transition: background-color .25s ease; padding: 1rem; text-align: center;}
.metals-card:hover { background-color: var(--glass-highlight); }
.metals-grid { display: grid; grid-template-columns: repeat(4, 1fr); }

.metals-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background: #8a9099;
}
.metals-dot[data-state="live"] { background: #4caf7d; animation: metals-pulse 2s ease-in-out infinite; }
.metals-dot[data-state="stale"] { background: #e0a95e; }
@keyframes metals-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

/* Hero Section */
.hero {
  margin-top: 0;
  padding: 6rem 2rem 6rem;
  text-align: left; /* Changed from center to left */
  background-size: cover;
  background-position: center;
  background-color: #111; /* Swallows fractional pixel gaps */
  position: relative;
  min-height: calc(100vh - 131px); /* Precise fit to remove the 2-4px white gap */
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.8) 100%);
}
.light-theme .hero::before {
  display: none; /* User explicitly requested NO filter in light mode for images */
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 1400px; /* Match nav-container */
  width: 100%;
  margin: 0 auto;
  transition: all 0.3s ease;
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: flex-start; /* Left align buttons */
}

.light-theme .hero-content {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.hero h1 {
  font-size: 2.8rem; /* Reduced from 3.5rem */
  font-weight: 800;
  margin-bottom: 1.2rem;
  line-height: 1.2;
  color: #ffffff; /* Always white over the dark hero image */
  text-shadow: 0 4px 15px rgba(0,0,0,0.6);
}
.light-theme .hero h1 {
  color: #ffffff; /* White text for contrast on the dark image */
  text-shadow: none; /* No filters or shadows as requested */
}

.hero p {
  font-size: 1.05rem; /* Reduced from 1.15rem */
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.85); /* Always light over dark hero image */
  max-width: 700px;
  margin-left: 0; /* Left align */
  margin-right: auto;
}
.light-theme .hero p {
  color: #f3f4f6; /* Light text for readability on dark image */
  text-shadow: none; /* No shadow */
  font-weight: 400; /* Regular weight for cleaner look with Open Sans */
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 2rem; /* Reduced padding */
  background: linear-gradient(135deg, var(--accent-gold-start), var(--accent-gold-end));
  color: #000 !important;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem; /* Reduced font size */
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px var(--accent-glow);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.btn:hover::before {
  left: 100%;
}

.btn-outline {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  color: var(--text-main) !important;
  border: 1px solid var(--glass-highlight);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--bg-surface);
  border-color: var(--accent-gold-end);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem; /* Reduced from 4rem */
}

.section-title {
  text-align: center;
  font-size: 2.8rem; /* Reduced from 3.5rem */
  font-weight: 700;
  margin-bottom: 3rem;
}

.grid {
  display: grid;
  gap: 2.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.products-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Glass Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  padding: 1.8rem; /* Reduced from 2.5rem */
  border-radius: 16px; /* Slightly sharper */
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow-color);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold-start), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.glass-card:hover {
  transform: translateY(-10px);
  border-color: var(--glass-highlight);
  box-shadow: 0 20px 40px var(--shadow-hover), 0 0 20px var(--accent-glow);
}

.glass-card:hover::before {
  opacity: 1;
}

.glass-card .card-icon {
  margin-bottom: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold-end);
}

.glass-card h3 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.glass-card img {
  border-radius: 12px;
  transition: transform 0.6s ease;
}

.glass-card:hover img {
  transform: scale(1.05);
}

/* Product Cards (Extends Glass Card Aesthetic) */
.product-card {
  width: 100%;
  max-width: 360px; /* Forces cards to be smaller as requested */
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow-color);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-10px);
  border-color: var(--glass-highlight);
  box-shadow: 0 20px 40px var(--shadow-hover), 0 0 20px var(--accent-glow);
}

.product-card-image {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.product-card-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  transition: transform 0.6s ease;
}

.product-card:hover .product-card-image img {
  transform: scale(1.08);
}

.product-card-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-content .btn {
  margin-top: auto; /* Pushes button to the bottom to align across cards */
}

.product-card-content h3 {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.product-card-content p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.product-features {
  list-style: none;
  margin-bottom: 2rem;
  flex-grow: 0;
}

.product-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.product-features li .feature-icon {
  color: var(--accent-gold-end);
  font-size: 1.2rem;
}


/* Animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 500;
}
.form-control {
  width: 100%;
  padding: 1rem;
  background: var(--bg-surface-alt);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 8px;
  font-family: var(--font-body);
  transition: all 0.3s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-gold-end);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Footer */
footer {
  background: var(--bg-surface-alt);
  border-top: 1px solid var(--glass-border);
  padding: 5rem 2rem 2rem;
  position: relative;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
}
.footer-col h4 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}
.footer-col ul {
  list-style: none;
}
.footer-col ul li {
  margin-bottom: 0.8rem;
}
.footer-col ul li a {
  color: var(--text-muted);
}
.footer-col ul li a:hover {
  color: var(--accent-gold-start);
  padding-left: 5px;
}
body.rtl-mode .footer-col ul li a:hover {
  padding-left: 0;
  padding-right: 5px;
}

.footer-bottom {
  text-align: center;
  padding-top: 2.5rem;
  margin-top: 4rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 992px) {
  .hero h1 { font-size: 2.8rem; } /* Adjusted down for mobile */
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .metals-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-right-controls {
    display: none;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    padding: 2rem;
    border-bottom: 1px solid var(--glass-border);
  }
  .nav-links.active {
    display: flex;
  }
  .mobile-menu-btn {
    display: block;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .hero h1 { font-size: 2.2rem; } /* Adjusted down for mobile */
  .metals-grid { grid-template-columns: 1fr; }
}

/* Metals Strip Overlap Styles */
.metals-strip-outer {
    position: relative;
    z-index: 10;
    margin-top: 2rem; /* Removed negative margin */
    margin-bottom: 4rem;
}
.metals-strip-container {
    padding: 1rem 0;
    max-width: 1400px;
    margin: 0 auto;
    background: transparent;
}
.metals-strip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0 2rem;
}
.metals-strip-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.metals-status-text {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}
.metals-strip-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.metals-control-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
}
.metals-ccy-btn {
    background: transparent;
    border: none;
    padding: 0 1rem;
    min-height: 40px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.metals-ccy-btn:hover {
    color: var(--text-main);
    background: var(--glass-highlight);
}
.metals-ccy-btn[aria-pressed="true"] {
    background: var(--accent-gold-end);
    color: #000;
    font-weight: 600;
}
.metals-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--glass-border);
}
.metals-card {
    padding: 1rem 2rem;
    border-right: 1px solid var(--glass-border);
    transition: background-color 0.25s ease;
    display: flex;
    flex-direction: column;
}
.metals-card:last-child {
    border-right: none;
}
.metals-card:hover {
    background-color: var(--glass-highlight);
}
.metals-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.metals-card-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin: 0;
}
.metals-change {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}
.metals-change.metals-up { color: #4caf7d; }
.metals-change.metals-down { color: #e0685e; }
.metals-card-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}
.metals-card-ccy {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.metals-card-price {
    font-size: 22px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
    font-weight: bold;
}
.metals-card-unit-short {
    font-size: 11px;
    line-height: 1;
    color: var(--text-muted);
}
.metals-card-unit-long {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.metals-spark {
    width: 100%;
    height: 24px;
    display: block;
    overflow: visible;
    margin-top: auto;
}
@media (max-width: 992px) {
    .metals-grid { grid-template-columns: repeat(2, 1fr); }
    .metals-card:nth-child(even) { border-right: none; }
    .metals-card:nth-child(1), .metals-card:nth-child(2) { border-bottom: 1px solid var(--glass-border); }
}
@media (max-width: 768px) {
    .metals-grid { grid-template-columns: 1fr; }
    .metals-card { border-right: none !important; border-bottom: 1px solid var(--glass-border); }
    .metals-card:last-child { border-bottom: none; }
}
