/*
 * Caramoon - Modern Automotive Services
 * Mobile-first Metro UI with Glassmorphism
 */

/* ========================================
   CSS VARIABLES & THEMING
   ======================================== */
:root {
  /* Colors - Light Theme with Warm Palette */
  --bg0: #FFFBF9;
  --bg1: #F9F4F1;
  --bg2: #EFEAE8;
  --bg3: #E3DEDC;
  --fg: #272320;
  --fg-muted: #3C3833;
  --muted: rgba(39, 35, 32, 0.78);
  --accent-primary: #6C3A00;
  --accent-warm: #EBD2C0;
  --accent-neutral: #BFBCBB;

  /* Glass Effect - Light Theme (stronger contrast for text) */
  --glass: rgba(255, 255, 255, 0.78);
  --glass-hover: rgba(255, 255, 255, 0.9);
  --stroke: rgba(108, 58, 0, 0.14);
  --stroke-hover: rgba(108, 58, 0, 0.25);
  --shadow: 0 14px 46px rgba(39, 35, 32, 0.12);
  --shadow-hover: 0 18px 54px rgba(39, 35, 32, 0.18);

  /* Border Radius */
  --r: 18px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Metro Grid - Mobile First with clamp() */
  --gap: clamp(10px, 2.2vw, 16px);
  --colMin: clamp(150px, 42vw, 220px);
  --row: clamp(104px, 18vw, 150px);

  /* Typography */
  --font-fa: "Vazirmatn", "Vazir", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-en: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 0.18s var(--ease-out);
  --transition-normal: 0.24s var(--ease-out);
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  color: var(--fg);
  background:
    radial-gradient(ellipse 1200px 700px at 12% 0%, rgba(235, 210, 192, 0.45), transparent 60%),
    radial-gradient(ellipse 900px 600px at 88% 18%, rgba(239, 234, 232, 0.65), transparent 60%),
    radial-gradient(ellipse 900px 700px at 55% 102%, rgba(108, 58, 0, 0.08), transparent 60%),
    var(--bg0);
  font-family: var(--font-fa);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* RTL Support */
html[dir="rtl"] body {
  font-family: var(--font-fa);
}

html[dir="ltr"] body {
  font-family: var(--font-en);
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.9;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ========================================
   TOPBAR / HEADER
   ======================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: linear-gradient(to bottom, rgba(255, 251, 249, 0.96), rgba(249, 244, 241, 0.9));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(108, 58, 0, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.15;
}

.brand__logo {
  width: 140px;
  height: 40px;
  /* #border-radius: 10px; */
  /* #background: var(--bg2); */
  object-fit: contain;
/* border: 1px solid var(--stroke); */
}

.brand__text {
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.2px;
  color: var(--accent-primary);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Icon Button */
.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--fg-muted);
  font-size: 1.1rem;
  box-shadow: 0 6px 20px rgba(39, 35, 32, 0.08);
  transition: all var(--transition-fast);
}

.iconBtn:hover {
  background: var(--glass-hover);
  border-color: var(--stroke-hover);
  transform: translateY(-1px);
}

.iconBtn:active {
  transform: translateY(0) scale(0.97);
}

.iconBtn[hidden] {
  display: none;
}

/* Language Toggle - Flag Style */
.langToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--glass);
  overflow: hidden;
  transition: all var(--transition-fast);
  padding: 0;
}

.langToggle:hover {
  background: var(--glass-hover);
  border-color: var(--stroke-hover);
  transform: translateY(-1px);
}

.langToggle__flag {
  width: 24px;
  height: 24px;
  /* border-radius: 4px; */
  /* object-fit: cover; */
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
.app {
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  margin: 8px 4px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero__title {
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-weight: 950;
  letter-spacing: -0.4px;
  line-height: 1.3;
}

.hero__subtitle {
  color: var(--muted);
  font-weight: 600;
  font-size: clamp(0.92rem, 2.5vw, 1.02rem);
  line-height: 1.85;
  /* max-width: 50ch; */
}

/* ========================================
   METRO GRID
   ======================================== */
.metroGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--colMin), 1fr));
  grid-auto-rows: var(--row);
  grid-auto-flow: dense;
  gap: var(--gap);
}

/* ========================================
   TILE (Metro Box)
   ======================================== */
.tile {
  /* Size variables - set per tile */
  --w: 1;
  --h: 1;
  --tint: var(--accent-primary);
  --bg: none;

  position: relative;
  display: flex;
  grid-column: span var(--w);
  grid-row: span var(--h);

  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.08)),
    radial-gradient(ellipse 700px 320px at 0% 0%, color-mix(in oklab, var(--tint) 40%, transparent), transparent 70%),
    var(--glass);
  box-shadow: var(--shadow);
  overflow: hidden;

  transform: translateZ(0);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

/* Background Image Layer */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  filter: saturate(1.02) contrast(0.9) brightness(0.92);
  opacity: 0.9;
  transform: scale(1.03);
  transition: transform 0.4s var(--ease-out), opacity var(--transition-normal);
  z-index: 0;
}

/* Glass Overlay */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.62) 100%),
    radial-gradient(ellipse 420px 240px at 15% 10%, color-mix(in oklab, var(--tint) 38%, transparent), transparent 66%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: backdrop-filter var(--transition-normal);
  z-index: 1;
}

/* Tile Content */
.tile__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 16px;
  width: 100%;
  height: 100%;
}

.tile__title {
  font-weight: 900;
  font-size: clamp(0.98rem, 2.5vw, 1.12rem);
  letter-spacing: -0.2px;
  color: var(--fg);
  text-shadow: 0 10px 24px rgba(255, 255, 255, 0.35);
  line-height: 1.35;
}

.tile__meta {
  color: var(--fg-muted);
  font-weight: 650;
  font-size: clamp(0.82rem, 2vw, 0.9rem);
  line-height: 1.65;
  max-width: 28ch;
  text-shadow: 0 8px 18px rgba(255, 255, 255, 0.28);
}

/* Tile Hover States */
.tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--stroke-hover);
}

.tile:hover::before {
  transform: scale(1.06);
  opacity: 1;
}

.tile:active {
  transform: translateY(0) scale(0.99);
}

.tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), var(--shadow);
}

/* ========================================
   GLASS PAGE (Content Pages)
   ======================================== */
.glassPage {
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 32px);
}

.pageTitle {
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 950;
  letter-spacing: -0.4px;
  margin-bottom: 16px;
  line-height: 1.35;
}

.pageBody {
  color: var(--muted);
  font-weight: 600;
  font-size: clamp(0.95rem, 2.5vw, 1.02rem);
  line-height: 2;
}

.pageBody p {
  margin-bottom: 16px;
}

.pageBody p:last-child {
  margin-bottom: 0;
}

.pageBody h2 {
  color: var(--fg);
  font-size: clamp(1.02rem, 3vw, 1.15rem);
  font-weight: 850;
  margin: 28px 0 12px;
  letter-spacing: -0.2px;
}

.pageBody h2:first-child {
  margin-top: 0;
}

.pageBody ul {
  margin: 12px 0;
  padding-inline-start: 22px;
}

.pageBody ul li {
  margin-bottom: 8px;
}

.pageBody a {
  color: var(--accent-cyan);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pageBody a:hover {
  opacity: 0.85;
}

/* Badge Row */
.badgeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: rgba(234, 240, 255, 0.92);
  font-weight: 800;
  font-size: 0.86rem;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.formInput,
.formTextarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.formInput::placeholder,
.formTextarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.formInput:focus,
.formTextarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: var(--glass-hover);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15);
}

.formTextarea {
  resize: vertical;
  min-height: 140px;
}

.formBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: var(--r);
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(45, 212, 191, 0.12));
  color: var(--fg);
  font-weight: 900;
  font-size: 0.98rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.formBtn:hover {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.32), rgba(45, 212, 191, 0.18));
  transform: translateY(-1px);
}

.formBtn:active {
  transform: translateY(0) scale(0.98);
}

.formGroup {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

/* ========================================
   PAGE TRANSITION ANIMATIONS
   ======================================== */
.pageFadeIn {
  animation: pageIn 0.28s var(--ease-out) both;
}

.pageFadeOut {
  animation: pageOut 0.22s var(--ease-out) both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes pageOut {
  from {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(3px);
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .pageFadeIn,
  .pageFadeOut {
    animation: none;
  }
  
  .tile,
  .iconBtn,
  .langToggle,
  .formInput,
  .formTextarea,
  .formBtn {
    transition: none;
  }
  
  .tile::before {
    transition: none;
  }
}

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

/* Small phones (320px - 374px) */
@media (max-width: 374px) {
  :root {
    --colMin: 100%;
    --row: 110px;
  }
  
  .metroGrid {
    grid-template-columns: 1fr;
  }
  
  .tile {
    --w: 1 !important;
  }
}

/* Medium phones (375px - 479px) */
@media (min-width: 375px) and (max-width: 479px) {
  :root {
    --colMin: clamp(140px, 45vw, 180px);
    --row: clamp(100px, 22vw, 130px);
  }
}

/* Large phones / Small tablets (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
  :root {
    --colMin: clamp(160px, 38vw, 200px);
    --row: clamp(110px, 18vw, 140px);
  }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) {
  :root {
    --colMin: clamp(170px, 28vw, 210px);
    --row: clamp(120px, 14vw, 150px);
    --gap: clamp(12px, 2vw, 18px);
  }
  
  .app {
    padding: 20px 24px;
  }
  
  .hero {
    margin-bottom: 28px;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  :root {
    --colMin: clamp(180px, 18vw, 240px);
    --row: clamp(130px, 12vw, 160px);
    --gap: 18px;
  }
  
  .topbar {
    padding: 16px 28px 14px;
  }
  
  .app {
    padding: 24px 32px;
  }
  
  .tile__content {
    padding: 20px;
  }
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
  :root {
    --colMin: 220px;
    --row: 160px;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

/* ========================================
   FOOTER NOTE
   ======================================== */
.footer-note {
  margin: 28px 4px 12px;
  color: var(--fg-muted);
  font-weight: 650;
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.6;
  padding: 8px 12px;
  /* border-radius: 12px; */
  /* background: rgba(255, 255, 255, 0.7); */
  border: 1px solid var(--stroke);
  /* box-shadow: 0 8px 22px rgba(39, 35, 32, 0.08); */
}

/* ========================================
   FONT LOADING
   ======================================== */
@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
