/* The Sewing Machine Group Portfolio Site case study (same building blocks as citi.css)
   Building blocks:
   - Site navigation (fixed name / About / Work / Personal)
   - Title section: title, rule, Role / Date / Company, laptop image on the right edge
   - .section: heading with a rule under it (.section-title), white or grey (.section--grey)
   - .section-split: text beside an image that sits on the section's bottom edge
   - .label-list: bold labels to the left of their text
   - .section-image / .image-pair: centered images */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir", "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
  color: #333;
}

a {
  text-decoration: none;
}


/* ---------- Site navigation ---------- */

/* Name + About at the top, Work + Personal at the bottom,
   fixed above the page content while it scrolls (same spacing as the homepage) */
.site-header,
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;                /* above the images */
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;       /* clicks pass through the empty space between the links */
}

.site-header {
  top: 0;
  padding: 36px 44px 0;
}

.site-footer {
  bottom: 0;
  padding: 0 44px 36px;
}

.site-header a,
.site-footer a {
  pointer-events: auto;       /* ...but the links themselves stay clickable */
}

.site-name,
.site-nav-link {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #000;
}

.site-name {
  text-transform: uppercase;
}

.site-name:hover,
.site-nav-link:hover {
  color: #d65e1c;
}


/* ---------- Title section ---------- */

#cs-title-container {
  background: #f3edd3;
  padding: 120px 0 120px 80px;   /* none on the right so the laptop sits on the edge */
  display: flex;                 /* text on the left, laptop on the right */
  align-items: center;           /* text is centered vertically against the laptop */
  justify-content: space-between;
  gap: 60px;                     /* minimum space between the text and the laptop */
}

.cs-intro {
  flex: 0 1 900px;               /* up to 900px wide, narrower when the window is */
  min-width: 0;
}

.cs-title {
  margin: 0 0 40px;
  padding-bottom: 36px;
  /* border-bottom: 3px solid #333;   same rule as under the section headings */
  font-family: Georgia, "Times New Roman", serif;
  font-size: 64px;
  font-weight: bold;
  line-height: 64px;
  letter-spacing: 0.02em;
}

/* Role / Date / Company row under the title */
.cs-details {
  display: flex;
  margin: 0;
}

.cs-details div {
  flex: 0 1 300px;               /* each field starts 300px after the last, closer when space is tight */
}

.cs-details dt,
.cs-details dd {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0.06em;
}

.cs-details dt {
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* Laptop: flush to the section's right edge */
.cs-laptop {
  display: block;
  flex-shrink: 0;
  width: 450px;
}


/* ---------- Sections ---------- */

.section {
  background: #fff;
  padding: 100px 80px;
}

.section--grey {
  background: #f4f4f4;
}

/* White at the top fading to light grey at the bottom */
.section--fade {
  background: linear-gradient(to bottom, #fff, #f8f8f8);
}

.section-wrap {
  max-width: 1200px;
}

.section-title {
  margin: 0 0 56px;
  padding-bottom: 12px;
  border-bottom: 3px solid #333;   /* the rule under the heading */
  font-size: 36px;
  font-weight: 700;
  line-height: 44px;
  letter-spacing: 0.06em;
}

/* Body copy: plain paragraphs and the text in label lists */
.section-text,
.label-list p {
  margin: 0;
  font-size: 20px;
  line-height: 29px;
  letter-spacing: 0.06em;
  hyphens: auto;                   /* splits long words at line ends */
  -webkit-hyphens: auto;
}


/* ---------- Text beside an image ---------- */

.section-split {
  display: flex;                   /* text on the left, image on the right */
  justify-content: space-between;
  align-items: flex-end;           /* image sits at the bottom */
  gap: 60px;
}

.split-text {
  flex: 0 1 900px;                 /* up to 900px wide, narrower when the window is */
  align-self: flex-start;          /* text stays at the top when the image is taller */
  min-width: 0;
}

.split-image {
  display: block;
  flex: 0 1 600px;                 /* at most 600px, shrinks with the text */
  min-width: 0;
  max-width: 600px;
  height: auto;
  margin-bottom: -100px;           /* reaches past the bottom padding to the section's true bottom */
}

/* Add to .section-split to put the image on the left */
.section-split--image-left .split-image {
  order: -1;
}


/* ---------- Label list: label to the left of its text ---------- */

.label-list {
  display: grid;
  grid-template-columns: 300px 1fr;   /* label column, then the text */
  margin: 0;
}

.label-list dt {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 29px;
  letter-spacing: 0.08em;
}

.label-list dd {
  margin: 0 0 64px;                /* space before the next label */
}

.label-list dd:last-child {
  margin-bottom: 0;
}

.label-list p {
  margin-bottom: 29px;             /* one blank line between paragraphs */
}

.label-list p:last-child {
  margin-bottom: 0;
}

/* Item name on its own line above its description */
.item-name {
  display: block;
  font-weight: 600;
}


/* ---------- Text column ---------- */

/* Headings, their rules and text share one centered column,
   the same width as the lists on the Work / About / Personal pages */
.section > .section-title,
.section > .section-text,
.section-wrap {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}


/* ---------- Centered images ---------- */

.section-image {
  display: block;
  max-width: 100%;                 /* actual size, shrinks on smaller screens */
  height: auto;
  margin: 0 auto;
}

/* Two images side by side, centered */
.image-pair {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-top: 80px;
}

.image-pair img {
  display: block;
  min-width: 0;                    /* lets them shrink to fit side by side */
  max-width: 100%;
  height: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);   /* separates screenshots from a white background */
}

/* Image with a caption under it (wrap the img in a figure) */
.image-pair figure {
  margin: 0;
  min-width: 0;                    /* lets them shrink to fit side by side */
}

.image-pair figcaption {
  margin-top: 16px;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: 0.06em;
  text-align: left;
}

/* Last image in a section: space above it, and it sits on the section's bottom edge */
.section-image--bottom {
  margin-top: 80px;
  margin-bottom: -100px;           /* reaches past the bottom padding to the section's true bottom */
}


/* ---------- Next project ---------- */

/* Dark band at the very bottom, linking to the next project in the Work list */
.next-project {
  display: block;
  padding: 120px 80px;
  background: #2d2d2d;
  color: #fff;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
}

.next-project:hover {
  color: #d65e1c;
}

/* Work / Personal turn white while the dark band is behind them */
.site-footer.is-on-dark .site-nav-link {
  color: #fff;
}

.site-footer.is-on-dark .site-nav-link:hover {
  color: #d65e1c;
}

@media (max-width: 700px) {
  .next-project {
    padding: 80px 20px;
    font-size: 20px;
  }
}


/* ---------- Narrower screens ---------- */

@media (max-width: 1100px) {
  /* The image moves below the text, right-aligned */
  .section-split {
    flex-direction: column;
    align-items: stretch;
  }

  .split-text {
    align-self: stretch;
  }

  .split-image {
    flex: none;
    align-self: flex-end;
    width: 100%;
  }

  .section-split--image-left .split-image {
    order: 0;                      /* below the text even when it was on the left */
  }
}

@media (max-width: 1000px) {
  /* Title section: the laptop moves below the text, still flush right */
  #cs-title-container {
    flex-direction: column;
    align-items: stretch;
  }

  .cs-intro {
    flex: none;
    max-width: 900px;
    margin-right: 80px;            /* the container has no right padding, so the text gets it here */
  }

  .cs-laptop {
    align-self: flex-end;
    max-width: 90%;
  }

  /* Each label goes above its text */
  .label-list {
    grid-template-columns: 1fr;
  }

  .label-list dt {
    margin-bottom: 8px;
  }
}


/* ---------- Phones ---------- */

@media (max-width: 700px) {
  .site-header {
    padding: 24px 20px 0;
  }

  .site-footer {
    padding: 0 20px 24px;
  }

  .site-name,
  .site-nav-link {
    font-size: 15px;
  }

  #cs-title-container {
    padding: 100px 0 60px 20px;    /* 20px gutter on the left; laptop stays flush right */
    gap: 48px;
  }

  .cs-intro {
    margin-right: 20px;
  }

  .cs-title {
    margin-bottom: 32px;
  }

  /* Fields wrap onto new lines when they don't fit side by side */
  .cs-details {
    flex-wrap: wrap;
    gap: 24px 48px;
  }

  .section {
    padding: 60px 20px 80px;
  }

  .section-title {
    margin-bottom: 32px;
    font-size: 28px;
    line-height: 36px;
  }

  .section-text,
  .label-list dt,
  .label-list p {
    font-size: 17px;
    line-height: 26px;
    letter-spacing: 0.03em;
  }

  .section-split {
    gap: 40px;
  }

  .split-image {
    margin-bottom: -80px;          /* matches the bottom padding on phones */
  }

  .label-list p {
    margin-bottom: 26px;
  }

  .label-list dd {
    margin-bottom: 48px;
  }

  /* Stack the pair */
  .image-pair {
    flex-direction: column;
    align-items: center;
    gap: 40px;
    margin-top: 48px;
  }

  .section-image--bottom {
    margin-top: 48px;
    margin-bottom: -80px;          /* matches the bottom padding on phones */
  }
}
