/* CSS Custom Properties */
:root {
  /* Colors */
  --color-background: #1a1a1a;
  --color-surface: rgba(26, 26, 26, 0.8);
  --color-surface-variant: rgba(0, 0, 0, 0.3);
  --color-surface-hover: rgba(201, 208, 246, 0.1);
  --color-accent: rgba(201, 208, 246, 0.15);
  --color-border: rgba(201, 208, 246, 0.2);
  
  /* Typography */
  --font-serif: Georgia,palatino,book antiqua,palatino linotype,serif;
  --font-sans: Georgia,palatino,book antiqua,palatino linotype,serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Layout */
  --container-max-width: 1000px;
  --content-max-width: 836px;
  --border-radius: 8px;
  --border-radius-sm: 5px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Shadows */
  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-strong: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0a0a0a;
    --color-surface: rgba(10, 10, 10, 0.9);
  }
}

/* Reset and base styles */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-serif);
  background-color: var(--color-background);
  background-image: url('/assets/images/background-1.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #C9D0F6;
  font-size: 16px;
  line-height: 1.2em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.homepage {
  background-image: url('/assets/images/background.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* Container and layout */
.container {
  max-width: var(--container-max-width);
  margin: 213.5px auto var(--space-lg) auto;
  padding: 0;
  background-color: transparent;
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
}

.main-content {
  flex: 1;
  padding: 0;
  background-color: transparent;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
  margin-top: -95px;
}

/* Screen reader only content */
.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;
}

/* Navigation */
nav {
  width: 150px;
  flex-shrink: 0;
  background-color: transparent;
  margin-top: 0;
  position: sticky;
  top: 0;
  height: fit-content;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nav-item {
  margin: 0;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.2em;
  transition: var(--transition-normal);
  display: flex;
  align-items: center;
  padding: 5px var(--space-md);
  border-radius: var(--border-radius-sm);
  position: relative;
  outline: 2px solid transparent;
  outline-offset: 2px;
  font-family: var(--font-serif);
  height: 72px;
  box-sizing: border-box;
}

.nav-link:hover {
  color: #e21c21;
  transform: translateX(var(--space-xs));
}

.nav-link--active {
  color: #e21c21;
  font-weight: 700;
}

.nav-link--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background-color: #C9D0F6;
  border-radius: 0 2px 2px 0;
}

.nav-text {
  font-size: 16px;
  line-height: 1.4em;
  font-weight: 500;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 15px;
  font-weight: normal;
  font-family: var(--font-serif);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
}

h3 {
  font-size: 1.4rem;
  margin-top: 30px;
  margin-bottom: 12px;
  text-decoration: underline;
}

p {
  margin-bottom: 15px;
  line-height: 1.2em;
  font-family: var(--font-serif);
  font-size: 16px;
}

a {
  color: inherit;
  transition: color 0.3s ease;
}

a.text-link {
  color: inherit;
  text-decoration: none;
}

a.text-link:hover {
  color: inherit;
  text-decoration: none;
}

/* Lists */
ul, ol {
  margin-left: 20px;
  margin-bottom: 15px;
  list-style: none;
}

li {
  margin-bottom: 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.2em;
}

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

.profile-image {
  max-width: 390px;
  height: auto;
  margin: 20px 0;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.hero-image, .content-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

.hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* Films Gallery */
.films-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding: 0;
}

.film-item {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
  border: none;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.film-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--color-accent) 0%, transparent 50%);
  opacity: 0;
  transition: var(--transition-normal);
  z-index: 1;
}

.film-item--has-page:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-strong);
  border-color: #C9D0F6;
  will-change: transform, box-shadow;
}

.film-item--has-page:hover::before {
  opacity: 1;
}

.film-item--has-page:focus-within {
  outline: 2px solid #C9D0F6;
  outline-offset: 2px;
  transform: translateY(-4px);
}

.film-item > * {
  position: relative;
  z-index: 2;
}

.film-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.film-link:hover {
  text-decoration: none;
}

.film-summary {
  margin-top: var(--space-sm);
}

.film-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: var(--transition-normal);
  box-shadow: var(--shadow-subtle);
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.film-item--has-page:hover .film-image {
  transform: scale(1.02) translateZ(0);
  box-shadow: var(--shadow-medium);
}

.film-type, .film-year {
  font-size: 16px;
  opacity: 0.8;
  margin: 5px 0;
  font-family: var(--font-serif);
  line-height: 1.2em;
}

.film-premiere, .film-awards, .film-recognition, .film-screenings {
  margin-top: 10px;
  font-size: 16px;
  font-family: var(--font-serif);
  line-height: 1.2em;
}

.film-awards ul, .film-recognition ul, .film-screenings ul {
  margin-left: 15px;
}

/* Page headers */
.page-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  border-bottom: 3px solid var(--color-border);
  padding-bottom: var(--space-xl);
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #C9D0F6;
  border-radius: 2px;
}

.page-title-en, .page-title-fa {
  display: inline;
  font-family: var(--font-serif);
}

.page-title-fa {
  margin-left: 15px;
  opacity: 0.9;
}

/* Farsi text styling */
.farsi-text, p:lang(fa) {
  direction: rtl;
  text-align: right;
  unicode-bidi: bidi-override;
}

/* Page-specific styles */
.home {
  text-align: center;
}

body.homepage .main-content {
  background-color: transparent !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}




.biography {
  margin: 0 auto;
}

.main-content:has(.biography) {
  padding: 0;
}

.biography-content section {
  margin-bottom: 35px;
}

.profile-figure {
  text-align: center;
  margin: 25px 0;
}

/* Film-specific styles */
.film-figure {
  margin: 0 0 15px 0;
}

.film-header {
  margin-bottom: 15px;
  text-align: center;
}

.film-header p {
  margin-bottom: 5px;
}

.film-details {
  margin-top: 15px;
}

.film-meta-heading {
  font-size: 16px;
  margin: 10px 0 5px 0;
  font-weight: bold;
  font-family: var(--font-serif);
  line-height: 1.2em;
}

.cv section {
  margin-bottom: 25px;
}

.film-hero-figure {
  margin: 0 0 var(--space-xl) 0;
  text-align: center;
}

.film-hero-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-medium);
}

.film-info {
  display: grid;
  gap: var(--space-lg);
}

.film-info h2 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: var(--space-xs);
}

.film-meta {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.film-navigation {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.back-link {
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 16px;
  transition: opacity 0.2s ease;
}

.back-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.contact {
  margin: 0 auto;
}

.social-links {
  list-style: none;
  margin-left: 0;
}

.social-links li {
  margin-bottom: 10px;
}

.press-list {
  list-style: none;
  margin-left: 0;
}

.press-item {
  margin-bottom: 15px;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 5px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .films-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

@media (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 80px 0 0 0;
    flex-direction: column;
    gap: var(--space-md);
  }
  
  nav {
    width: 100%;
    margin-top: 0;
    padding: var(--space-md);
    margin-left: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(26, 26, 26, 0.3);
    backdrop-filter: blur(5px);
  }
  
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs);
  }
  
  .nav-link {
    font-size: 16px;
    padding: var(--space-xs) var(--space-sm);
    height: auto;
  }
  
  .main-content {
    padding: 15px;
    border-radius: 5px;
  }
  
  .main-content:has(.biography) {
    max-width: 100%;
    padding: 15px;
  }
  
  .biography {
    max-width: 100%;
  }
  
  .profile-image {
    max-width: 100%;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .films-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  .film-item {
    padding: var(--space-xs);
  }
  
  nav a {
    font-size: 16px;
  }
  
  /* Mobile homepage navigation links should be black */
  body.homepage .nav-link {
    color: #000000;
  }
  
  /* Remove nav background and filter on homepage */
  body.homepage nav {
    background-color: transparent;
    backdrop-filter: none;
  }
  
  .hero-image {
    max-height: 250px;
  }
  
  .film-image {
    height: auto;
  }
}

@media (max-width: 480px) {
  .container {
    margin: 5px;
    padding: 80px 0 0 0;
  }
  
  nav {
    padding: var(--space-sm);
  }
  
  .main-content {
    padding: 10px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .film-item {
    padding: var(--space-xs);
  }
  
  .films-gallery {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .film-image {
    height: auto;
  }
  
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .container {
    background-color: rgba(0, 0, 0, 0.9);
  }
  
  .film-item {
    background-color: rgba(0, 0, 0, 0.8);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}