/* ===================================================
   کابل اتلانتیک کارگو — styles.css
   Fixed: dark/light mode, mobile (old & new), layout
   =================================================== */

/* ── CSS Variables ─────────────────────────────── */
:root {
  /* Dark theme (default) */
  --bg: #0f1724;
  --bg2: #071124;
  --card: #0b1220;
  --card2: #101b2e;
  --text: #e6eef8;
  --text-sub: #9aa4b2;
  --accent: #ff6b35;
  --accent-h: #ff8c5a;
  --border: rgba(255, 255, 255, 0.07);
  --glass: rgba(255, 255, 255, 0.04);
  --shadow: rgba(2, 6, 23, 0.7);
  --header-bg: rgba(7, 17, 36, 0.85);
  /* Performance optimization */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* Light theme */
html.theme-light {
  --bg: #f4f6fb;
  --bg2: #e8edf5;
  --card: #ffffff;
  --card2: #f0f4fa;
  --text: #111827;
  --text-sub: #4b5563;
  --accent: #e85d20;
  --accent-h: #c74d16;
  --border: rgba(0, 0, 0, 0.10);
  --glass: rgba(0, 0, 0, 0.04);
  --shadow: rgba(0, 0, 0, 0.15);
  --header-bg: rgba(244, 246, 251, 0.92);
  color-scheme: light;
}

/* ── Reset & Base ──────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Improve rendering performance */
  font-display: swap;
}

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, Arial, sans-serif;
  line-height: 1.65;
  background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition-normal), color var(--transition-normal);
  /* Performance: use GPU acceleration for transforms */
  will-change: auto;
  /* Prevent layout shift */
  overflow-x: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Screen reader only ────────────────────────── */
.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;
}

/* ── Container ─────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Header ────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
}

/* Brand logo + text */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.brand-logo {
  height: 40px;
  width: 40px;
  object-fit: cover;
  border-radius: 8px;
}

/* Nav */
.nav {
  display: flex;
  gap: 0.25rem;
  margin-inline-start: auto;
}

.nav a {
  color: var(--text-sub);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--text);
  background: var(--glass);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

/* CTA button */
.cta {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.cta:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
}

/* Icon buttons (theme + menu toggle) */
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 1.1rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  font-family: inherit;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  background: var(--glass);
  border-color: var(--accent);
}

/* Menu toggle — hidden on desktop */
#menu-toggle {
  display: none;
}

/* Mobile nav (shown when .nav-open) */
.nav.nav-open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  gap: 0.25rem;
  z-index: 99;
}

/* ── Hero ──────────────────────────────────────── */
.hero {
  position: relative;
  padding: 4rem 0 3rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('./media/next-text.jpg');
  background-size: cover;
  background-position: center;
  filter: blur(6px) brightness(0.55);
  transform: scale(1.04);
  z-index: 0;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  margin-bottom: 0.6rem;
  line-height: 1.3;
  color: #fff;
}

.hero-text p {
  color: rgba(230, 238, 248, 0.85);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  max-width: 55ch;
}

/* Hero CTA buttons */
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: 10px;
  font-size: 0.97rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s, box-shadow 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(255, 107, 53, 0.35);
}

.btn.primary:hover {
  background: var(--accent-h);
  transform: translateY(-2px);
}

.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

html.theme-light .btn.ghost {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

.btn.ghost:hover {
  background: var(--glass);
  transform: translateY(-2px);
}

/* Features pill list */
.features-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.features-list li {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: rgba(230, 238, 248, 0.9);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ── Sections ──────────────────────────────────── */
.services,
.portfolio,
.how-it-works,
.testimonials,
.contact {
  padding: 3rem 0;
}

h2 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* ── Service cards grid ────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.85rem;
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px var(--shadow);
}

.card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
}

.card h3 {
  margin: 0.65rem 0 0.3rem;
  font-size: 1rem;
  color: var(--text);
}

.card p {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin: 0;
}

/* ── Portfolio grid & work-card ────────────────── */
.portfolio .lead {
  color: var(--text-sub);
  margin-bottom: 1.25rem;
  margin-top: -0.5rem;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.work-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
}

.work-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px var(--shadow);
}

.work-card video,
.work-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.work-card .overlay {
  position: absolute;
  inset: 0;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}

.work-card .overlay h4 {
  margin: 0 0 0.2rem;
  color: #fff;
  font-size: 1rem;
}

.work-card .overlay p {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
}

/* ── Testimonials ──────────────────────────────── */
.testimonial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.testimonial {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1.2rem;
  border-radius: 12px;
  color: var(--text);
}

.testimonial p {
  color: var(--text-sub);
  margin-bottom: 0.6rem;
  font-style: italic;
}

.testimonial strong {
  color: var(--accent);
}

/* ── Contact ───────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: start;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.9rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
}

.info-card:last-child {
  margin-bottom: 0;
}

.info-card h4 {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.info-card p {
  color: var(--text-sub);
  font-size: 0.95rem;
  margin: 0;
}

.info-card a {
  color: var(--accent);
  text-decoration: underline;
}

.contact-support {
  display: flex;
  align-items: flex-start;
  padding-top: 0.25rem;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── Modal ─────────────────────────────────────── */
.work-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.work-modal[aria-hidden="false"] {
  display: flex;
}

.work-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
}

.work-modal-panel {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  max-width: 860px;
  width: 94%;
  z-index: 10;
  box-shadow: 0 24px 64px var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 320px;
  border: 1px solid var(--border);
}

.work-modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-modal-body {
  padding: 1.25rem;
}

.work-modal-title {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.work-modal-desc {
  color: var(--text-sub);
  line-height: 1.6;
}

.work-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 1.1rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
  font-family: inherit;
}

.work-modal-close:hover {
  color: var(--text);
  background: var(--glass);
}

/* ── Footer ────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  margin-top: 2rem;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.socials {
  display: flex;
  gap: 0.5rem;
}

.socials a {
  color: var(--text-sub);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--glass);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .testimonial-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-support {
    justify-content: flex-start;
  }

  .wa-btn {
    width: 100%;
  }

  .work-modal-panel {
    grid-template-columns: 1fr;
  }

  .work-modal-image {
    height: 240px;
  }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 640px)
   ═══════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Header */
  .nav {
    display: none;
  }

  #menu-toggle {
    display: flex;
  }

  .cta {
    display: none;
  }

  /* روی موبایل دکمه header مخفی — در hero هست */

  .brand span {
    font-size: 0.95rem;
  }

  .brand-logo {
    height: 34px;
    width: 34px;
  }

  /* Hero */
  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero-text p {
    font-size: 0.95rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn {
    width: 100%;
    text-align: center;
    padding: 0.85rem 1rem;
  }

  /* Sections */
  .services,
  .portfolio,
  .how-it-works,
  .testimonials,
  .contact {
    padding: 2rem 0;
  }

  /* Grids */
  .services-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .testimonial-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  /* Cards */
  .card img {
    height: 180px;
  }

  .work-card video,
  .work-card img {
    aspect-ratio: 4/3;
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .socials {
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Small Mobile (≤ 380px) — گوشی قدیمی
   ═══════════════════════════════════════════════ */
@media (max-width: 380px) {
  .container {
    padding: 0 0.75rem;
  }

  .brand span {
    display: none;
  }

  /* فقط لوگو نشان داده می‌شود */
  .brand-logo {
    height: 32px;
    width: 32px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .hero-text h1 {
    font-size: 1.4rem;
  }

  .hero-text p {
    font-size: 0.9rem;
  }

  .features-list li {
    font-size: 0.82rem;
    padding: 0.3rem 0.55rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .card img {
    height: 150px;
  }

  .btn {
    font-size: 0.93rem;
    padding: 0.75rem 1rem;
  }

  .wa-btn {
    font-size: 0.93rem;
  }
}

/* ── Advertisement Units ───────────────────────── */
.ad-unit {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 1.5rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ad-unit--leaderboard {
  width: 100%;
  max-width: 728px;
  height: 90px;
}

.ad-unit--medium-rectangle {
  width: 300px;
  height: 250px;
  margin-left: auto;
  margin-right: 1rem;
  float: right;
}

/* When no ad is loaded */
.ad-unit:empty {
  background: var(--card2);
  color: var(--text-sub);
  font-size: 0.85rem;
}

/* Responsive ad sizing */
@media (max-width: 900px) {
  .ad-unit--medium-rectangle {
    width: 100%;
    max-width: 728px;
    height: auto;
    aspect-ratio: 300 / 250;
    margin: 1.5rem auto;
    float: none;
  }
}

@media (max-width: 640px) {
  .ad-unit--leaderboard,
  .ad-unit--medium-rectangle {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    margin: 1rem auto;
  }
}

/* ── Light mode ad styling ────────────────────── */
html.theme-light .ad-unit {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* ── Consent Banner ────────────────────────────── */
.consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px var(--shadow);
  padding: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.consent-banner.hidden {
  display: none;
}

.consent-banner p {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.95rem;
  line-height: 1.5;
}

.consent-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.consent-actions button {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  font-family: inherit;
}

.consent-actions button:hover {
  background: var(--glass);
  border-color: var(--accent);
}

.consent-actions button.accept {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.consent-actions button.accept:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
}

/* ── Light mode consent banner ─────────────────── */
html.theme-light .consent-banner {
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Footer padding adjustment ─────────────────── */
body {
  padding-bottom: 0;
}

body.has-consent-banner {
  padding-bottom: 160px;
}

@media (max-width: 640px) {
  body.has-consent-banner {
    padding-bottom: 180px;
  }
}

/* ── Light mode specific overrides ─────────────── */

html.theme-light .site-header {
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.08);
}

html.theme-light .card,
html.theme-light .work-card,
html.theme-light .testimonial,
html.theme-light .info-card {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

html.theme-light .nav a:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}

html.theme-light .hero::before {
  filter: blur(6px) brightness(0.65);
}

html.theme-light .work-card .overlay {
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}

/* ── Transitions ───────────────────────────────── */
body,
.site-header,
.card,
.work-card,
.testimonial,
.info-card,
.nav,
.icon-btn {
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.footer-seo-links {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.footer-seo-links a {
  color: var(--primary-color);
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer-seo-links a:hover {
  text-decoration: underline;
}