/*
  Things I’ve Been Up To page (activities.html).
  Builds on style.css: same type, colours and spacing,
  with a wider canvas for video, slide and post embeds.
*/

body.page-activities {
  --w: 72rem;
}



main section {
  margin-top: calc(var(--s) * 4);
  padding-top: calc(var(--s) * 1.5);
  border-top: var(--l) solid var(--c-txt);
}

main section:first-child {
  margin-top: calc(var(--s) * 3);
}

main h2 {
  margin-bottom: calc(var(--s) * 1.5);
}

main h3 {
  margin-top: calc(var(--s) * 3);
  margin-bottom: calc(var(--s) * 0.75);
  max-width: var(--w-text, 65ch);
}

main h2 + h3 {
  margin-top: 0;
}

main section > p {
  max-width: 65ch;
}

/* Video + slides side by side */
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--s) * 1.5);
  margin-top: calc(var(--s) * 2.5);
}

h2 + .pair {
  margin-top: 0;
}

.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.embed iframe,
.embed img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.slides-image:hover img {
  opacity: 0.85;
}

.caption {
  margin-top: calc(var(--s) * 0.6);
  margin-bottom: 0;
  font-size: calc(var(--fs) * 0.85);
}

.resources {
  margin-bottom: calc(var(--s) * 1);
}

/* Posts */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: calc(var(--s) * 1.5);
  align-items: start;
  margin-bottom: calc(var(--s) * 1.5);
}

.media-grid .twitter-tweet,
.media-grid .instagram-media {
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* Fallback look before / without the embed scripts */
blockquote.twitter-tweet,
blockquote.instagram-media {
  border-left: var(--l) solid var(--c-link);
  padding: calc(var(--s) * 0.5) calc(var(--s) * 1);
  font-size: calc(var(--fs) * 0.85);
}

blockquote.twitter-tweet p {
  margin-bottom: 0.5rem;
}

/* Community & Events: meetup cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: calc(var(--s) * 1.5);
}

.card {
  border: var(--l) solid var(--c-txt);
  padding: calc(var(--s) * 1);
}

.card h3 {
  margin: 0 0 calc(var(--s) * 0.5);
}

.card p {
  margin-bottom: calc(var(--s) * 0.4);
  font-size: calc(var(--fs) * 0.85);
}

@media (max-width: 1024px) {
  .pair {
    grid-template-columns: 1fr;
  }
}

/* Keep everything inside the viewport.
   Grid tracks default to a min-content minimum, so fixed-width
   embeds (X posts, Instagram, iframes) could push the page wider
   than the screen. Allow every track to shrink to zero instead. */
html,
body.page-activities {
  overflow-x: clip;
}

body.page-activities {
  grid-template-columns: minmax(0, var(--w));
}

body.page-activities > *,
.pair > *,
.media-grid > *,
.card-grid > * {
  min-width: 0;
}

.pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.media-grid iframe,
.media-grid .twitter-tweet-rendered,
.media-grid .instagram-media,
main iframe {
  max-width: 100% !important;
  min-width: 0 !important;
}

@media (max-width: 1024px) {
  .pair {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Grouped sections: Immersive Projects, Events & Community Highlights */
.group .subsection {
  margin-top: calc(var(--s) * 3);
  padding-top: calc(var(--s) * 1);
  border-top: 1px dashed var(--c-txt);
}

.group h2 + .subsection {
  margin-top: 0;
}

.group .subsection > h3 {
  margin-top: 0;
  margin-bottom: calc(var(--s) * 1.5);
}

main h4 {
  font-weight: 400;
  font-style: italic;
  margin-top: calc(var(--s) * 2.5);
  margin-bottom: calc(var(--s) * 0.75);
  max-width: 65ch;
}

main h3 + h4 {
  margin-top: 0;
}

/* Side panel: jump to sections */
html {
  scroll-behavior: smooth;
}

main section,
.subsection {
  scroll-margin-top: calc(var(--s) * 2);
}

body.page-activities {
  --w: 84rem;
  --toc: 13rem;
}

.with-toc {
  display: grid;
  grid-template-columns: var(--toc) minmax(0, 1fr);
  gap: calc(var(--s) * 3);
  align-items: start;
}

.content {
  min-width: 0;
}

.toc {
  position: sticky;
  top: calc(var(--s) * 2);
  margin-top: calc(var(--s) * 3);
  padding-top: calc(var(--s) * 1.5);
  border-top: var(--l) solid var(--c-txt);
  font-size: calc(var(--fs) * 0.8);
  max-height: calc(100dvh - var(--s) * 4);
  overflow-y: auto;
}

.toc ul {
  list-style: none;
}

.toc li {
  margin-bottom: calc(var(--s) * 0.5);
}

.toc ul ul {
  margin-top: calc(var(--s) * 0.5);
  padding-left: 2ch;
}

.toc a {
  color: var(--c-txt);
}

.toc a:hover,
.toc a[aria-current="true"] {
  color: var(--c-link);
}

.toc a[aria-current="true"]::before {
  content: "→ ";
}

/* Smaller screens: panel becomes a compact list above the content */
@media (max-width: 1024px) {
  .with-toc {
    display: block;
  }

  .toc {
    position: static;
    max-height: none;
    margin-top: calc(var(--s) * 3);
  }

  .toc a[aria-current="true"]::before {
    content: none;
  }
}

/* Recognition & Contributions */
#recognition h3 {
  margin-top: calc(var(--s) * 2.5);
}

#recognition .section-intro + h3 {
  margin-top: 0;
}

.note-list {
  list-style: none;
  max-width: 65ch;
}

.note-list li {
  padding-left: 2ch;
  text-indent: -2ch;
  margin-bottom: calc(var(--s) * 0.6);
}

.note-list li::before {
  content: "– ";
}

/* Immersive Projects: project cards */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: calc(var(--s) * 1.5);
}

.project {
  display: block;
  min-width: 0;
}

.project-img {
  display: block;
  position: relative;
  aspect-ratio: 2 / 1;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.project-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s ease;
}

.project:hover .project-img img {
  opacity: 0.85;
}

.project-title {
  display: block;
  margin-top: calc(var(--s) * 0.5);
  font-size: calc(var(--fs) * 0.85);
}


/* Page title and introduction */
.page-intro {
  margin-top: calc(var(--s) * 3);
  max-width: 65ch;
}

.page-intro h1 {
  margin: 0 0 calc(var(--s) * 0.75);
}

.page-intro p {
  margin-bottom: 0;
}

/* One line under each section heading saying what it holds */
.section-intro {
  max-width: 65ch;
  margin-top: calc(var(--s) * -0.75);
  margin-bottom: calc(var(--s) * 2);
  font-size: calc(var(--fs) * 0.85);
  opacity: 0.7;
}

.section-intro + h3,
.group .section-intro + .subsection,
.section-intro + .talk > h3 {
  margin-top: 0;
}

/* Speaking & Workshops: title above its video and slides */
.talk {
  margin-top: calc(var(--s) * 3);
}

.section-intro + .talk {
  margin-top: 0;
}

.talk > h3 {
  margin-top: 0;
}

.talk .pair {
  margin-top: 0;
}

/* Keyboard focus and skip link */
a:focus-visible {
  outline: 2px solid var(--c-link);
  outline-offset: 3px;
}

.project:focus-visible {
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: var(--s);
  top: -100px;
  background: var(--c-txt);
  color: var(--c-bg);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  top: var(--s);
  color: var(--c-bg);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .project-img img {
    transition: none;
  }
}

@media (max-width: 1024px) {

  .page-intro {
    margin-top: calc(var(--s) * 2);
  }
}

/* Back to the homepage */
.back-link {
  display: inline-block;
  font-size: calc(var(--fs) * 1.4);
  line-height: 1;
  color: var(--c-txt);
  padding: 0.25rem 0;
}

.back-link:hover {
  color: var(--c-link);
}

@media (max-width: 1024px) {
  .back-link {
    margin-top: calc(var(--s) * 2);
  }
}

/* Back to top: hidden until the page has scrolled more than one screen */
.to-top {
  position: fixed;
  right: calc(var(--s) * 2);
  bottom: calc(var(--s) * 2);
  z-index: 50;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: calc(var(--fs) * 1.2);
  line-height: 1;
  color: var(--c-txt);
  background: var(--c-bg);
  border: var(--l) solid var(--c-txt);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

.to-top:hover {
  color: var(--c-link);
  border-color: var(--c-link);
}

.to-top:focus-visible {
  outline: 2px solid var(--c-link);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .to-top {
    transition: none;
  }
}

@media (max-width: 1024px) {
  .to-top {
    right: var(--s);
    bottom: var(--s);
  }
}
