/* Reset and base font size */
html {
  font-size: 16px;
}

@media (min-width: 1024px) {
  html {
    font-size: 18px; /* larger font on bigger screens */
  }
}

/* Body styling with RTL support */
body {
  font-family: "Noto Sans Arabic", sans-serif;
  background-color: hsl(192, 15%, 94%); /* Same main background as English */
  color: hsl(210, 29%, 24%); /* Same default text color */
  direction: rtl; /* Right-to-left text direction */
  text-align: right; /* Default right alignment for Arabic */
  margin: 0;
  padding: 0; /* CHANGED from 20px */
  line-height: 1.6;
}

/* Header styling - Updated to match English page */
.main-header {
  text-align: center;
  background: hsl(208, 32%, 85%);
  padding: 2.5rem 2rem 2rem;
  margin: 0;
  padding-top: 2.5rem; /* No fixed nav, so no extra padding needed */
  margin-bottom: 3rem;
  border-bottom: 2px solid hsl(208, 32%, 76%);
  box-shadow: 0 4px 12px hsla(0, 0%, 0%, 0.08);
  position: relative; /* For absolute positioning of button */
}

.main-header {
  opacity: 0;
  animation: fadeInHeader 0.35s ease-in forwards;
}

@keyframes fadeInHeader {
  to {
    opacity: 1;
  }
}

.main-header h1 {
  font-family: "Noto Sans Arabic", sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: hsl(210, 29%, 20%); /* Match English header title */
  text-shadow: 0 1px 2px hsla(0, 0%, 100%, 0.5);
  letter-spacing: -0.5px;
}

.main-header h2 {
  font-family: "Noto Sans Arabic", sans-serif;
  font-size: 1.25rem; /* Match English subtitle */
  font-weight: 400;
  color: hsl(210, 20%, 35%); /* Match English subtitle */
  margin: 0.75rem 0 0 0;
  font-style: italic;
}

/* HR styling - no need for negative margins anymore */
hr {
  margin-left: 0;
  margin-right: 0;
  height: 1px;
  border: none;
  background-color: hsl(209, 16%, 42%);
  padding: 0;
}

/* General heading fonts - Bold Noto Sans Arabic for distinction */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Noto Sans Arabic", sans-serif;
  font-weight: 700;
}

/* Paragraph styling - Regular weight for body text */
p {
  font-family: "Noto Sans Arabic", sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

/* Section styling - add padding like English page */
section {
  margin: 1rem 0;
  padding-left: 20px;
  padding-right: 20px;
}

/* Footer styling - Updated to match English page */
footer {
  background: hsl(208, 32%, 85%);
  border-top: 2px solid hsl(208, 32%, 76%);
  margin-top: 4rem;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
}

footer p {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

footer p:first-of-type,
footer p:nth-of-type(2) {
  font-size: 0.9rem;
  color: hsl(210, 20%, 35%);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  text-align: right; /* Keep right-aligned for Arabic */
}

footer p:first-of-type b,
footer p:nth-of-type(2) b {
  color: hsl(210, 29%, 24%);
  font-weight: 600;
}

footer p:nth-of-type(3) {
  font-size: 0.95rem;
  color: hsl(210, 29%, 24%);
  font-weight: 500;
  margin: 2rem 0 0.5rem 0;
}

footer p:last-of-type {
  font-size: 0.85rem;
  color: hsl(210, 20%, 40%);
  font-style: italic;
  margin: 0;
}

footer p:nth-of-type(3),
footer p:last-of-type {
  text-align: center !important;
  margin-left: auto;
  margin-right: auto;
}

/* Section with image and text side by side */
.section-with-image {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin: 2rem 20px; /* CHANGED - Add same horizontal margin as other sections */
  background-color: hsl(200, 30%, 97%);
  border: 1px solid hsl(200, 25%, 88%);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .section-with-image {
    flex-direction: column;
    margin: 1.5rem 10px; /* CHANGED - Match mobile section margins */
  }

  .section-images {
    max-width: 100%;
    margin: 1rem 0 0 0;
    flex-direction: row;
    justify-content: center;
  }

  .single-figure {
    flex: 1;
    max-width: 200px;
  }

  .single-figure img {
    height: 150px;
  }
}

.section-content {
  flex: 1.5; /* Text space */
  min-width: 0;
}

.section-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.section-content p {
  margin: 0;
}

/* Section with multiple images side by side */
.section-images {
  display: flex;
  flex-direction: row; /* Images side by side */
  gap: 0.5rem;
  flex: 1.2;
  max-width: 400px;
  margin: 0 0 0 4rem; /* Push images to the right */
}

.single-figure {
  margin: 0;
  text-align: center;
  flex: 1; /* Each image takes equal space */
}

.single-figure img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background-color: hsl(0, 0%, 98%);
}

.single-figure figcaption {
  font-size: 0.75em;
  color: hsl(0, 0%, 33%);
  margin-top: 0.4rem;
  text-align: center;
  font-weight: 550;
  line-height: 1.2;
}

.single-figure figcaption small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9em;
  color: hsl(0, 0%, 50%);
}

.single-figure figcaption a {
  color: hsl(210, 100%, 40%);
  text-decoration: none;
}

.single-figure figcaption a:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .section-with-image {
    flex-direction: column;
  }

  .section-images {
    max-width: 100%;
    margin: 1rem 0 0 0;
    flex-direction: row;
    justify-content: center;
  }

  .single-figure {
    flex: 1;
    max-width: 200px;
  }

  .single-figure img {
    height: 150px; /* Smaller on mobile */
  }

  .main-header {
    padding: 2rem 1.5rem 1.5rem;
    padding-top: 4rem; /* More space for back button */
    margin-bottom: 2rem;
  }

  .main-header h1 {
    font-size: 2rem;
  }

  .main-header h2 {
    font-size: 1.1rem;
  }

  footer {
    padding: 2rem 1.5rem 1.5rem;
    margin-top: 3rem;
  }

  footer p:first-of-type,
  footer p:nth-of-type(2) {
    font-size: 0.85rem;
  }

  footer p:nth-of-type(3) {
    font-size: 0.9rem;
  }

  footer p:last-of-type {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .main-header {
    padding-top: 3.5rem;
  }

  .main-header h1 {
    font-size: 1.75rem;
  }

  .main-header h2 {
    font-size: 1rem;
  }
}

/* Section block styling */
section {
  background-color: hsl(220, 20%, 98%);
  border: 1px solid hsl(220, 15%, 92%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 20px; /* Add horizontal margin for spacing */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Subtle shadow */
  transition: box-shadow 0.3s ease; /* Smooth hover effect */
}

/* Hover effect for sections */
section:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Section headings in blocks */
section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: hsl(210, 40%, 20%); /* Darker bluish text */
  border-bottom: 2px solid hsl(210, 50%, 85%); /* Light blue underline */
  padding-bottom: 0.5rem;
}

/* Paragraph spacing in blocks */
section p {
  margin-bottom: 1rem;
  color: hsl(210, 20%, 25%);
}

section p:last-child {
  margin-bottom: 0;
}

/* Special styling for image sections */
.section-with-image {
  background-color: hsl(200, 30%, 97%); /* Slightly different blue tint */
  border: 1px solid hsl(200, 25%, 88%);
}

/* Mobile responsive for blocks */
@media (max-width: 768px) {
  section {
    margin: 1.5rem 10px;
    padding: 1.5rem;
    border-radius: 8px;
  }
}

/* Back button styling */
.back-button {
  position: absolute;
  left: 1.5rem; /* Left side for RTL layout */
  top: 1.5rem;
  background-color: hsl(210, 50%, 85%);
  color: hsl(210, 40%, 20%);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-family: "Noto Sans Arabic", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid hsl(210, 40%, 75%);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
  animation: fadeInButton 0.35s ease-in 0.35s forwards;
}

@keyframes fadeInButton {
  to {
    opacity: 1;
  }
}

.back-button:hover {
  background-color: hsl(210, 60%, 80%);
  border-color: hsl(210, 50%, 65%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.back-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .back-button {
    display: none; /* Hide back button on mobile */
  }
}

/* --- Custom style for Alan Turing statue image --- */
#turing-statue {
  width: 100%; /* Keep consistent horizontal size */
  height: 270px; /* Make it taller than the default 200px */
  object-fit: cover; /* Prevent stretching while filling area */
  border-radius: 8px; /* Keep rounded corners */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12); /* Slightly stronger shadow */
}

@media (max-width: 768px) {
  #turing-statue {
    height: 220px; /* slightly smaller for mobile */
  }
}

.section-with-video {
  background-color: hsl(200, 30%, 97%);
  border: 1px solid hsl(200, 25%, 88%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  text-align: center;
}

/* Custom figure styling for video */
.video-figure {
  text-align: center;
  margin-top: 1.5rem;
}

/* Video responsive styling */
.video-figure video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile responsive for video */
@media (max-width: 768px) {
  .video-figure video {
    width: 100%;
    max-width: 100%;
  }

  .section-with-video {
    padding: 1.5rem 1rem;
    margin: 1.5rem 10px;
  }
}
