.container {
  width: min(1240px, 90%);
}

.section {
  padding: 112px 0;
}

.section-header {
  margin-bottom: 65px;
}

.section-label {
  font-size: .72rem;
  letter-spacing: .17em;
}

.section-header h2,
.ms-intro-copy h2,
.ms-approach-copy h2,
.ms-cta h2,
.ms-contact h2 {
  font-weight: 850;
  letter-spacing: -.05em;
  line-height: 1.1;
}

.btn {
  border-radius: 7px;
  font-size: .88rem;
}

.ms-hero {
  position: relative;
  min-height: 480px;
  padding: 100px 0 90px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #0b2a35 url("pictures/middle-school.jpg") center / cover no-repeat;
  color: #fff;
}

.ms-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(7, 34, 43, .94) 0%,
    rgba(7, 34, 43, .8) 48%,
    rgba(7, 34, 43, .3) 100%
  );
}

.ms-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -220px;
  bottom: -280px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
}

.ms-hero-content {
  position: relative;
  z-index: 2;
}

.ms-hero-text {
  max-width: 760px;
}

.ms-badge {
  display: inline-block;
  margin-bottom: 22px;
  padding: 7px 12px;
  border-left: 3px solid var(--secondary);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ms-hero h1 {
  margin-bottom: 20px;
  color: #fff;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -.055em;
}

.ms-hero h1 span {
  display: block;
  color: var(--secondary);
}

.ms-hero-text > p {
  max-width: 560px;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, .84);
  font-size: 1rem;
  line-height: 1.8;
}

.ms-hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ms-hero .btn-primary {
  background: var(--secondary);
  color: #18323d;
}

.ms-hero .btn-primary:hover {
  background: #ffd078;
  box-shadow: 0 12px 24px rgba(242, 184, 75, .25);
}

.ms-hero .btn-secondary {
  border-color: rgba(255, 255, 255, .4);
  background: transparent;
  color: #fff;
}

.ms-hero .btn-secondary:hover {
  background: #fff;
  color: var(--primary-dark);
}

.ms-scroll {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, .7);
  font-size: .7rem;
  transform: translateX(-50%);
}

.ms-scroll span:last-child {
  font-size: 1.2rem;
  animation: msBounce 1.5s infinite;
}

@media (max-width: 900px) {
  .ms-hero {
    min-height: 440px;
    padding: 90px 0 75px;
  }

  .ms-scroll {
    display: none;
  }
}

@media (max-width: 560px) {
  .ms-hero {
    min-height: 500px;
    padding: 85px 0 65px;
  }

  .ms-hero-overlay {
    background: linear-gradient(180deg, rgba(5, 35, 43, .82), rgba(5, 35, 43, .95));
  }

  .ms-hero h1 {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    letter-spacing: -.05em;
  }

  .ms-hero-text > p {
    font-size: .94rem;
  }

  .ms-hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .ms-hero-buttons .btn {
    width: 100%;
  }
}

html[dir="rtl"] .ms-hero-text {
  text-align: right;
}

html[dir="rtl"] .ms-badge {
  border-left: 0;
  border-right: 3px solid var(--secondary);
}

@media (prefers-reduced-motion: reduce) {
  .ms-scroll span:last-child {
    animation: none;
  }
}
.ms-highlights {
  position: relative;
  z-index: 3;
  margin-top: -65px;
  padding-bottom: 40px;
}

.ms-highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.ms-highlight {
  padding: 34px 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.ms-highlight:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.ms-highlight-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 1.5rem;
}

.ms-highlight h3 {
  margin-bottom: 10px;
  color: var(--dark);
  font-size: 1.15rem;
  letter-spacing: -.02em;
}

.ms-highlight p {
  font-size: .92rem;
  line-height: 1.8;
}

/* ---------- INTRODUCTION ---------- */

.ms-introduction {
  background: var(--white);
}

.ms-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 7vw, 100px);
  align-items: center;
}

.ms-intro-visual {
  position: relative;
}

.ms-intro-visual > img {
  width: 100%;
  height: 560px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow-hover);
}

.ms-image-label {
  position: absolute;
  left: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.ms-image-label > span {
  font-size: 2rem;
}

.ms-image-label strong {
  display: block;
  color: var(--dark);
  line-height: 1.3;
}

.ms-image-label small {
  color: var(--text);
  font-size: .8rem;
}

.ms-intro-copy h2 {
  margin-bottom: 24px;
  color: var(--dark);
  font-size: clamp(2rem, 3.6vw, 3.1rem);
}

.ms-intro-copy > p {
  margin-bottom: 18px;
  font-size: .98rem;
  line-height: 1.9;
}

.ms-benefits {
  margin: 32px 0 36px;
  display: grid;
  gap: 18px;
}

.ms-benefit {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.ms-benefit > span {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
}

.ms-benefit strong {
  display: block;
  color: var(--dark);
}

.ms-benefit p {
  font-size: .88rem;
}

/* ---------- SUBJECTS ---------- */

.ms-subjects {
  background: var(--surface-alt);
}

.ms-subjects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.ms-subject-card {
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  transition: var(--transition);
}

.ms-subject-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.ms-subject-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff3d1;
  font-size: 1.6rem;
}

.ms-subject-card:nth-child(even) .ms-subject-icon {
  background: #e4f2f6;
}

.ms-subject-card:nth-child(3n) .ms-subject-icon {
  background: #ffe5e5;
}

.ms-subject-card h3 {
  margin-bottom: 12px;
  color: var(--dark);
  font-size: 1.25rem;
  letter-spacing: -.03em;
}

.ms-subject-card p {
  font-size: .92rem;
  line-height: 1.85;
}

/* ---------- SKILLS ---------- */

.ms-skills {
  background: var(--white);
}

.ms-skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.ms-skill-card {
  padding: 32px 26px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--white);
  transition: var(--transition);
}

.ms-skill-card:nth-child(2) {
  border-top-color: var(--secondary);
}

.ms-skill-card:nth-child(3) {
  border-top-color: var(--accent);
}

.ms-skill-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}

.ms-skill-card > span {
  display: block;
  margin-bottom: 18px;
  font-size: 2.4rem;
  line-height: 1;
}

.ms-skill-card h3 {
  margin-bottom: 10px;
  color: var(--dark);
  font-size: 1.1rem;
}

.ms-skill-card p {
  font-size: .9rem;
  line-height: 1.8;
}

/* ---------- APPROACH ---------- */

.ms-approach {
  background: var(--surface-alt);
}

.ms-approach-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(40px, 7vw, 90px);
  align-items: center;
}

.ms-approach-copy h2 {
  margin-bottom: 22px;
  color: var(--dark);
  font-size: clamp(2rem, 3.6vw, 3.1rem);
}

.ms-approach-copy > p {
  margin-bottom: 30px;
  line-height: 1.9;
}

.ms-approach-list {
  display: grid;
  gap: 14px;
}

.ms-approach-item {
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  transition: var(--transition);
}

.ms-approach-item:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow);
}

.ms-approach-item > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 1.4rem;
}

.ms-approach-item h3 {
  margin-bottom: 4px;
  color: var(--dark);
  font-size: 1.02rem;
}

.ms-approach-item p {
  font-size: .87rem;
  line-height: 1.7;
}

.ms-approach-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow-hover);
}

.ms-approach-visual > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ms-approach-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 90px 30px 30px;
  background: linear-gradient(to top, rgba(7, 34, 43, .92), transparent);
  color: #fff;
}

.ms-approach-caption > span {
  display: block;
  margin-bottom: 6px;
  font-size: 1.8rem;
}

.ms-approach-caption h3 {
  margin-bottom: 6px;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: -.03em;
}

.ms-approach-caption p {
  max-width: 380px;
  color: rgba(255, 255, 255, .82);
  font-size: .92rem;
}

/* ---------- GALLERY (infinite marquee) ---------- */

.ms-gallery {
  overflow: hidden;
  background: var(--white);
}

.ms-gallery .section-header {
  margin-bottom: 45px;
}

.ms-gallery .section-header h2 {
  margin-bottom: 0;
}

.ms-gallery-window {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ms-gallery-track {
  --gap: 20px;
  width: max-content;
  display: flex;
  gap: var(--gap);
  animation: msScroll 45s linear infinite;
}

.ms-gallery-window:hover .ms-gallery-track {
  animation-play-state: paused;
}

.ms-gallery-card {
  width: 370px;
  height: 265px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-alt);
}

.ms-gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- FUTURE ---------- */

.ms-future {
  background: var(--surface-alt);
}

/* ---------- CALL TO ACTION ---------- */

.ms-cta {
  position: relative;
  overflow: hidden;
  padding: 105px 0;
  background:
    radial-gradient(circle at 90% 15%, rgba(242, 184, 75, .14), transparent 32%),
    linear-gradient(130deg, var(--primary-dark), var(--primary));
  color: #fff;
}

.ms-cta::before {
  content: "";
  position: absolute;
  width: 450px;
  height: 450px;
  right: -150px;
  top: -250px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}

.ms-cta-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: auto;
  text-align: center;
}

.ms-cta .section-label {
  color: var(--secondary);
}

.ms-cta h2 {
  margin-bottom: 20px;
  color: #fff;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
}

.ms-cta p {
  max-width: 640px;
  margin: 0 auto 32px;
  color: rgba(255, 255, 255, .82);
  line-height: 1.9;
}

.ms-cta .btn-primary {
  background: var(--secondary);
  color: #18323d;
}

.ms-cta .btn-primary:hover {
  background: #ffd078;
  box-shadow: 0 12px 25px rgba(242, 184, 75, .3);
}

/* ---------- CONTACT STRIP ---------- */

.ms-contact {
  padding: 90px 0;
  background: var(--white);
}

.ms-contact-box {
  padding: 50px 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}

.ms-contact-box h2 {
  margin-bottom: 10px;
  color: var(--dark);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.ms-contact-box p {
  max-width: 540px;
}

.ms-contact-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- INTERACTIONS ---------- */

::selection {
  background: var(--secondary);
  color: #18323d;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--secondary);
  outline-offset: 4px;
}

/* ---------- DARK MODE ---------- */

body.dark-mode .ms-highlight-icon,
body.dark-mode .ms-approach-item > span {
  background: #214653;
}

body.dark-mode .ms-subject-icon,
body.dark-mode .ms-subject-card:nth-child(even) .ms-subject-icon,
body.dark-mode .ms-subject-card:nth-child(3n) .ms-subject-icon {
  background: #214653;
}

body.dark-mode .ms-contact-box {
  background: var(--surface-alt);
}

body.dark-mode .ms-image-label {
  background: rgba(23, 40, 48, .92);
}

/* ---------- RTL (Arabic) ---------- */

html[dir="rtl"] .ms-hero-text,
html[dir="rtl"] .ms-intro-copy,
html[dir="rtl"] .ms-approach-copy {
  text-align: right;
}

html[dir="rtl"] .ms-badge {
  border-left: 0;
  border-right: 3px solid var(--secondary);
}

html[dir="rtl"] .ms-image-label {
  left: auto;
  right: 24px;
}

html[dir="rtl"] .ms-approach-item:hover {
  transform: translateX(-6px);
}

html[dir="rtl"] .ms-gallery-track {
  direction: ltr;
}

/* ---------- ANIMATIONS ---------- */

@keyframes msBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* Track holds each card twice, so -50% is a seamless loop
   (the extra half-gap compensates for the flex gap). */
@keyframes msScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - (var(--gap) / 2))); }
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
  .ms-skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ms-subjects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .section {
    padding: 80px 0;
  }

  .section-header {
    margin-bottom: 45px;
  }

  /* keep dark-mode toggle reachable on tablets/phones */
  .theme-toggle {
    display: grid;
  }

  .ms-hero {
    min-height: 680px;
    padding: 125px 0 90px;
  }

  .ms-scroll {
    display: none;
  }

  .ms-highlights {
    margin-top: -45px;
  }

  .ms-intro-grid,
  .ms-approach-grid {
    grid-template-columns: 1fr;
  }

  .ms-intro-visual > img {
    height: 420px;
  }

  .ms-approach-visual {
    min-height: 420px;
  }

  .ms-contact-box {
    flex-direction: column;
    align-items: flex-start;
    padding: 40px 32px;
  }
}

@media (max-width: 760px) {
  .ms-highlights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .section {
    padding: 68px 0;
  }

  .ms-hero {
    min-height: 620px;
    padding: 110px 0 80px;
  }

  .ms-hero-overlay {
    background: linear-gradient(180deg, rgba(5, 35, 43, .8), rgba(5, 35, 43, .93));
  }

  .ms-hero h1 {
    font-size: clamp(2.7rem, 12vw, 3.8rem);
    letter-spacing: -.05em;
  }

  .ms-hero-text > p {
    font-size: .96rem;
  }

  .ms-hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .ms-hero-buttons .btn,
  .ms-contact-actions .btn {
    width: 100%;
  }

  .ms-contact-actions {
    width: 100%;
  }

  .ms-subjects-grid,
  .ms-skills-grid {
    grid-template-columns: 1fr;
  }

  .ms-subject-card {
    padding: 28px 24px;
  }

  .ms-intro-visual > img {
    height: 320px;
  }

  .ms-image-label {
    left: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
    padding: 12px 14px;
  }

  .ms-approach-visual {
    min-height: 360px;
  }

  .ms-gallery-card {
    width: 280px;
    height: 205px;
  }

  .ms-gallery-track {
    animation-duration: 32s;
  }

  .ms-cta {
    padding: 75px 0;
  }

  .ms-contact {
    padding: 65px 0;
  }

  .ms-contact-box {
    padding: 32px 24px;
  }
}

/* ---------- ACCESSIBILITY ---------- */

@media (prefers-reduced-motion: reduce) {
  .ms-gallery-track {
    animation: none;
  }

  .ms-gallery-window {
    overflow-x: auto;
  }

  .ms-scroll span:last-child {
    animation: none;
  }
}