/* ==========================================================================
   RARE VISION — Design tokens
   Palette: near-black charcoal surface, warm off-white text, burnished gold
   accent (the "rare" signal), muted red only for sale tags.
   Type: Tajawal (Arabic display/body) + Oswald (Latin wordmark/numerals)
   ========================================================================== */

:root{
  --bg: #0b0b0d;
  --surface: #17171b;
  --surface-alt: #1f1f24;
  --surface-hover: #232329;
  --border: #2a2a30;
  --border-soft: #232329;

  --text: #f3f1ea;
  --text-muted: #9a9aa1;
  --text-faint: #6c6c73;

  --gold: #c9a227;
  --gold-bright: #e8c158;
  --gold-dim: #7d651c;
  --red: #d9503d;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-card: 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-panel: -20px 0 60px -20px rgba(0,0,0,.7);

  --font-display: 'Tajawal', 'Oswald', sans-serif;
  --font-latin: 'Oswald', sans-serif;
  --font-body: 'Tajawal', sans-serif;

  --header-h: 76px;
  --ease: cubic-bezier(.22,.85,.34,1);
}

*, *::before, *::after{ box-sizing: border-box; }

html{ scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea{ font: inherit; color: inherit; }

::selection{ background: var(--gold); color: #0b0b0d; }

:focus-visible{
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.svg-icon, svg{ width: 22px; height: 22px; }

/* Container helper */
.section-head{
  max-width: 1240px;
  margin: 0 auto 28px;
  padding: 0 24px;
}
.section-eyebrow{
  display:inline-block;
  font-family: var(--font-latin);
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.section-head h2{
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 800;
  margin: 0;
}

/* Buttons */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary{
  background: var(--gold);
  color: #14140f;
}
.btn-primary:hover{ background: var(--gold-bright); transform: translateY(-2px); }
.btn-primary:disabled{ background: var(--border); color: var(--text-faint); cursor: not-allowed; transform:none; }

.btn-ghost{
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover{ border-color: var(--gold); color: var(--gold-bright); }

.btn-block{ width: 100%; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(11,11,13,.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner{
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo{
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .04em;
  color: var(--text);
}
.logo span{ color: var(--gold); }

.main-nav{
  display: flex;
  gap: 28px;
  font-size: 15px;
  font-weight: 500;
}
.main-nav a{ color: var(--text-muted); transition: color .2s; position: relative; }
.main-nav a:hover{ color: var(--text); }
.main-nav a::after{
  content: '';
  position: absolute; right: 0; bottom: -6px;
  width: 0; height: 2px; background: var(--gold);
  transition: width .25s var(--ease);
}
.main-nav a:hover::after{ width: 100%; }

.header-actions{ display: flex; align-items: center; gap: 6px; }
.icon-btn{
  position: relative;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: background .2s;
}
.icon-btn:hover{ background: var(--surface-alt); }
.cart-badge{
  position: absolute;
  top: 2px; left: 2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold);
  color: #14140f;
  font-family: var(--font-latin);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transform: scale(0);
  transition: transform .25s var(--ease);
}
.cart-badge.show{ transform: scale(1); }

.nav-toggle{ display: none; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero{
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(160deg, #141417, #0b0b0d 60%);
}
.hero-video{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .55;
}
.hero-overlay{
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,11,13,.35) 0%, rgba(11,11,13,.55) 55%, rgba(11,11,13,.95) 100%),
    linear-gradient(270deg, rgba(11,11,13,.75) 0%, rgba(11,11,13,.15) 55%);
}
.hero-content{
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}
.eyebrow{
  display: inline-block;
  font-family: var(--font-latin);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-bright);
  border: 1px solid var(--gold-dim);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero-title{
  font-size: clamp(48px, 9vw, 104px);
  font-weight: 900;
  line-height: 1.02;
  margin: 0 0 20px;
  letter-spacing: -.01em;
}
.hero-title span{ color: var(--gold); }
.hero-sub{
  max-width: 520px;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-muted);
  margin: 0 0 34px;
}
.hero-actions{ display: flex; gap: 14px; flex-wrap: wrap; }

.scroll-hint{
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--text-faint);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob{
  0%,100%{ transform: translate(-50%, 0); }
  50%{ transform: translate(-50%, 8px); }
}

/* ==========================================================================
   SHOP SECTION
   ========================================================================== */
.shop-section{
  max-width: 1240px;
  margin: 0 auto;
  padding: 96px 24px 40px;
}

.shop-toolbar{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.search-box{
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  transition: border-color .2s;
}
.search-box:focus-within{ border-color: var(--gold); }
.search-box svg{ width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }
.search-box input{
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 13px 10px;
  font-size: 15px;
  color: var(--text);
}
.search-box input::placeholder{ color: var(--text-faint); }
.search-clear{
  font-size: 20px;
  color: var(--text-faint);
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.search-clear:hover{ color: var(--text); }

.category-chips{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip{
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .2s;
  white-space: nowrap;
}
.chip:hover{ color: var(--text); border-color: var(--text-faint); }
.chip.active{
  background: var(--gold);
  border-color: var(--gold);
  color: #14140f;
  font-weight: 700;
}

.results-meta{
  color: var(--text-faint);
  font-size: 13px;
  margin: 0 0 20px;
}

/* Products grid */
.products-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.product-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
  animation: cardIn .4s var(--ease) both;
}
.product-card:hover{
  transform: translateY(-6px);
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-card);
}
@keyframes cardIn{
  from{ opacity: 0; transform: translateY(14px); }
  to{ opacity: 1; transform: translateY(0); }
}

.card-media{
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-alt);
  overflow: hidden;
}
.card-media img{
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.product-card:hover .card-media img{ transform: scale(1.06); }

.card-badge{
  position: absolute;
  top: 12px; right: 12px;
  font-family: var(--font-latin);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}
.card-badge.new{ background: var(--gold); color: #14140f; }

.card-body{
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card-brand{
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: var(--font-latin);
}
.card-name{
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  min-height: 40px;
}
.card-price-row{
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.card-price{
  font-family: var(--font-latin);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-bright);
}
.card-price-old{
  font-family: var(--font-latin);
  font-size: 13px;
  color: var(--text-faint);
  text-decoration: line-through;
}

.card-add{
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: all .2s;
}
.card-add:hover{ background: var(--gold); border-color: var(--gold); color: #14140f; }
.card-add:disabled{
  opacity: .5;
  cursor: not-allowed;
}
.card-add.added{ background: var(--gold-bright); border-color: var(--gold-bright); color: #14140f; }

.out-of-stock{
  position: absolute; inset: 0;
  background: rgba(11,11,13,.6);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
}

/* Empty / loading states */
.empty-state, .loading-state{
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p{ margin-bottom: 16px; }
.spinner{
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  margin: 0 auto 14px;
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ==========================================================================
   TRUST BAR
   ========================================================================== */
.trust-bar{
  max-width: 1240px;
  margin: 40px auto 0;
  padding: 48px 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  border-top: 1px solid var(--border-soft);
}
.trust-item{ display: flex; gap: 14px; align-items: flex-start; }
.trust-icon{ font-size: 26px; line-height: 1; }
.trust-item h3{ font-size: 15px; margin: 0 0 4px; }
.trust-item p{ font-size: 13px; color: var(--text-muted); margin: 0; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer{
  margin-top: 60px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
}
.footer-inner{
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 24px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
.footer-brand p{ color: var(--text-muted); font-size: 14px; max-width: 340px; margin: 14px 0 20px; }
.social-links{ display: flex; gap: 10px; }
.social-links a{
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all .2s;
}
.social-links svg{ width: 17px; height: 17px; }
.social-links a:hover{ border-color: var(--gold); color: var(--gold-bright); }

.footer-col h4{ font-size: 14px; margin: 0 0 16px; color: var(--text); }
.footer-col{ display: flex; flex-direction: column; gap: 10px; }
.footer-col a{ color: var(--text-muted); font-size: 14px; transition: color .2s; }
.footer-col a:hover{ color: var(--gold-bright); }

.footer-bottom{
  border-top: 1px solid var(--border-soft);
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* ==========================================================================
   CART PANEL + OVERLAY
   ========================================================================== */
.overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.overlay.show{ opacity: 1; pointer-events: auto; }

.cart-panel{
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  width: min(420px, 100vw);
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  box-shadow: var(--shadow-panel);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .38s var(--ease);
}
.cart-panel.open{ transform: translateX(0); }

.cart-header{
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.cart-header h3{ margin: 0; font-size: 18px; }
.cart-header .icon-btn{ font-size: 22px; }

.cart-body{
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px;
}
.cart-items{ display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }

.cart-empty{
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 60px 10px;
  color: var(--text-muted);
}
.cart-empty.show{ display: flex; }

.cart-item{
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
}
.cart-item img{
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}
.cart-item-name{ font-size: 14px; font-weight: 700; margin: 0 0 4px; }
.cart-item-price{ font-family: var(--font-latin); font-size: 13px; color: var(--gold-bright); }
.cart-item-qty{
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.qty-btn{
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text);
}
.qty-btn:hover{ border-color: var(--gold); color: var(--gold-bright); }
.qty-value{ font-family: var(--font-latin); font-size: 13px; min-width: 16px; text-align: center; }

.cart-item-remove{
  align-self: flex-start;
  color: var(--text-faint);
  font-size: 12px;
  text-decoration: underline;
}
.cart-item-remove:hover{ color: var(--red); }

.cart-footer{
  flex-shrink: 0;
  padding: 18px 22px 22px;
  border-top: 1px solid var(--border-soft);
}
.cart-total-row{
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
  font-size: 15px;
}
.cart-total-row span:last-child{
  font-family: var(--font-latin);
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-bright);
}

/* Checkout form */
.checkout-form{
  padding: 12px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.checkout-form h4{ margin: 4px 0 4px; font-size: 15px; }
.checkout-form label{
  display: flex; flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.checkout-form input, .checkout-form textarea{
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  resize: vertical;
}
.checkout-form textarea{ min-height: 64px; font-family: var(--font-body); }
.checkout-form input:focus, .checkout-form textarea:focus{ border-color: var(--gold); }
.checkout-form input:invalid:not(:placeholder-shown){ border-color: var(--red); }

.form-error{
  background: rgba(217,80,61,.12);
  border: 1px solid rgba(217,80,61,.4);
  color: #ff9384;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 0;
}

.checkout-actions{ display: flex; gap: 10px; margin-top: 6px; }
.checkout-actions .btn{ flex: 1; }

.btn-spinner{
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.25);
  border-top-color: #14140f;
  animation: spin .7s linear infinite;
}

/* Thank you state */
.thank-you{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 40px 30px;
}
.thank-you-icon{
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: #14140f;
  font-size: 26px;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.thank-you h4{ margin: 0; font-size: 18px; }
.thank-you p{ color: var(--text-muted); font-size: 14px; max-width: 280px; }
.thank-you .btn{ margin-top: 14px; }

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast{
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--surface-alt);
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: all .3s var(--ease);
}
.toast.show{ opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px){
  .trust-bar{ grid-template-columns: repeat(2, 1fr); }
  .footer-inner{ grid-template-columns: 1fr 1fr; }
  .footer-brand{ grid-column: 1 / -1; }
}

@media (max-width: 760px){
  .main-nav{
    position: fixed;
    top: var(--header-h);
    right: 0; left: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border-soft);
    flex-direction: column;
    padding: 10px 24px 20px;
    gap: 4px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: all .25s var(--ease);
  }
  .main-nav.open{ transform: translateY(0); opacity: 1; pointer-events: auto; }
  .main-nav a{ padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
  .nav-toggle{ display: flex; }

  .hero-title{ font-size: clamp(40px, 12vw, 64px); }
  .shop-section{ padding-top: 60px; }
  .trust-bar{ grid-template-columns: 1fr; }
  .footer-inner{ grid-template-columns: 1fr; }
  .cart-panel{ width: 100vw; }
}

@media (max-width: 480px){
  .products-grid{ grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
  .card-name{ font-size: 13.5px; min-height: 34px; }
  .card-price{ font-size: 15px; }
  .hero-actions{ flex-direction: column; align-items: stretch; }
}
