/* =========================================================
   Masjid Ur-Rahman case study (light, teal-blue)
   Builds on css/case-study.css. Teal, deep teal and pale blue
   are sampled from the project's own artwork and logo.
   ========================================================= */

.cs--mr {
  --mr-teal: #246b90;      /* logo + timeline circles */
  --mr-deep: #003448;      /* deep teal from the site screens */
  --mr-pale: #bdd3de;      /* pale blue from the artwork */
  --mr-panel: #eaf5f9;     /* light-blue process panels */
  --mr-grey: #f8f8f8;      /* alternate section background */
  --mr-text: #171717;
  --mr-muted: #555555;
  --cs-paper: #ffffff;
  --cs-ink: var(--mr-text);
  --cs-gold: var(--mr-teal);
  --cs-body: var(--font-sans);
}

.cs--mr main {
  background: #ffffff;
  color: var(--mr-text);
  font-family: var(--font-sans);
}

.mr-wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.mr-accent {
  color: var(--mr-teal);
}

/* ---------- Headings ---------- */
.mr-h {
  margin: 0;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  color: var(--mr-text);
}

/* ---------- Hero ---------- */
.mr-hero {
  padding-inline: clamp(0.75rem, 2vw, 1.25rem);
}

.mr-hero__card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  align-items: center;
  max-width: 1240px;
  min-height: clamp(320px, 34vw, 460px);
  margin-inline: auto;
  overflow: hidden;
  border-radius: 0 0 clamp(18px, 2.5vw, 28px) clamp(18px, 2.5vw, 28px);
  background: var(--mr-grey);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

/* teal circles tucked into the lower-left corner */
.mr-hero__shapes {
  position: absolute;
  left: clamp(-3rem, -3vw, -1rem);
  bottom: clamp(-5rem, -6vw, -2.5rem);
  width: clamp(130px, 17vw, 230px);
  height: auto;
  pointer-events: none;
}

.mr-hero__text {
  position: relative;
  z-index: 1;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 6vw, 5rem) clamp(5rem, 9vw, 7rem);
}

.mr-hero__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
  font-weight: 800;
  color: var(--mr-teal);
}

.mr-hero__brand img {
  width: clamp(44px, 4.5vw, 56px);
  height: auto;
}

.mr-hero__title {
  margin: clamp(1rem, 2.5vw, 1.5rem) 0 clamp(1rem, 2.5vw, 1.5rem);
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--mr-text);
}

.mr-pill {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.95rem;
  border-radius: var(--radius-pill);
  background: var(--mr-pale);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mr-deep);
}

.mr-hero__tools {
  margin: 0.9rem 0 0;
}

.mr-hero__tools img {
  width: 126px; /* the supplied 182px file, shown slightly smaller to stay crisp */
  height: auto;
}

/* phones (with their own pale circle) hug the top-right corner */
.mr-hero__media {
  align-self: start;
  justify-self: end;
  width: min(100%, 470px);
  margin-right: clamp(0rem, 2vw, 2rem);
}

.mr-hero__media img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Centred text sections ---------- */
.mr-section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.mr-centered {
  max-width: 920px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
  text-align: center;
}

.mr-centered p {
  margin: 1.25rem 0 0;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.8;
  color: var(--mr-muted);
}

/* ---------- Pain points ---------- */
.mr-pain {
  background: var(--mr-grey);
}

.mr-pain__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

.mr-pain__media {
  margin: 0;
}

.mr-pain__media img,
.mr-stage__media img {
  display: block;
  width: 100%;
  height: auto;
}

.mr-chevrons {
  display: grid;
  gap: 1.1rem;
}

.mr-chevrons li {
  position: relative;
  padding-left: 1.6rem;
  line-height: 1.7;
  color: var(--mr-muted);
}

.mr-chevrons li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--mr-teal);
  border-right: 2px solid var(--mr-teal);
  transform: rotate(45deg);
}

.mr-chevrons strong {
  color: var(--mr-text);
}

/* ---------- Timeline ---------- */
.mr-tl {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  padding: 0;
  list-style: none;
  /* rows: label+icon above | the line | icon+label below */
  grid-template-rows: auto 2.5rem auto;
}

/* the horizontal line, through the middle row */
.mr-tl::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  border-radius: 3px;
  background: var(--mr-text);
  transform: translateY(-50%);
}

.mr-tl__item {
  display: contents; /* children are placed on the grid directly */
}

.mr-tl__icon {
  justify-self: center;
  width: clamp(56px, 7vw, 84px);
  height: auto;
}

.mr-tl__label {
  justify-self: center;
  font-size: clamp(0.95rem, 0.85rem + 0.4vw, 1.2rem);
  font-weight: 800;
  color: var(--mr-text);
}

.mr-tl__week {
  position: relative;
  z-index: 1;
  grid-row: 2;
  align-self: center;
  justify-self: center;
  padding: 0.2rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--mr-pale);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mr-deep);
  white-space: nowrap;
}

/* each item lives in its own column; icon + label above or below the line */
.mr-tl__item:nth-child(1) > * { grid-column: 1; }
.mr-tl__item:nth-child(2) > * { grid-column: 2; }
.mr-tl__item:nth-child(3) > * { grid-column: 3; }
.mr-tl__item:nth-child(4) > * { grid-column: 4; }
.mr-tl__item:nth-child(5) > * { grid-column: 5; }

.mr-tl__item--above > .mr-tl__label,
.mr-tl__item--above > .mr-tl__icon { grid-row: 1; }

.mr-tl__item--above > .mr-tl__label { align-self: start; }
.mr-tl__item--above > .mr-tl__icon  { align-self: end; margin: 2.2rem 0 0.75rem; }

.mr-tl__item--below > .mr-tl__label,
.mr-tl__item--below > .mr-tl__icon { grid-row: 3; }

.mr-tl__item--below > .mr-tl__icon  { align-self: start; margin-top: 0.75rem; }
.mr-tl__item--below > .mr-tl__label { align-self: end; margin-top: calc(clamp(56px, 7vw, 84px) + 1.25rem); }

/* ---------- Design process ---------- */
.mr-process {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5.5rem);
  background: var(--mr-grey);
}

.mr-process__stages {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.mr-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(1.25rem, 4vw, 3rem);
}

.mr-stage--panel {
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: clamp(16px, 2vw, 22px);
  background: var(--mr-panel);
}

/* image on the left, text on the right */
.mr-stage--flip {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.mr-stage--flip .mr-stage__media { order: -1; }

.mr-stage__media {
  margin: 0;
}

/* tall tablets are capped so they don't tower over the text */
.mr-stage--define .mr-stage__media,
.mr-stage--testing .mr-stage__media {
  justify-self: center;
  width: min(100%, 400px);
}

.mr-stage--prototype .mr-stage__media img {
  border-radius: 14px;
}

.mr-stage__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem);
  font-weight: 800;
  color: var(--mr-teal);
}

.mr-stage__title img {
  width: 2.2rem;
  height: auto;
}

.mr-stage__sub {
  margin: 0.9rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mr-text);
}

.mr-stage__lead {
  margin: 0.6rem 0 0;
  color: var(--mr-muted);
}

.mr-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
  padding-left: 1.2rem;
  list-style: disc;
  line-height: 1.65;
  color: var(--mr-muted);
}

.mr-list li::marker {
  color: var(--mr-teal);
}

.mr-list strong {
  color: var(--mr-text);
}

.mr-list--sub {
  margin-top: 0.5rem;
  list-style: circle;
}

/* final refinements, marked as completed */
.mr-list--checks {
  margin-top: 0.5rem;
  padding-left: 0;
  list-style: none;
}

.mr-list--checks li {
  position: relative;
  padding-left: 1.7rem;
}

.mr-list--checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25em;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 4px;
  background: #3db64a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.4 3.2 3.2L15 6.8' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}

/* ---------- Footer row ---------- */
.cs--mr .cs-next__link {
  font-family: var(--font-sans);
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .mr-hero__card,
  .mr-pain__grid,
  .mr-stage,
  .mr-stage--flip {
    grid-template-columns: minmax(0, 1fr);
  }

  .mr-hero__text {
    padding-top: 1rem;
    padding-bottom: clamp(4rem, 14vw, 6rem); /* room above the corner shapes */
    text-align: center;
  }

  .mr-hero__brand {
    justify-content: center;
  }

  .mr-hero__tools img {
    margin-inline: auto; /* centred under the centred text */
  }

  /* phones anchored to the right edge, as on desktop; the artwork's cropped
     circle edge on the left fades out instead of showing a straight cut */
  .mr-hero__media {
    justify-self: end;
    order: -1;           /* phones first, flush with the card top like on desktop */
    width: min(88%, 440px);
    margin: 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%);
    mask-image: linear-gradient(to right, transparent 0%, #000 22%);
  }

  .mr-pain__media {
    justify-self: center;
    width: min(85%, 460px);
  }

  /* text first, picture after, for every stage */
  .mr-stage--flip .mr-stage__media { order: 0; }

  .mr-stage__media {
    justify-self: center;
    width: min(100%, 520px);
  }
}

/* ---------- Phones: smaller corner shapes, clear of the tool icons ---------- */
@media (max-width: 640px) {
  .mr-hero__shapes {
    width: 92px;
    left: -1.25rem;
    bottom: -1.75rem;
  }

  .mr-hero__text {
    padding-bottom: 5rem;
  }
}

/* ---------- Phones: vertical timeline ---------- */
@media (max-width: 700px) {
  .mr-tl {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 1rem;
    padding-left: 0.5rem;
  }

  /* line runs down the left, through the icons */
  .mr-tl::before {
    left: calc(0.5rem + 28px);
    right: auto;
    top: 28px;
    bottom: 28px;
    width: 3px;
    height: auto;
    transform: none;
  }

  .mr-tl__item,
  .mr-tl__item--above,
  .mr-tl__item--below {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 1rem;
    align-items: center;
  }

  .mr-tl__item > * {
    grid-column: auto !important;
    margin: 0 !important;
  }

  .mr-tl__item .mr-tl__icon {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    width: 56px;
  }

  .mr-tl__item .mr-tl__label {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: start;
    align-self: end;
  }

  .mr-tl__item .mr-tl__week {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: start;
    align-self: start;
    margin-top: 0.3rem !important;
  }
}
