/* Styles specific to the Soft Mechanics group site, on top of the Cambridge Project Light stylesheets. */

/* Indented block of text, matching the indentation of an unstyled list. */
.indented-block {
  margin: 0 0 9px 15px;
}

/* Text read by screen readers but not shown on screen (e.g. a heading the design has no room for). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- People (people.html): photo on the left, text beside it ---- */

.person {
  overflow: hidden;  /* contain the floated photo */
  margin-bottom: 28px;
}
.person-photo {
  float: left;
  width: 200px;
  height: auto;
  margin: 4px 30px 10px 0;
}
.person-text {
  overflow: hidden;  /* a column beside the photo, rather than wrapping under it */
}
.person-text h3 {
  margin-top: 0;
}
.person-role {
  color: #555;
  font-style: italic;
}
/* Former members: smaller photos, and a highlighted line saying where they went next. */
.person-alumnus .person-photo {
  width: 120px;
  margin-right: 24px;
}
.person-now {
  padding-left: 10px;
  border-left: 3px solid #8f2b8c;
}

@media (max-width: 600px) {
  .person-photo,
  .person-alumnus .person-photo {
    width: 110px;
    margin-right: 16px;
  }
  /* Too narrow for two columns: let the text wrap under the photo. */
  .person-text {
    overflow: visible;
  }
  .person-now {
    overflow: hidden;  /* keep its bar clear of the photo */
  }
}

/* ---- Publication list (publications.html, generated by build.py) ---- */

.publication-list {
  margin: 0;
  padding-left: 36px;
}

.publication {
  padding: 14px 0 16px;
  border-bottom: 1px solid #e4e4e4;
}
.publication:last-child {
  border-bottom: 0;
}
.publication::marker {
  color: #8f2b8c;
  font-weight: bold;
}

.publication-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: bold;
}

.publication-authors,
.publication-venue,
.publication-links {
  margin-top: 4px;
}
.publication-venue {
  color: #555;
}
.publication-links {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.publication-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 3px;
  background: #f3e8f3;
  color: #6a2068;
  font-size: 11px;
  line-height: 18px;
  font-weight: bold;
  vertical-align: 1px;
}

.publication-open {
  color: #2e7d32;
  font-weight: bold;
}

/* Figure under a key paper, shown large as in the original page design. */
.publication-figure {
  display: block;
  margin-top: 14px;
}
.publication-figure img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  margin: 0 auto;
}

/* The site's JavaScript adds an "external link" icon to every outside link; too busy in a list of DOIs. */
.publication-list a.campl-external {
  background: none;
  padding-right: 0;
}

/* Phones (keep 600px in step with PHONE_WIDTH in build.py). One clean column: the number
   moves to the start of the title line, so text and figures both use the full width between
   the page margins, lining up with the header and the rest of the page. */
@media (max-width: 600px) {
  .publication-list {
    padding-left: 0;
    list-style-position: inside;
  }
  .publication-figure img {
    max-height: 480px;
  }
}

/* Credit line under a news picture (e.g. a Creative Commons photo). */
.image-credit {
  margin-top: 4px;
  text-align: center;  /* under the centred picture */
  font-size: 10px;
  line-height: 14px;
  color: #777;
}

/* News pictures (news.html): cap the height so portraits (headshots, journal covers)
   don't tower over the text; they show narrower, centred, instead. */
.campl-horizontal-teaser-img img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 160px;
  margin: 0 auto;
}

/* A featured news item: the picture runs the full width of the column, above the text. */
.news-feature-img {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  margin: 6px auto 14px;
}

/* ---- Home page ---- */

/* Home teasers (John, research, publications, code): pictures all square, so the blocks line up. */
.home-teaser-img img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.home-teaser-portrait img {
  object-position: 50% 50%;
}
@media (max-width: 600px) {
  .home-teaser-img img {
    max-width: 240px;  /* full-width squares made the phone page very long */
    margin: 0 auto;
  }
}

/* "Where our people go": alumni with a small round portrait and their next step. */
.alumni-block {
  margin-top: 18px;
}
.alumni-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.alumni-list li {
  min-height: 46px;
  margin-bottom: 10px;
  padding-left: 56px;
  position: relative;
  font-size: 12px;
  line-height: 15px;
}
.alumni-list img {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
}
.alumni-list strong,
.alumni-list span {
  display: block;
}
.alumni-list span {
  color: #555;
}

/* Join us page: the alumni list in two columns, and a highlighted box for the coming deadlines. */
.alumni-list-wide {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 24px;
  margin-bottom: 20px;
}
.alumni-list-wide li {
  font-size: 13px;
  line-height: 17px;
}
@media (max-width: 600px) {
  .alumni-list-wide {
    grid-template-columns: 1fr;
  }
}
.join-deadlines {
  padding: 10px 14px;
  border-left: 4px solid #782c7e;  /* the site's purple */
  background: #f5eff6;
}

/* Featured papers: separate cards with the grey sidebar showing between them, pictures all 2:1. */
.featured-heading {
  margin: 0 0 10px;
}
.featured-card {
  margin-bottom: 16px;
}
.featured-card img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
}
.featured-journal {
  margin-bottom: 4px;
  font-weight: bold;
}

/* ---- Teaching page ---- */
.teaching-video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 6px 0 22px;
  background: #000;
}
.teaching-files {
  margin-bottom: 16px;
}
/* Teaching record: the years in a fixed-width column, the description beside them. */
.teaching-record {
  margin: 6px 0 18px;
  padding: 0;
  list-style: none;
}
.teaching-record li {
  margin-bottom: 6px;
  padding-left: 92px;
  position: relative;
}
.teaching-record li span {
  position: absolute;
  left: 0;
  color: #6a2068;
  font-weight: bold;
}
@media (max-width: 600px) {
  .teaching-record li {
    padding-left: 0;
  }
  .teaching-record li span {
    position: static;
    display: block;
  }
}

/* ---- Research page: pictures and looping videos with captions ---- */
.research-figure {
  margin: 14px auto 24px;
  text-align: center;
}
.research-figure img,
.research-figure video {
  display: block;
  width: 100%;
  max-width: 480px;  /* square and 4:3 pictures; wide strips may be wider */
  height: auto;
  margin: 0 auto;
}
.research-wide img,
.research-wide video {
  max-width: 100%;  /* full column width, matching the grids */
}
.research-figure figcaption {
  max-width: 640px;
  margin: 6px auto 0;
  font-size: 12px;
  line-height: 16px;
  color: #555;
}
.research-pair {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 24px;
}
.research-pair .research-figure {
  flex: 1 1 260px;
  max-width: 340px;
  margin-left: 0;
  margin-right: 0;
}
.research-embed {
  margin: 14px 0 24px;
  text-align: center;
}
.research-embed iframe {
  max-width: 100%;
  border: 0;
}
.research-funders {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0 20px;
}

/* Research page grids: two or three equal cells side by side on wide screens, stacked on phones.
   Every picture in a grid has the same shape (4:3, or 2:1 for .media-grid-wide), cropped to fill. */
.media-grid {
  display: grid;
  gap: 18px;
  margin: 14px 0 26px;
}
.media-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.media-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.media-grid figure {
  margin: 0;
}
.media-grid img,
.media-grid video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}
.media-grid-wide img,
.media-grid-wide video {
  aspect-ratio: 2 / 1;
  background: #fff;
}
.media-grid figcaption {
  margin-top: 6px;
  font-size: 12px;
  line-height: 16px;
  color: #555;
}
@media (max-width: 600px) {
  .media-grid-2,
  .media-grid-3 {
    grid-template-columns: 1fr;
  }
}


/* Two versions of a figure: side by side on wide screens, stacked on phones. Hidden videos never load. */
.only-narrow {
  display: none !important;
}
@media (max-width: 600px) {
  .only-wide {
    display: none !important;
  }
  .only-narrow {
    display: block !important;
  }
}
.media-grid-square img,
.media-grid-square video {
  aspect-ratio: 1 / 1;
}

/* Code page: the MorphoShell animation */
.code-video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Home: the group's motto, large, under the carousel. */
.home-motto {
  margin: 0;
  padding: 22px 24px 20px;
  background: #fff;
  border-left: 6px solid #782c7e;  /* the site's purple */
}
.home-motto p {
  margin: 0;
  font-size: 54px;
  line-height: 60px;
  font-weight: bold;
  letter-spacing: -0.5px;
  color: #782c7e;
}
.home-motto cite {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-style: normal;
  color: #555;
}
.home-motto cite::before {
  content: "\2014\00a0";
}
@media (max-width: 600px) {
  .home-motto {
    padding: 14px 16px;
  }
  .home-motto p {
    font-size: 28px;
    line-height: 32px;
  }
}

/* ---- Unlinked results pages (e.g. frustum_squash.html): square panels and videos in grids ---- */
.results-box {
  margin: 10px 0 24px;
  padding: 12px 16px 4px;
  border-left: 4px solid #782c7e;  /* the site's purple */
  background: #f5eff6;
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 12px 0 26px;
}
.results-grid-2 { grid-template-columns: repeat(2, 1fr); }
.results-grid-4 { grid-template-columns: repeat(4, 1fr); }
.results-grid figure {
  margin: 0;
}
.results-grid img,
.results-grid video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  background: #fff;
}
.results-grid figcaption,
.results-figure figcaption {
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: #555;
}
.results-figure {
  margin: 12px auto 26px;
  max-width: 640px;
}
.results-figure img {
  display: block;
  width: 100%;
  height: auto;
}
.results-math {
  overflow-x: auto;  /* long equations scroll rather than widen the page on phones */
}
@media (max-width: 600px) {
  .results-grid,
  .results-grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .results-grid-2 { grid-template-columns: 1fr; }
}

/* A news item with two pictures stacked (e.g. an event and its result). */
.news-second-img {
  margin-top: 8px !important;
}
/* ... both pictures the full width of the column, so they line up. */
.campl-horizontal-teaser-img img.news-pair-img {
  width: 100%;
  max-height: none;
}
@media (max-width: 600px) {
  .campl-horizontal-teaser-img img.news-pair-img {
    max-width: 260px;
  }
}
