/* ====== Theme Variables (global) ====== */
:root {
  --color-text-primary: #fff;
  --color-text-muted: #bdbdbd;
  --color-bg-primary: #000;
  --color-bg-body: #0b0b0b;
  --color-bg-card: #0f0f10;
  --color-accent-nav: #e2c595;
  --color-accent-card: #e2c595;
  --color-glass-card: rgba(255,255,255,0.03);
  --color-border-subtle: rgba(255, 255, 255, 0.1);
  --color-hamburger-line: #fff;
  --max-width: 1200px;
  --gap: 28px;
  --radius: 14px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color-scheme: dark;
  scroll-behavior: smooth;
  --color-shadow: rgba(255, 255, 255, 0.15);
}

html.light-mode {
  --color-text-primary: #000;
  --color-text-muted: #333333;
  --color-bg-primary: #fff;
  --color-bg-body: #f0f0f0;
  --color-bg-card: #ffffff;
  --color-accent-card: #6c4422;
  --color-accent-nav: #e2c595;
  --color-glass-card: rgba(0,0,0,0.03);
  --color-border-subtle: rgba(0, 0, 0, 0.1);
  --color-hamburger-line: #000;
  color-scheme: light;
  --color-shadow: rgba(0, 0, 0, 0.15);
}

html.rtl-mode { direction: rtl; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  padding: 32px 16px;
  display: flex;
  justify-content: center;
}

/* Hidden SEO keywords */
.seo-keywords { display: none; }

#backgroundCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
}

.wrap { width: 100%; max-width: var(--max-width); }

/* Fixed Home Icon */
.home-icon {
  position: fixed;
  top: 27px;
  left: 16px;
  z-index: 102;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--color-hamburger-line);
  transition: color 0.3s ease;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-icon:hover { color: var(--color-accent-nav); }
.home-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (min-width: 880px) {
  .home-icon { width: 26px; height: 26px; top: 27px; }
  .home-icon svg { stroke-width: 2; }
}

/* Main content */
main { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: var(--gap); 
  position: relative; 
  z-index: 3;
  margin-top: 20px;
}

/* Cards grid & animations */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-top: 12px;
}

.card-link {
  background: var(--color-glass-card);
  box-shadow: 0 4px 20px var(--color-shadow);
  padding: 20px 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform .28s ease, box-shadow .28s ease;
  min-height: 140px;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(2px);
  width: 100%;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}
.card-link:hover, .card-link:active {
  transform: translateY(-6px);
  box-shadow: 0 8px 20px -5px color-mix(in srgb, var(--color-accent-card) 50%, transparent);
}
.card-link h3 {
  margin: 0;
  font-family: Merriweather, serif;
  color: var(--color-text-primary);
  font-size: 20px;
}
@media (min-width: 880px) {
  .card-link h3 { font-size: 28px; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom links */
.bottom-about, .bottom-link {
  margin-top: 40px;
  text-align: center;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}
.bottom-about a, .bottom-link a {
  color: var(--color-accent-nav);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.2s;
}
.bottom-about a:hover, .bottom-link a:hover { opacity: 0.7; }
html.light-mode .bottom-about a,
html.light-mode .bottom-link a { color: #8b5e3c; }

/* Footer */
footer {
  margin-top: 26px;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: 1.5s;
}

/* ====== Hamburger Menu ====== */
.hamburger {
  background: none; border: none; outline: none;
  cursor: pointer; z-index: 102;
  padding: 0; line-height: 1;
  width: 18px; height: 16px;
  display: flex; flex-direction: column; justify-content: space-around;
  transition: all 0.3s ease;
  position: fixed;
  top: 28px;
  right: 16px;
}
.hamburger span {
  display: block; width: 100%; height: 2px;
  background: var(--color-hamburger-line);
  border-radius: 1px;
  transition: all 0.3s ease;
  margin: 2px 0;
}
.hamburger:hover span { background: var(--color-accent-nav); }
.hamburger.active span { background: var(--color-accent-nav); }

#menu {
  position: fixed; top: 0; right: -200px;
  width: 200px; height: 100%;
  background-color: color-mix(in srgb, var(--color-bg-primary) 70%, transparent);
  z-index: 100;
  transition: right 0.3s ease-in-out;
  padding: 6rem 1.5rem 2rem 1.5rem;
  backdrop-filter: blur(5px);
  overflow-y: auto;
  display: flex; flex-direction: column; justify-content: space-between;
}
#menu.active { right: 0; box-shadow: -6px 0 20px rgba(0, 0, 0, 0.7); }
.menu-list { list-style: none; padding: 0; margin-top: 0; }
.menu-list > li > a {
  display: block; padding: 0.8rem 0;
  color: var(--color-text-primary);
  text-decoration: none; font-size: 0.9rem; font-weight: 400;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: color 0.2s;
  border-top: 1px solid var(--color-border-subtle);
}
#main-menu-list > li:first-child > a { border-top: none; }
.menu-list a:hover { color: var(--color-accent-nav); }

.accordion-submenu {
  list-style: none; padding: 0; margin: 0;
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}
.contact-accordion-item.expanded .accordion-submenu,
.language-accordion-item.expanded .accordion-submenu { max-height: 800px; }
.accordion-submenu a {
  display: flex; justify-content: center; align-items: center;
  margin: 0 18px; padding: 0.7rem 0;
  font-size: 0.85rem; color: var(--color-text-muted); font-weight: 300;
  text-decoration: none;
  border-top: 1px solid var(--color-border-subtle);
}
.accordion-submenu a:hover { color: var(--color-accent-nav); }
.contact-accordion-item .accordion-submenu li:first-child a,
.language-accordion-item .accordion-submenu li:first-child a { border-top: none; }

.theme-toggle-container {
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border-subtle);
  margin-top: 0;
}
#theme-toggle {
  display: flex; align-items: center; width: 100%;
  padding: 0.8rem 0; background: none; border: none;
  cursor: pointer; color: var(--color-text-primary);
  font-size: 0.9rem; font-weight: 400;
  transition: color 0.2s;
}
#theme-toggle:hover { color: var(--color-accent-nav); }
.theme-icon-wrapper {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
}
.theme-icon {
  position: absolute;
  top: 0; left: 0;
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  transition: opacity 0.2s ease;
}
#sun-icon { opacity: 1; }
#moon-icon { opacity: 0; }
#theme-text { margin-left: 8px; }
html.rtl-mode #theme-text { margin-left: 0; margin-right: 8px; }

/* ====== Page-specific headers (included for all, won't interfere) ====== */
/* Photography header */
.photography-header,
.design-header,
.project-container,
.about-container {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  backdrop-filter: blur(2px);
  padding: 30px;
  border-radius: 18px;
  text-align: center;
  margin-bottom: 0;
}
.photography-header p,
.design-header p,
.project-container p {
  text-align: center !important;
  color: var(--color-text-muted);
  max-width: 800px;
  line-height: 1.6;
  font-size: 1rem;
  margin-left: auto;
  margin-right: auto;
}
.photography-header h2,
.design-header h2,
.project-container h2 {
  color: var(--color-accent-nav);
  font-family: Merriweather, serif;
  font-size: 3em;
  margin-bottom: 20px;
}
@media (min-width: 880px) {
  .photography-header p,
  .design-header p,
  .project-container p { font-size: 1.5rem; }
}

/* Cinema film grid */
.film-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px 18px;
  margin-top: 40px;
  direction: ltr;
}
.film-entry {
  background: var(--color-bg-card);
  padding: 30px;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.28s ease;
  text-align: left;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}
html.rtl-mode .film-entry { text-align: right; }
.film-entry:hover {
  box-shadow: 0 8px 20px -5px color-mix(in srgb, var(--color-accent-card) 50%, transparent);
  transform: none;
}
.film-entry a { text-decoration: none; color: inherit; display: block; width: 100%; }
.film-entry h3 {
  color: var(--color-text-primary);
  font-family: Merriweather, serif;
  font-size: 1.5em;
  margin: 0 0 10px 0;
  text-align: center;
}
.film-entry p { color: var(--color-text-muted); font-size: 14px; margin-bottom: 15px; text-align: center; }
.film-poster {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 1px solid var(--color-border-subtle);
  display: block;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 880px) {
  .film-grid { grid-template-columns: 1fr 1fr; }
}

/* Index page site header */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 60px;
}
.main-logo {
  width: 150px;
  height: 150px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.3s;
}
.logo-protect {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: transparent;
  z-index: 2;
  pointer-events: auto;
}
.main-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.site-title {
  font-family: 'Merriweather', serif;
  font-weight: 700;
  font-size: 32px;
  margin: 0;
  text-decoration: none;
  color: var(--color-text-primary);
  transition: color 0.2s;
  cursor: pointer;
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
  animation-delay: 0.5s;
}
.site-title:hover { color: var(--color-accent-nav); }
@media (min-width: 880px) {
  .main-logo { width: 300px; height: 300px; }
  .site-title { font-size: 48px; }
}

/* About page */
.about-container .main-logo { margin: 0 auto 30px auto; }
.bio-text {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  color: var(--color-text-muted);
  line-height: 1.6;
  font-size: 1rem;
}
.bio-text p { margin-bottom: 1.2em; }
@media (min-width: 880px) { .bio-text { font-size: 1.5rem; } }
.bio-divider {
  width: 100px;
  height: 1px;
  background: var(--color-text-primary);
  opacity: 0.2;
  margin: 40px auto 50px auto;
  transition: width 0.2s ease;
}
@media (min-width: 880px) { .bio-divider { width: 200px; } }
/* ====== Gallery Layout (Column-based, for all galleries) ====== */
.photo-gallery {
  column-count: 1;
  column-gap: 20px;
  margin-top: 10px;
}
@media (min-width: 640px) {
  .photo-gallery {
    column-count: 2;
  }
}
@media (min-width: 880px) {
  .photo-gallery {
    column-count: 3;
  }
}

/* ----- آیتم‌های داخل گالری ----- */
.photo-item {
  break-inside: avoid;   /* جلوگیری از شکستن آیتم در میان دو ستون */
  margin-bottom: 20px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-bg-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.photo-item:hover { 
  transform: scale(1.02); 
  box-shadow: 0 4px 12px var(--color-shadow); 
}
.photo-item img { 
  width: 100%; 
  height: auto; 
  display: block; 
}

/* ----- حذف کامل تمام قوانین اضافی برای عکس‌های افقی ----- */
.photo-item.landscape,
.photo-item.landscape.left,
.photo-item.landscape.right {
  /* هیچ ویژگی خاصی – درست مثل بقیه آیتم‌ها */
  flex: none;
  max-width: none;
  margin: 0 0 20px 0;   /* فقط margin پایین مثل بقیه */
  column-span: none;
}

/* Delay classes for cards (can appear in various pages) */
#card-portraits { animation-delay: 0.7s; }
#card-products { animation-delay: 0.8s; }
#card-landscape { animation-delay: 0.9s; }
#card-minimalism { animation-delay: 1.0s; }
#card-bw { animation-delay: 1.1s; }
#card-conceptual { animation-delay: 1.2s; }
#card-business { animation-delay: 0.7s; }
#card-logo { animation-delay: 0.8s; }
#card-logomotion { animation-delay: 0.9s; }
#card-other { animation-delay: 1.0s; }
#card-photography { animation-delay: 0.7s; }
#card-cinema { animation-delay: 0.9s; }
#card-design { animation-delay: 1.1s; }

/* Film entry delays */
#film1 { animation-delay: 0.7s; }
#film2 { animation-delay: 0.9s; }
@media (min-width: 880px) {
  #film1, #film2 { animation-delay: 0.7s; }
}

/* ====== Watermark overlay for protected images ====== */
.protected-image {
  position: relative;
  display: inline-block;
}
.protected-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/logo/Whitelogo.png'); /* تصویر واترمارک شفاف */
  background-repeat: repeat;
  opacity: 0.15; /* آنقدر کم که در دیدن عکس مزاحم نباشد */
  pointer-events: none; /* کلیک‌ها را به عکس زیرین منتقل کند */
}

/* ====== Photo caption (description box under each image) ====== */
.photo-caption {
  padding: 8px 10px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  background: var(--color-glass-card);
  border-top: 1px solid var(--color-border-subtle);
}

/* ====== Gallery navigation (Next page link) ====== */
.gallery-navigation {
  margin-top: 40px;
  text-align: center;
}
.gallery-navigation a {
  color: var(--color-accent-nav);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.2s;
}
.gallery-navigation a:hover {
  opacity: 0.7;
}
html.light-mode .gallery-navigation a {
  color: #8b5e3c;
}

/* ====== Landscape images in gallery ====== */
.photo-item.landscape {
  column-span: all;
  max-width: 66.66%; /* حدود دو ستون از سه ستون */
  margin-left: auto;
  margin-right: auto;
}