/* ============================================================
   COMMON — shared across all pages.
   Font, reset, fixed header (with hamburger), footer, utility classes.
   Must load before components.css and any page-specific CSS.
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.1.0/dist/font-face.css');
@import 'tokens.css';

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

/* [hidden] must always hide — beats any class-level display rule */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  font-family: 'Vazir', sans-serif;
  direction: rtl;
  background-color: var(--bg);
  color: var(--text);
  /* offset for fixed header */
  padding-top: var(--header-h);
}

h1,
h2,
h3,
h4 {
  font-family: 'Vazir', sans-serif;
}

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

a {
  transition: color var(--transition);
}

/* ================================================================
   HEADER — dark navy with amber accent
   ================================================================ */
header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  background-color: #fff;
  border-bottom: 1px solid var(--navy-100);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-7);
  padding: 0 40px;
  height: var(--header-h);
  width: 100%;
  box-shadow: 0 1px 8px rgba(15, 34, 56, .06);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo img {
  width: 42px;
  height: auto;
}

.logo a {
  text-decoration: none;
  font-family: 'Vazir', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--navy-800);
  letter-spacing: .3px;
}

/* Nav */
nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0;
  direction: rtl;
}

nav ul li a,
nav ul a {
  position: relative;
  color: var(--navy-700);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: bold;
  padding: 4px 0;
  transition: color var(--transition);
}

nav ul li a::after,
nav ul a::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: var(--amber-500);
  transition: width var(--transition);
}

nav ul li a:hover,
nav ul a:hover {
  color: var(--amber-600);
}

nav ul li a:hover::after,
nav ul a:hover::after {
  width: 100%;
}

/* Back-link on inner pages — arrow comes from CSS (no Font Awesome dep);
   always appears to the right of the text in RTL flex */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--navy-700);
  text-decoration: none;
  font-weight: bold;
  font-size: .95rem;
  transition: color var(--transition);
}

.back-link::before {
  content: "→";
  font-size: 1.05em;
  line-height: 1;
}

.back-link:hover {
  color: var(--amber-600);
}

/* ---- Hamburger button ---- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1010;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background-color: var(--navy-800);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Transforms to × when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ================================================================
   FOOTER
   ================================================================ */
footer,
.footer-section {
  background-color: var(--navy-900);
  color: var(--on-dark);
  padding: 44px 20px 28px;
  margin-top: var(--sp-7);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-column {
  flex: 1;
}

.footer-column h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: var(--amber-400);
}

.footer-column p,
.footer-column li {
  font-size: .9rem;
  line-height: 1.9;
  color: var(--navy-100);
}

.footer-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-column a {
  color: var(--navy-100);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-column a:hover {
  color: var(--amber-400);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding-top: 18px;
  font-size: .8rem;
  border-top: 1px solid rgba(255, 255, 255, .15);
  color: var(--navy-100);
}

.footer-bottom p {
  margin: 0;
}

/* Dev credit — left side of footer bar (copyright stays right) */
.footer-credit {
  direction: ltr;

  letter-spacing: .4px;
}

.footer-credit .heart {
  display: inline-block;
  color: #ff5c7a;
  animation: heart-beat 1.6s ease-in-out infinite;
}

.footer-credit .country {
  display: inline-block;
  font-size: 18px;
  position: relative;
  top: 2px;
}

@keyframes heart-beat {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }
}

/* ================================================================
   UTILITIES
   ================================================================ */
.section-title {
  font-family: 'Vazir', sans-serif;
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-5);
  color: var(--navy-800);
  position: relative;
  display: inline-block;
  padding-bottom: var(--sp-2);
}

.section-title::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--amber-500);
}

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

/* ---- Tablet (≤ 768px) ---- */
@media (max-width: 768px) {
  header {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    align-items: center;
    justify-content: space-between;
    gap: 0;
    row-gap: 0;
  }

  /* Show hamburger */
  .nav-toggle {
    display: flex;
  }

  /* Collapsed by default; .nav-open reveals it */
  nav {
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition), padding var(--transition);
    order: 3;
  }

  nav.nav-open {
    max-height: 400px;
    padding-bottom: 12px;
  }

  nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 4px;
  }

  .footer-container {
    flex-wrap: wrap;
    gap: 24px;
  }
}

/* ---- Mobile (≤ 480px) ---- */
@media (max-width: 480px) {
  .logo a {
    font-size: 1.1rem;
  }

  .footer-column h3 {
    font-size: .95rem;
  }

  .footer-column p,
  .footer-column li,
  .footer-column a {
    font-size: .78rem;
    line-height: 1.7;
  }

  .footer-bottom {
    font-size: .72rem;
    justify-content: center;
    text-align: center;
  }
}