/* =========================================================
   MASAR KARTING — cinematic sport site
   Black + Red identity. Logical properties used throughout
   so this single stylesheet serves both RTL (ar) and LTR (en).
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@400;600;700&family=Tajawal:wght@400;500;700;800&display=swap');

:root{
  --black: #060606;
  --black-2: #0d0d0d;
  --panel: #141414;
  --panel-2: #1b1b1b;
  --line: rgba(255,255,255,.08);
  --red: #e10600;
  --red-2: #ff2d1f;
  --red-dim: #7a0500;
  --white: #f4f4f2;
  --grey: #a8a8a8;
  --grey-dim: #6e6e6e;

  --font-display: 'Bebas Neue', 'Tajawal', sans-serif;
  --font-body: 'Oswald', 'Tajawal', sans-serif;
  --font-body-ar: 'Tajawal', 'Oswald', sans-serif;

  --container: 1200px;
  --radius: 4px;
  --radius-lg: 14px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);

  --glow-red: 0 0 24px rgba(225,6,0,.45);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

html[lang="ar"] body{ font-family: var(--font-body-ar); }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] .logo-word{
  font-family: var(--font-body-ar);
  font-weight: 800;
  letter-spacing: 0;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body{
  margin: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
ul{ list-style: none; margin: 0; padding: 0; }
button{ font: inherit; }

.container{
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.eyebrow{
  display: inline-flex;
  align-items: center;
  gap: .5em;
  color: var(--red-2);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: .78rem;
}
html[lang="ar"] .eyebrow{ letter-spacing: .02em; font-weight: 700; }
.eyebrow::before{
  content: "";
  width: 26px; height: 2px;
  background: var(--red);
  display: inline-block;
}

h1,h2,h3{
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 .5em;
}
h1{ font-size: clamp(2.6rem, 7vw, 5.5rem); }
h2{ font-size: clamp(1.9rem, 4.4vw, 3.2rem); }
h3{ font-size: clamp(1.2rem, 2vw, 1.5rem); }
p{ color: var(--grey); margin: 0 0 1em; }

.section-head{
  max-width: 640px;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section-head.center{ margin-inline: auto; text-align: center; }

/* ---------- Buttons ---------- */
.btn{
  --btn-bg: var(--red);
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .9em 1.9em;
  background: var(--btn-bg);
  color: var(--white);
  border: 1px solid var(--btn-bg);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .85rem;
  cursor: pointer;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), background .25s;
  white-space: nowrap;
}
html[lang="ar"] .btn{ letter-spacing: .01em; font-weight: 700; }
.btn:hover{ transform: translateY(-2px); box-shadow: var(--glow-red); background: var(--red-2); }
.btn.ghost{
  --btn-bg: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,.35);
}
.btn.ghost:hover{ border-color: var(--red-2); box-shadow: none; background: rgba(225,6,0,.08); }

/* ---------- Nav ---------- */
.nav{
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  padding: 1.1rem 0;
  transition: background .35s, padding .35s, border-color .35s;
  border-bottom: 1px solid transparent;
}
.nav.solid{
  background: rgba(6,6,6,.86);
  backdrop-filter: blur(10px);
  padding: .7rem 0;
  border-color: var(--line);
}
.nav-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo{
  display: flex;
  align-items: baseline;
  gap: .4em;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: .04em;
}
html[lang="ar"] .logo{ font-family: var(--font-body-ar); font-weight: 800; font-size: 1.3rem; }
.logo .dot{ color: var(--red-2); }

.nav-links{
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a{
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--grey);
  transition: color .2s;
  position: relative;
}
html[lang="ar"] .nav-links a{ letter-spacing: 0; font-weight: 600; }
.nav-links a:hover{ color: var(--white); }

.lang-switch{
  display: inline-flex;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  overflow: hidden;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lang-switch a{
  padding: .4em 1em;
  color: var(--grey);
}
.lang-switch a.active{ background: var(--red); color: var(--white); }

.nav-toggle{
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  color: var(--white);
  width: 42px; height: 38px;
  align-items: center;
  justify-content: center;
}

/* ---------- Hero ---------- */
.hero{
  position: relative;
  height: 260vh; /* scroll runway that drives the drive-in animation */
}
.hero-sticky{
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#hero-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-poster{
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 0;
}
.no-webgl .hero-poster{ opacity: 1; }
.no-webgl #hero-canvas{ display: none; }

.reduced-motion .hero{ height: 100vh; }

.hero-vignette{
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,.55) 100%),
    linear-gradient(to bottom, rgba(0,0,0,.55) 0%, transparent 22%, transparent 68%, rgba(0,0,0,.85) 100%);
}
.hero-grain{
  position: absolute; inset: 0; z-index: 2;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-content{
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 0 1.5rem;
  will-change: transform, opacity;
}
.hero-content .eyebrow{ justify-content: center; margin-bottom: 1.1rem; }
.hero-content h1{
  margin: 0;
  text-shadow: 0 6px 40px rgba(0,0,0,.6);
}
.hero-content h1 span{ display:block; color: var(--red-2); }
.hero-kicker{
  max-width: 560px;
  margin: 1.3rem auto 2rem;
  color: var(--grey);
  font-size: 1.05rem;
}
.hero-ctas{ display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.scroll-cue{
  position: absolute;
  bottom: 2.4rem;
  inset-inline: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  color: var(--grey);
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .8;
}
.scroll-cue .bar{
  width: 1px; height: 34px;
  background: linear-gradient(to bottom, var(--red-2), transparent);
  animation: scrollcue 1.8s infinite ease-in-out;
}
@keyframes scrollcue{
  0%{ transform: scaleY(.3); transform-origin: top; opacity: .4; }
  50%{ transform: scaleY(1); transform-origin: top; opacity: 1; }
  100%{ transform: scaleY(.3); transform-origin: top; opacity: .4; }
}

/* ---------- Generic section rhythm ---------- */
section{ position: relative; padding: clamp(4.5rem, 10vw, 8rem) 0; }
.section-alt{ background: linear-gradient(var(--black-2), var(--black-2)); border-block: 1px solid var(--line); }

/* Simple header for interior pages that have no 3D hero (e.g. the articles page) */
.page-header{
  padding: clamp(8rem, 16vw, 11rem) 0 clamp(3rem, 6vw, 4rem);
  background: radial-gradient(ellipse at top, rgba(225,6,0,.12), transparent 60%);
  border-bottom: 1px solid var(--line);
}
.page-header h1{ margin: 0 0 .6rem; }

.reveal{ opacity: 0; transform: translateY(36px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal.in{ opacity: 1; transform: translateY(0); }
.reveal-stagger > *{ transition-delay: calc(var(--i, 0) * 90ms); }

/* ---------- About ---------- */
.about-grid{
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: var(--gap);
  align-items: center;
}
.about-media{
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/5;
  border: 1px solid var(--line);
}
.about-media img{ width: 100%; height: 100%; object-fit: cover; }
.about-media::after{
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7), transparent 45%);
}
.stat-row{ display: flex; gap: clamp(1.5rem,4vw,3rem); margin-top: 2rem; flex-wrap: wrap; }
.stat b{ display:block; font-family: var(--font-display); font-size: 2.4rem; color: var(--red-2); }
html[lang="ar"] .stat b{ font-family: var(--font-body-ar); font-weight: 800; }
.stat span{ color: var(--grey); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Features ---------- */
.features-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.feature-card{
  background: var(--black-2);
  padding: 2.2rem 1.8rem;
  transition: background .3s;
}
.feature-card:hover{ background: var(--panel); }
.feature-card .icon{
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--red-dim);
  border-radius: 50%;
  color: var(--red-2);
  margin-bottom: 1.2rem;
}
.feature-card h3{ margin-bottom: .5rem; }
.feature-card p{ font-size: .92rem; margin: 0; }

/* ---------- Locations ---------- */
.locations-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}
.location-card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  position: relative;
  overflow: hidden;
}
.location-card::before{
  content: "";
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 3px; background: var(--red);
}
.location-card h3{ display:flex; align-items:center; gap:.6em; }
.hours-list{ margin: 1.2rem 0; }
.hours-list li{ display:flex; justify-content: space-between; padding: .5em 0; border-bottom: 1px dashed var(--line); color: var(--grey); font-size: .92rem; }
.hours-list li b{ color: var(--white); font-weight: 500; }

/* ---------- Gallery ---------- */
.gallery-grid{
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 130px;
  gap: .6rem;
}
.gallery-grid a{
  position: relative;
  grid-column: span 3;
  grid-row: span 2;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
.gallery-grid a:nth-child(1){ grid-column: span 4; grid-row: span 3; }
.gallery-grid a:nth-child(2){ grid-column: span 2; grid-row: span 2; }
.gallery-grid a:nth-child(3){ grid-column: span 2; grid-row: span 2; }
.gallery-grid a:nth-child(4){ grid-column: span 3; grid-row: span 2; }
.gallery-grid a:nth-child(5){ grid-column: span 3; grid-row: span 2; }
.gallery-grid img{
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--ease-out), filter .6s;
  filter: saturate(.9) contrast(1.05);
}
.gallery-grid a:hover img{ transform: scale(1.08); filter: saturate(1.1) contrast(1.1); }
.gallery-grid a::after{
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent 50%);
}

/* ---------- CTA banner ---------- */
.cta-banner{
  text-align: center;
  background:
    radial-gradient(ellipse at center, rgba(122,5,0,.55) 0%, rgba(6,6,6,.93) 70%),
    url("../images/brand/cta-bg.jpg");
  background-size: cover;
  background-position: center;
  border-block: 1px solid var(--line);
}
.cta-banner h2{ margin-bottom: .6rem; }
.cta-banner .btn{ margin-top: 1.2rem; }

/* ---------- Articles / Accordion (SEO) ---------- */
.articles{ padding-bottom: clamp(3rem,6vw,5rem); }
.accordion{ border-top: 1px solid var(--line); }
.accordion-item{ border-bottom: 1px solid var(--line); }
.accordion-item summary{
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  letter-spacing: .01em;
  text-transform: none;
}
html[lang="ar"] .accordion-item summary{ font-family: var(--font-body-ar); font-weight: 700; font-size: clamp(1rem,1.8vw,1.2rem); }
.accordion-item summary::-webkit-details-marker{ display:none; }
.accordion-item summary .plus{
  flex: none;
  width: 30px; height: 30px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--red-2);
  transition: transform .3s, background .3s;
}
.accordion-item[open] summary .plus{ transform: rotate(45deg); background: rgba(225,6,0,.12); }
.accordion-item .accordion-body{
  padding: 0 0 1.6rem;
  max-width: 820px;
}
.accordion-item .accordion-body p{ font-size: .95rem; }

/* ---------- Footer ---------- */
footer{
  background: var(--black-2);
  border-top: 1px solid var(--line);
  padding: 3.5rem 0 2rem;
}
.footer-grid{
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: var(--gap);
  margin-bottom: 2.5rem;
}
.footer-grid p{ font-size: .88rem; }
.footer-grid h4{
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .8rem;
  color: var(--grey);
  margin-bottom: 1rem;
}
.footer-grid a{ display:block; padding: .35em 0; color: var(--grey); font-size: .9rem; transition: color .2s; }
.footer-grid a:hover{ color: var(--red-2); }
.footer-bottom{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--grey-dim);
  font-size: .78rem;
}
.social-row{ display: flex; gap: .8rem; }
.social-row a{
  width: 36px; height: 36px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  transition: border-color .2s, color .2s, background .2s;
}
.social-row a:hover{ border-color: var(--red); color: var(--red-2); background: rgba(225,6,0,.08); }

/* ---------- Responsive ---------- */
@media (max-width: 980px){
  .about-grid{ grid-template-columns: 1fr; }
  .features-grid{ grid-template-columns: repeat(2,1fr); }
  .locations-grid{ grid-template-columns: 1fr; }
  .footer-grid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px){
  .nav-links{
    position: fixed;
    inset: 0 0 0 auto;
    top: 0; bottom: 0;
    width: min(78vw, 320px);
    background: var(--black-2);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    gap: 1.6rem;
    transform: translateX(105%);
    transition: transform .35s var(--ease-out);
    border-inline-start: 1px solid var(--line);
  }
  html[dir="rtl"] .nav-links{ inset: 0 auto 0 0; transform: translateX(-105%); }
  .nav-links.open{ transform: translateX(0); }
  .nav-toggle{ display: flex; }
  .features-grid{ grid-template-columns: 1fr; }
  .gallery-grid{ grid-template-columns: repeat(2,1fr); grid-auto-rows: 150px; }
  .gallery-grid a, .gallery-grid a:nth-child(n){ grid-column: span 1; grid-row: span 1; }
  .footer-grid{ grid-template-columns: 1fr; }
  .footer-bottom{ flex-direction: column; align-items: flex-start; }
}
