:root {
  --body-family: source-serif-pro, serif;
  --heading-family: source-serif-4-small-text, serif;

  --tcc-blue: #003b76;
  --tcc-teal: #007b96;
  --tcc-teal-darker: color-mix(in hsl, var(--tcc-teal) 90%, black 10%);
  --tcc-burgundy: #98002b;

  --tcc-link: #2d54ae;
  --steel-orange: #ff2f00;
  --ds-green: #98cb33;
  --tcc-blue-hero: #003b76d4;

  --text-dark: #404040;
  --text-light: #f0f0f0;
  --accent-color: var(--ds-green);
  --grey-focus: #e0e0e0;

  --timeline-thickness: 4px;
  --timeline-padding-min: 2rem;
  --timeline-padding: 10rem;
  --timeline-offset: 2rem;
  --timeline-vertical-offset: 3.125rem;
}

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

.visuallyhidden {
	border: none;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--body-family);
  font-weight: 400;
  line-height: 1.5;
  background: linear-gradient( to bottom, #fff, #fff 33%, #fff 33%, #ecebff 60%, #e2e0ff 100% ) no-repeat top center / cover fixed;
  scroll-behavior: smooth;
  overflow: auto;
  scroll-margin-top: 9rem;
}

/* Prevent scrolling when dialog is open */
body:has(dialog:modal) {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--heading-family);
  font-weight: 800;
}

.mainMenu {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  background-color: var(--tcc-blue);
  padding: 10px 20px;
  gap: 0 2rem;
  color: var(--text-light);

  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;

  box-shadow: 0 2px 2px 4px hsl(0deg 0% 0% / 25%);

  .tccLogo {
    display: block;
    flex: 0 0 auto;
    margin-right: auto;

    a {
      text-decoration: none;
      display: block;
      
      &:is(:focus, :hover) {
        outline: 2px solid var(--accent-color);
        outline-offset: 4px;
      }

      img {
        display: block;
        height: 25px;
        width: auto;
      }
    }
  }

  .mobileMenuButton {
    background: transparent;
    border: none;
    font-family: var(--body-family);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-light);
    display: flex;
    gap: 0.25rem;
    
    svg {
      display: block;
      height: 1rem;
      width: auto;
      aspect-ratio: 1;
      flex-shrink: 0;

      fill: none;
      stroke: var(--accent-color);
      stroke-width: 3px;
      stroke-linecap: round;
      stroke-linejoin: round;

      object-position: center;

      transition: rotate 300ms ease-in-out;

      .open & {
        rotate: 0.25turn;
      }
    }

    @media (min-width: 800px) {
      display: none;
    }
  }

  .decadeNav {
    list-style: none;
    flex: 0 0 100%;
    height: 0;
    margin: 0;
    padding: 0;

    interpolate-size: allow-keywords;
    transition: content-visibility 300ms allow-discrete,
      height 300ms ease-in-out,
      opacity 300ms ease-in-out;

    display: grid;
    height: 0;
    opacity: 0;
    overflow-y: clip;

    @media (min-width: 800px) {
      display: contents;
      opacity: 1;
      height: auto;
    }

    .open & {
      height: auto;
      opacity: 1;
      padding-top: 1rem;
    }

    li {
      margin: 0;
      padding: 0;

      .open & {
        margin-bottom: 0.75rem;
      }
    }

    a {
      font-size: 1rem;
      font-weight: 700;
      line-height: 1;
      color: inherit;
      text-decoration: none;

      &:is(:hover, :focus) {
        text-decoration: underline solid 4px var(--accent-color);
        text-underline-offset: 0.25rem;
        outline: 0;
      }
    }
  }
}

.hero {
  width: 100%;
  height: 50vh;
  display: grid;
  place-items: center;
  background: url(../img/614-south-campus-probably-fall-67.jpg) no-repeat center / cover var(--tcc-blue-hero);
  background-blend-mode: multiply;
}

.hero-logo {
  max-width: 50%;
  max-height: 40vh;
  width: 500px;
  height: auto;
  filter: drop-shadow(2px 4px 6px black);
}

.introWrap {
  background: var(--tcc-teal-darker);
  padding: 3rem 1.25rem;
  color: var(--text-light);
}

.intro {
  max-width: 75ch;
  margin: 0 auto;

  h1 {
    text-align: center;
    line-height: 1.1;
    margin: 0 0 0.25em;
    font-size: 2.5rem;
  }

  p {
    font-size: 1.25rem;
  }

  .youtubeEmbed {
    margin: 2rem auto;

    iframe {
      width: 100%;
      aspect-ratio: 560 / 315;
    }
  }
}

.timelineWrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 5rem 1.25rem;

  button[data-dialog] {
    appearance: none;
    border: 0;
    border-radius: 0;
    background: inherit;
    color: var(--text-dark);
    font-family: var(--body-family);
    text-decoration: underline;
    cursor: pointer;
    text-align: left;
  }
}

.timeline {
  position: relative;
  border-left: var(--timeline-thickness) solid var(--accent-color);
  padding: 5rem var(--timeline-padding-min);

  @media (min-width: 38rem) {
    padding: 5rem var(--timeline-padding-min) 5rem var(--timeline-padding);
  }

  list-style: none;

  container-type: inline-size;

  &::before,
  &::after {
    display: block;
    position: absolute;
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
  }

  &::before {
    top: 0;
    left: 0;
    transform: translate(calc(-50% - var(--timeline-thickness) / 2));
  }

  &::after {
    bottom: 0;
    left: 0;
    transform: translate(calc(-50% - var(--timeline-thickness) / 2));
  }
}

.timepoint {
  margin-bottom: 6rem;
  position: relative;
  transition: ease 0.3s;

  opacity: 0;
  translate: 0 -30%;

  @media (min-width: 38rem) {
    &:not(:has(.decade)) {
      padding-left: 3rem;
      --timeline-offset: -1rem;
    }
  }

  &::before {
    width: 0;
    height: var(--timeline-thickness);
    background: var(--accent-color);
    content: "";
    display: block;
    position: absolute;
    top: var(--timeline-vertical-offset);
    left: calc(-1 * var(--timeline-padding-min));

    @media (min-width: 38rem) {
      left: calc(-1 * var(--timeline-padding));
    }
  }

  &::after {
    width: calc(4 * var(--timeline-thickness));
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent-color);
    content: "";
    display: block;
    position: absolute;
    top: calc(var(--timeline-vertical-offset) - (var(--timeline-thickness) * 1.5));
    left: calc(-1 * var(--timeline-padding-min) - (2.5 * var(--timeline-thickness)));

    @media (min-width: 38rem) {
      left: calc((-1 * var(--timeline-offset)) - (2 * var(--timeline-thickness)));
    }

    transform: scale(0);
    transform-origin: center;
  }

  &.in-view {
    translate: 0;
    opacity: 100%;
  }

  &.in-view::before {
    @media (min-width: 38rem) {
      animation: line-grow;
      animation-duration: 0.5s;
      animation-delay: 0.4s;
      animation-timing-function: ease-out;
      animation-fill-mode: forwards;
    }
  }

  &.in-view::after {
    animation: dot-grow;
    animation-duration: 0.6s;
    animation-delay: 0.4s;
    animation-fill-mode: forwards;
    /* animation-timing-function: cubic-bezier(.6, 2.13, .64, 1); */
    animation-timing-function: cubic-bezier(.08,2.13,.74,.96);

    @media (min-width: 38rem) {
      animation-delay: 1s;
    }
  }

  .label {
    .decade,
    .date {
      margin: 0 0 1rem;
      line-height: 1.1;
    }
    .decade {
      font-size: 3rem;
    }

    .date {
      font-size: 2rem;
    }

    button[data-dialog] {
      font-size: 1.5rem;
    }
  }
}

.timepoint:has(.image) {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;

  @container (min-width: 34rem) {
    grid-template-columns: 6.25rem 1fr;
  }
}

.timepoint:has(.decade) {
  --timeline-vertical-offset: 1.7rem;
}

.image {

  button[data-dialog^="i"] {
    appearance: none;
    box-shadow: 2px 2px 4px hsl(0deg 0% 0% / 35%);
    border-radius: 0.25rem;
    max-width: 6.25rem;
    aspect-ratio: 1;
    padding: 0;

    transition: scale 200ms ease, box-shadow 200ms ease-out;

    &:hover,
    &:focus {
      outline: 2px solid var(--accent-color);
      scale: 1.3;
      box-shadow: 6px 6px 6px 1px color-mix(in hsl, var(--accent-color) 20%, #000 10%);
    }

    img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 0.25rem;
    }
  }
}

dialog[id^="i"] {
  max-width: min(90svw, 800px);
  max-height: 90svh;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 3px solid var(--accent-color);

  figure {
    margin: 0;

    img {
      display: block;
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 80svh;
    }

    figcaption {
      margin: 0;
      padding: 0.5rem 1rem;
      background-color: var(--tcc-blue);
      color: var(--text-light);
    }
  }
}

.closeDialog {
  appearance: none;
  border: 1px solid var(--accent-color);
  background: var(--accent-color);
  border-bottom-right-radius: 0.5rem;
  width: 50px;
  height: 50px;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

::backdrop {
  background: color-mix(in hsl, var(--tcc-blue) 50%, #000 10%);
  backdrop-filter: blur(4px);
}

details {
  summary {
    font-size: 1.3rem;
    font-weight: 700;
    transition: color 200ms ease-in-out;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem 0.25rem 0 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;

    transition: background-color 200ms ease-in-out,
      outline-offset 200ms ease-in-out;


    &:hover,
    &:focus,
    [open] & {
      background-color: var(--grey-focus);
    }

    &:focus {
      outline: 1px solid color-mix(var(--accent-color) 80%, #fff 20%);
      outline-offset: 2px;
    }

    svg {
      display: block;
      height: 1.85rem;
      width: auto;
      aspect-ratio: 1;
      flex-shrink: 0;

      fill: none;
      stroke: var(--accent-color);
      stroke-width: 3px;
      stroke-linecap: round;
      stroke-linejoin: round;

      object-position: center;

      transition: rotate 300ms ease-in-out;

      [open] & {
        rotate: 0.25turn;
      }
    }
  }

  &::details-content {
    interpolate-size: allow-keywords;
    transition: content-visibility 300ms allow-discrete,
      height 300ms ease-in-out,
      opacity 300ms ease-in-out;

    display: grid;
    height: 0;
    opacity: 0;
    overflow-y: clip;    
  }

  &[open]::details-content {
    height: auto;
    opacity: 1;
  }

  .textLabel {
    display: block;
  }

  .textWrap {
    padding: 1rem 1.5rem;
    border: 1px solid var(--text-light);
    border-top: 0;
    border-radius: 0 0 0.25rem 0.25rem;
    background: #fff;
  }
}

footer {
  background: var(--tcc-blue);
  padding: 1rem 20px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-light);

  a {
    color: inherit;
    text-decoration: none;

    &:is(:focus, :hover) {
      text-decoration: underline;
    }
  }
}

.expandAll {
  background: transparent;
  border: none;
  font-family: var(--body-family);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-dark);
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin-left: auto;

  transition: background-color 200ms ease-in-out,
      outline-offset 200ms ease-in-out;

  &:hover,
  &:focus,
  &.open {
    background-color: var(--grey-focus);
  }

  &:focus {
    outline: 1px solid color-mix(var(--accent-color) 80%, #fff 20%);
    outline-offset: 2px;
  }
  
  svg {
    display: block;
    height: 1rem;
    width: auto;
    aspect-ratio: 1;
    flex-shrink: 0;

    fill: none;
    stroke: var(--accent-color);
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-linejoin: round;

    object-position: center;

    transition: rotate 300ms ease-in-out;

    .open & {
      rotate: 0.25turn;
    }
  }
}

/* =========================== ANIMATIONS ========================== */
@keyframes line-grow {
  from {
    width: 0;
  }

  to {
    width: calc(var(--timeline-padding) - var(--timeline-offset));
  }
}

@keyframes dot-grow {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1.0);
  }
}