@import url("https://fonts.googleapis.com/css2?family=Inter:slnt,wght@-10..0,100..900&display=swap");
@import url("/assets/css/telegraf.css");

:root {
  --orange: #f0a427;
  --red: #b80404;
  --black: #464240;
  --purple: #81253b;
  --dark-sand: #685743;
  --gray: #e2e1df;
}

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

/* ------ Generics ------ */

img {
  max-width: 100%;
}

html {
  font-size: 16px;
  line-height: 1.4;

  @media (min-width: 1400px) {
    font-size: 1.14285714vw; /* Proportional to width on large screens */
  }
}

body {
  color: var(--black);
  margin: 0;

  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

a {
  color: var(--purple);
  text-decoration-thickness: 0;
  text-decoration-color: transparent;
  transition: text-decoration-thickness 0.1s, text-decoration-color 0.1s;

  &:hover {
    text-decoration-color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 0.075rem;
  }
}

h1 {
  color: var(--purple);
  font-family: Telegraf;
  font-size: 2.5rem;
  line-height: 1.1;

  @media (width < 42rem) {
    font-size: 1.8rem;
  }

  &.smaller-title {
    font-size: 1.5rem;
  }
}

.parent-page-link {
  color: var(--red);
  font-family: Telegraf;
  font-weight: lighter;
  font-size: 1.125rem;
}

.parent-page-link + h1 {
  margin-top: 0;
}

.page-intro {
  font-size: 1.25rem;
  font-weight: normal;
  max-width: 45em;
  margin-bottom: 2rem;
}

/* ------ Utilities ------ */

.content-layout {
  margin: 0 auto;
  padding: 0 2rem;
  max-width: 64rem;
  container-type: inline-size;

  @media (width < 42rem) {
    padding: 0 1rem;

    .full-width-content {
      margin: 0 min((-100vw + 62rem) / 2, -1rem);
      padding: 0;
    }
  }

  .full-width-content {
    margin: 0 min((-100vw + 60rem) / 2, -2rem);
    padding: 0;
  }
}

.wide-images {
  margin: 2rem auto;

  img {
    width: 100%;
  }
}

.floating-image {
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button-link {
  --tint: var(--dark-sand);

  background: transparent;
  color: var(--tint);
  display: inline-block;
  vertical-align: baseline;
  border: solid 1px var(--gray);
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;

  transition: color 0.3s ease-in-out, border-color 0.1s linear;

  &.primary {
    --tint: var(--red);
  }

  &:hover {
    text-decoration: none;
    border-color: color-mix(in srgb, var(--tint) 50%, transparent);
    background-color: color-mix(in srgb, var(--tint) 4%, transparent);
  }
}

/* ------ Image gallery ------ */

.gallery-container {
  --content-offset: min(-2rem, calc((100vw - 64rem) * -0.5 - 2rem));
  --content-width: calc(100vw + var(--content-offset) * 2);
  position: relative;

  @media (width < 42rem) {
    --content-offset: min(-1rem, calc((100vw - 64rem) * -0.5 - 1rem));
  }

  figcaption {
    min-height: 1rem;
    color: var(--dark-sand);
    font-style: italic;
    margin-right: auto;
    font-size: 0.8125rem;
    transition: opacity 0.3s 0.2s ease-out, transform 0.3s 0.2s ease-out;
    padding-bottom: 1rem;

    p {
      margin: 0;
      max-width: 32rem;
    }

    p.caption {
      color: var(--purple);
    }
  }

  &:hover {
    .floating-controls {
      .floating-previous,
      .floating-next {
        opacity: 0.8;
      }
    }
  }

  .floating-controls {
    .floating-previous,
    .floating-next {
      opacity: 0;
      position: absolute;
      top: 20%;
      bottom: 20%;
      width: 8rem;
      min-width: 10vw;
      padding: 0 0.25rem;
      color: var(--purple);
      border: none;
      background: none;
      transition: opacity 0.3s ease-out, padding 0.3s ease-out;

      &:hover {
        opacity: 1;
        padding: 0 1rem;

        &::before {
          opacity: 1;
        }
      }

      &:active {
        opacity: 0.8;
        padding: 0 0.8rem;
      }

      &.disabled {
        opacity: 0;
        pointer-events: none;
      }
    }

    .floating-previous {
      left: var(--content-offset);
      background: radial-gradient(
        100% 50% at 0% 50%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.8) 8%,
        rgba(255, 255, 255, 0.5) 35%,
        rgba(255, 255, 255, 0.03) 90%,
        rgba(255, 255, 255, 0) 100%
      );
      text-align: left;
    }

    .floating-next {
      right: var(--content-offset);
      background: radial-gradient(
        100% 50% at 100% 50%,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0.8) 8%,
        rgba(255, 255, 255, 0.5) 35%,
        rgba(255, 255, 255, 0.03) 90%,
        rgba(255, 255, 255, 0) 100%
      );
      text-align: right;
    }
  }

  .controls {
    position: absolute;
    right: 0;
    bottom: -0.5rem;
    width: 12rem;
    display: none;
    transition: opacity 0.3s;

    &.loaded {
      display: flex;
      opacity: 1;
    }

    button {
      border: none;
      background: none;
      color: var(--orange);
      transition: color 0.5s, opacity 0.2s;
      font-size: 1.1rem;
      padding: 0;
      vertical-align: center;

      &:hover {
        opacity: 0.8;
      }

      &:active {
        opacity: 0.6;
      }

      &.disabled {
        color: var(--gray);
      }
    }

    .indicators {
      flex-grow: 1;
      display: grid;
      grid-auto-flow: column;
      align-items: center;
      margin: 0 1rem;
      padding-top: 0.36rem;

      .image-dot {
        height: 2rem;
        border-radius: 1rem;

        &::after {
          content: "";
          border-radius: 0.25rem;
          display: block;
          background-color: var(--gray);
          height: 0.25rem;
          margin: 0 0.0625rem;
          transition: background-color 0.5s, height 0.2s;
        }

        &:hover::after {
          background-color: color-mix(
            in srgb,
            var(--orange) 50%,
            var(--gray) 50%
          );
          height: 0.375rem;
        }

        &.active::after,
        &.active:hover::after {
          background-color: var(--orange);
        }
      }
    }
  }

  ul {
    list-style: none;
    padding: 0 calc(var(--content-offset) * -1);
    position: relative;

    scrollbar-width: none;
    display: flex;
    flex-direction: row;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scroll-padding-left: calc(var(--content-offset) * -1);
    scroll-padding-right: calc(var(--content-offset) * -1);
    margin: 0 var(--content-offset);

    li {
      max-width: var(--content-width);
      scroll-snap-align: start;
      margin-right: 2rem;
      flex-shrink: 0;

      &.inactive figure a img {
        cursor: default;
      }

      &.inactive figcaption {
        transform: translateY(-0.25rem);
        opacity: 0;
      }

      &:last-of-type {
        margin-right: 0;
      }

      figure {
        margin: 0;
      }

      img {
        /* A bit of a magic ratio – AfH's photo shoots all get the same height (portrait vs landscape) this way. */
        max-height: min(80vh, 600px);
        max-width: var(--content-width);
        min-height: 100%;
        height: auto;
        width: auto;
      }
    }
  }
}

/* ------ Nav ------ */
.site-nav {
  display: flex;
  align-items: center;
  flex-direction: row;
  padding-top: 2rem;
  padding-bottom: 2rem;

  .home-link {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    justify-content: center;
    margin: -0.5rem auto 0 -1rem;
    overflow: hidden;

    @media (width < 42rem) {
      align-self: flex-start;
      width: 4rem;
      margin-left: 0;
    }

    img {
      width: 16rem;
      max-width: none;
    }
  }

  .page-lists {
    margin-left: auto;

    .pages,
    .involvement-links {
      font-family: Telegraf;
      display: flex;
      flex-wrap: wrap;
      flex-direction: row;
      justify-content: flex-end;
      list-style: none;
      padding: 0;
      margin: 0 0 0 1rem;

      li {
        margin: 0 0 0.5rem 1rem;
        text-align: right;
        line-height: 1.1;

        a {
          color: inherit;
        }
      }

      .highlighted-link {
        color: var(--purple);
        font-weight: bold;
        font-family: Telegraf;

        a {
          color: inherit;
        }

        &.red {
          color: var(--red);
        }

        &.orange {
          color: var(--orange);
        }

        &.sand {
          color: var(--dark-sand);
        }
      }

      .lang-link {
        font-weight: bold;
        font-family: Telegraf;
        font-weight: normal;
        color: var(--dark-sand);
        &.active {
          display: none;
        }
      }
    }
  }
}

/* --- Default page --- */

.subpages-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;

  li {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

/* --- Content blocks --- */

.styled-blocks {
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: var(--dark-sand);
    font-family: Telegraf;
    margin-top: 2rem;
  }

  a {
    color: var(--purple);
  }

  h2 {
    color: var(--red);
    margin-top: 4em;
  }

  p {
    max-width: 48rem;
  }

  blockquote {
    border-left: solid 0.375rem var(--dark-sand);
    margin: 4rem 0;
    padding: 0.5rem 0 0.5rem 2rem;
    font-size: 1.25rem;
    font-style: italic;
    font-weight: 300;
    max-width: 48rem;
    line-height: 1.6;

    footer {
      color: var(--red);
      font-size: 0.875rem;
      font-weight: normal;
      margin-top: 1rem;

      &::before {
        content: "- ";
      }
    }
  }

  figure {
    margin: 2rem 0;

    figcaption {
      color: var(--dark-sand);
      font-style: italic;
      margin-right: auto;
      font-size: 0.8125rem;

      p {
        margin: 0;
      }

      p.caption {
        color: var(--purple);
      }
    }

    /* Video */

    iframe {
      aspect-ratio: 1.75;
      width: 100%;
      border: solid 1px var(--gray);
      border-radius: 8px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .controls {
      display: flex;
      flex-direction: row;
      justify-content: flex-end;
    }
  }

  hr {
    border: none;
    border-top: solid 2px var(--gray);
    margin: 4rem;
  }

  /* Custom callout block */
  .afh-callout {
    margin: 4rem auto 4rem 0;
    max-width: 40rem;

    &.centered {
      margin: 4rem auto 4rem;
      text-align: center;
    }

    h2 {
      border-bottom: solid 1px var(--gray);
    }
  }

  .afh-links {
    ul {
      font-family: Telegraf;
      font-size: 1.25rem;

      padding: 0;
      list-style: none;

      li {
        a {
          color: var(--red);
          font-weight: bold;

          &::after {
            display: inline-block;
            content: " →";
            font-size: 0.95rem;
            font-weight: normal;
            opacity: 0.3;
            transform: translateX(0);
            text-decoration: none;
            transition: transform 0.15s ease-out, opacity 0.15s ease-out;
          }

          &:hover::after {
            opacity: 1;
            transform: translateX(0.15rem);
          }
        }
      }
    }
  }

  .afh-project {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2rem;
    align-items: center;
    margin: 8rem 0;

    @container (width < 42rem) {
      display: block;
    }

    h2 {
      color: var(--purple);
    }

    img {
      border-radius: 4px;
    }
  }
}

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

@keyframes come-in {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home {
  .video-header {
    position: relative;

    width: 100%;
    height: auto;
    margin-bottom: 2rem;

    .floating-container {
      padding: 2rem;
      position: absolute;
      margin: 0;
      inset: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      pointer-events: none;
      z-index: 2;

      .floating-title {
        pointer-events: all;
        display: flex;
        flex-direction: column;
        justify-content: center;

        h1 {
          font-size: 2rem;
          animation: 1s come-in ease-in-out;
          color: var(--dark-sand);
          font-weight: normal;

          strong {
            color: var(--red);
            font-weight: bold;
          }
        }
      }
    }

    .background-video {
      background-color: var(--purple);
      pointer-events: none;
      width: 100%;
      max-height: 85vh;
      height: auto;
      object-fit: cover;
    }

    /* States for before and after loading */
    &.before-load {
      .floating-title {
        opacity: 1;
        transform: translateY(0);
      }

      .background-video {
        opacity: 0;
        transform: translateY(2rem);
      }
    }

    &.after-load {
      .background-video {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 1.5s 1s, transform 2s 1s ease-out;
      }

      .floating-title {
        opacity: 0;
        transform: translateY(-1rem);
        transition: transform 1s ease-in, opacity 1s ease-in;
      }
    }
  }

  .intro {
    font-size: 1.25rem;
    margin: 1rem 0 2rem;

    .intro-columns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      column-gap: 2rem;

      @media (width < 46rem) {
        display: block;
      }
    }
    .buttons {
      margin-top: 1rem;
      text-align: center;
    }
  }
}

/* ------ Projects and articles ------ */
.list-controls {
  margin: 2rem 0 1rem;

  select,
  input {
    background: none;
    border: solid 1px var(--gray);
    border-radius: 4px;
    padding: 4px 8px;
  }
}

.projects-list,
.press-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  grid-gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  grid-auto-rows: 0.25rem;

  li {
    .content {
      padding-bottom: 2rem;
    }

    a {
      img {
        width: 100%;
        height: auto;
        margin-right: 1rem;
        border-radius: 4px;
      }

      h2 {
        margin: 1rem 0 0.5rem;
        color: var(--purple);
        font-size: 1.5rem;
      }

      p {
        color: var(--black);
      }

      &:hover {
        text-decoration: none;

        h2 {
          text-decoration-color: inherit;
          text-decoration: underline;
          text-decoration-thickness: 0.075rem;
        }
      }
    }
  }
}

.press-list {
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));

  li {
    a {
      display: block;
      text-decoration: none;

      img {
        opacity: 1;
        transition: opacity 0.3s;
        height: auto;
      }

      &:hover img {
        opacity: 0.8;
      }

      h2 {
        color: var(--black);
        margin: 0.25rem 0;
        font-size: 1.125rem;
        line-height: 1.3;
        font-weight: normal;
      }

      h3.publication {
        color: var(--purple);
        font-size: 0.75rem;
        font-weight: normal;
        margin-bottom: 0.25rem;
      }
    }

    .date {
      margin: 0;
      color: var(--dark-sand);
      font-size: 0.75rem;

      span.project {
        a {
          color: inherit;
          font-weight: inherit;
          font-size: inherit;
          display: inline;

          &:hover {
            text-decoration: underline;
          }
        }
      }
    }
  }
}

.article-layout {
  display: flex;
  flex-direction: row;
  align-items: baseline;

  @media (max-width: 600px) {
    display: block;
  }

  .main {
    flex: 1 1;
  }

  aside {
    flex: 0 0 16rem;
    padding-left: 4rem;

    @media (max-width: 640px) {
      padding-left: 2rem;
      flex: 0 0 12rem;
    }

    @media (max-width: 600px) {
      padding: 2rem 0;
    }

    h2 {
      margin-top: 2rem;
      font-family: Telegraf;
      font-size: 1rem;
      border-bottom: solid 1px var(--gray);
    }

    .installed,
    .location {
      font-size: 0.875rem;
    }

    .artists,
    .press {
      list-style: none;
      padding: 0;

      li {
        color: var(--purple);
        margin-bottom: 0.5rem;
        font-style: italic;

        a {
          text-decoration: underline;
          text-decoration-color: var(--gray);
          transition: text-decoration 0.1s;

          &:hover {
            text-decoration-color: inherit;
          }
        }
      }
    }
  }
}

/* --- Large images page --- */

.templated-images ul.images {
  padding: 0;
  list-style: none;

  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-gap: 2rem;

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

  li {
    display: flex;
    flex-direction: column;

    .image-info {
      display: flex;
      flex-direction: column;

      h2 {
        color: var(--purple);
        margin: 0.5rem 0;
      }

      p {
        margin: 0 0 2rem;
      }
    }

    figure {
      margin: 0;

      border-radius: 4px;
    }
  }
}

/* --- Footer --- */

.site-footer {
  margin: 4rem auto 2rem;

  .involvement {
    padding-bottom: 4rem;

    h3 {
      font-size: 0.8125rem;
      color: var(--orange);
      margin: 0;
    }

    h4 {
      margin: 0.5rem 0;
      font-family: Telegraf;
      font-size: 1.25rem;
      border-bottom: solid 1px var(--gray);
      font-weight: normal;

      strong {
        font-weight: bold;
      }
    }

    .columns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      column-gap: 2rem;

      .column {
        margin-bottom: 2rem;
      }

      @container (width < 42rem) {
        display: block;
      }
    }
  }

  .footer-nav {
    padding: 2rem 0 0;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 2rem;
    border-top: solid 1px var(--gray);

    @container (width < 44rem) {
      font-size: 0.875rem;
      grid-template-columns: repeat(2, 1fr);
      column-gap: 1rem;
    }

    .footer-content {
      grid-column: span 2;
      display: flex;
      align-items: flex-start;
      flex-direction: column;
      justify-content: space-between;

      .home-link {
        display: block;
        margin: 0;
      }
    }

    .pages,
    .involvement-links {
      flex: 1 1 50%;
      align-items: baseline;
      padding: 0;

      font-size: 1rem;
      list-style: none;

      li {
        margin-bottom: 1rem;

        a {
          color: inherit;
        }
      }
    }

    .involvement-links li {
      font-family: Telegraf;
      font-weight: normal;
      font-size: 1.125rem;
      line-height: 1.2;

      @container (width < 44rem) {
        font-size: 1rem;
      }

      a {
        display: block;
        color: inherit;

        strong {
          color: var(--red);
          display: inline-block;
          font-style: normal;
          font-weight: bold;
        }

        &:hover strong {
          text-decoration: inherit;
        }
      }
    }
  }
}
