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

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

:root {
  --background-colour: #101010;
  --surface-colour: #3a3a3a;
  --text-colour: #ededed;
  --text-muted-colour: #888;
  --text-muted-colour-lighten: #aaa;
  /*--color-accent:  #ff4c00;*/
  --border-colour: #656565;
  /*--font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;*/
  /*--font-mono: 'Courier New', monospace;*/
  --max-width: 1280px;
  --side-padding: 1rem;
}

@media (max-width: 600px) {
  :root {
    --side-padding: 0.5rem;
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  scroll-padding-top: var(--nav-h, 0px);
}

body {
  background: var(--background-colour);
  color: var(--text-colour);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

div.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
}

body >header {
  padding: 5px 0 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background-colour);
  transition: background-color 0.5s;

  &.has-background {
    background: var(--background-colour) !important;
  }

  svg.logo {
    height: clamp(2.5rem, 6vw, 5rem);
    fill: var(--text-colour);
  }

  nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--side-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;

    ul {
      list-style: none;
      display: flex;
      gap: clamp(0.2rem, 3vw, 2rem);
      font-size: clamp(0.6rem, 3vw, 1rem);

      a {
        color: var(--text-muted-colour);
        letter-spacing: 0.1em;
        text-transform: uppercase;
        transition: color 0.15s;

        &.is-active {
          color: var(--text-colour);
        }
      }

      @media (max-width: 640px) { display: none; }
    }

    &.is-open ul {
      @media (max-width: 640px) {
        display: flex;
        width: 100%;
        justify-content: space-evenly;
        padding: 0.75rem 0;
        font-size: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.08);
      }
    }

    .nav-toggle {
      display: none;
      flex-direction: column;
      justify-content: center;
      gap: 5px;
      background: none;
      border: none;
      cursor: pointer;
      padding: 4px;

      span {
        display: block;
        width: 22px;
        height: 2px;
        background: var(--text-colour);
        transition: transform 0.25s, opacity 0.2s;
        transform-origin: center;
      }

      &[aria-expanded="true"] {
        span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
        span:nth-child(2) { opacity: 0; }
        span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
      }

      @media (max-width: 640px) { display: flex; }
    }
  }

  @media (max-width: 640px) {
    nav { flex-wrap: wrap; }
  }
}

main {
  flex: 1;
}


body.home >header {
  background: transparent;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  nav ul a {
    color: var(--text-colour);
  }
}

section.home-hero {
  position: relative;
  height: 100dvh;
  overflow: hidden;

  div.video {
    position: absolute;
    inset: 0;

    video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }

  div.scroll-hint {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    animation: fade-in 1s ease 1s both;
    transition: opacity 0.4s ease;

    &.is-hidden { opacity: 0 !important; }

    .scroll-chevron {
      --thickness: 5px;
      --colour: rgba(255, 255, 255, 0.5);
      --length: 50px;
      display: block;
      width: var(--length);
      height: var(--length);
      border-right: var(--thickness) solid var(--colour);
      border-bottom: var(--thickness) solid var(--colour);
      transform: rotate(45deg);
      animation: chevron-bounce 1.8s ease infinite;
    }
  }
}

@keyframes chevron-bounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.5; }
  50%       { transform: rotate(45deg) translate(4px, 4px); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}


.home-intro {
  padding: 6rem 0;
  background: var(--background-colour);

  h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
  }

  p {
    font-size: 1.05rem;
    color: var(--text-colour);
    max-width: 52ch;
    line-height: 1.6;
  }
}

.home-featured {
  background: var(--background-colour);

  h2 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted-colour);
    margin-bottom: 2rem;
  }

  .section-footer {
    margin-top: 2.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--text-muted-colour);

    a:hover { color: var(--text-colour); }
  }
}

section.related-projects {
  h2 {
    margin-bottom: 1rem;
  }

  div.project-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
  }

  @media (max-width: 800px) {
    div.project-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;

  @media (max-width: 800px) {
    gap: 0.25rem;
    grid-template-columns: repeat(2, 1fr);
  }

  article.project-card {
    min-width: 0;

    h2, h3 {
      font-size: 0.92rem;
      font-weight: 500;
      line-height: 1.3;
      margin-bottom: 0;

      a {
        color: var(--text-colour);
        &:hover {
          color: var(--text-muted-colour);
        }
      }

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

    .thumb {
      display: block;
      overflow: hidden;
      margin-bottom: 0.55rem;

      img {
        width: 100%;
        aspect-ratio: 1.6;
        object-fit: cover;
        display: block;
        transition: transform 0.5s ease, opacity 0.3s;
      }
    }

    &:hover {
      .thumb img {
        opacity: 0.8;
      }
    }


    .project-client {
      font-size: 0.68rem;
      margin-bottom: 0.2rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      @media (max-width: 800px) {
        font-size: 0.55rem;
      }
    }
  }
}



ul.categories, ul.effects, ul.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

ul.tags {
  margin: 1rem 0;
  text-transform: lowercase;

  li {
    font-size: 0.9rem;
    color: var(--text-muted-colour);

    a {
      &:hover {
        color: var(--text-muted-colour-lighten);
      }
    }
  }
}

section.projects {
  header {
    position: sticky;
    top: var(--nav-h, 0px);
    z-index: 9;
    background: var(--background-colour);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    /*margin-bottom: 1rem;*/
    padding-bottom: 0.75rem;

    .search-wrap {
      @media (max-width: 640px) {
        flex-basis: 100%;
        .spacer {
          display: none;
        }
      }
      @media (min-width: 640px) {
        min-width: 450px;
      }

      position: relative;
      display: flex;
      align-items: center;
      /*border-bottom: 1.5px solid var(--text-muted-colour);*/
      transition: border-color 0.2s;

      &:focus-within {
        border-bottom-color: var(--text-colour);

        .search-icon {
          color: var(--text-colour);
        }
      }

      svg {
        position: absolute;
        left: 8px;
        width: 24px;
        height: 24px;
        pointer-events: none;
        transition: color 0.2s;
        flex-shrink: 0;
        stroke-width: 3px;
      }
    }

    input.search {
      width: 100%;
      background: #222;
      background: var(--background-colour);
      /*border-radius: 0.25rem;*/
      /*border: 1px solid #888;*/
      border: none;
      border-bottom: 1px solid #888;
      color: var(--text-colour);
      font: inherit;
      outline: none;
      padding: 0.6rem 0rem 0.6rem 2.5rem;

      &::placeholder {
        color: var(--text-muted-colour);
      }

      &::-webkit-search-cancel-button {
        filter: invert(1);
      }
    }

    .active-filters {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: center;

      @media (max-width: 640px) {
        order: 2;
      }

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


      span {
        font-size: 0.78rem;
        cursor: pointer;
        transition: color 0.15s;

        &::after {
          content: ' ×';
          font-size: 1rem;
        }
        &[data-role="parent"]::after {
          content: ' /';
          opacity: 0.4;
        }
        &:hover {
          color: var(--text-colour);
        }
      }
    }

    .triggers {
      display: flex;
      gap: 2rem;

      @media (max-width: 640px) {
        order: 1;
        gap: 1rem;
        font-size: 0.8rem;
      }

      span[data-group] {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        cursor: pointer;
        transition: color 0.15s;

        &:hover, &.is-active {
          color: var(--text-colour);
          .label { color: inherit; }
          .selected { color: var(--text-muted-colour); }
        }

        .selected {
          color: var(--text-muted-colour);
          text-transform: none;
          letter-spacing: 0;
        }

        .chevron {
          width: 8px;
          height: 8px;
          border-right: 1px solid currentColor;
          border-bottom: 1px solid currentColor;
          transform: rotate(45deg) translate(-1px, -1px);
          transition: transform 0.2s ease;
          flex-shrink: 0;

          @media (max-width: 640px) {
            width: 6px;
            height: 6px;
          }
        }

        &.is-active .chevron {
          transform: rotate(225deg) translate(-1px, -1px);
        }

        .clear {
          background: none;
          border: none;
          color: var(--text-muted-colour);
          font: inherit;
          font-size: 0.9rem;
          cursor: pointer;
          padding: 0;
          line-height: 1;
          &:hover { color: var(--text-colour); }
        }
      }
    }

    .panel {
      display: none;
      width: 100%;
      margin-top: -0.5rem;

      @media (max-width: 640px) {
        order: 3;
      }

      @media (min-width: 640px) {
        margin-top: -0.5rem;
      }

      &[open] {
        display: block;
      }

      .items {
        display: none;
        /*padding: 0.75rem 0;*/

        &[open] {
          display: block;
        }

        .filter-parents {
          display: flex;
          flex-wrap: wrap;
          justify-content: right;
          gap: 0.5rem 1rem;
        }

        @media (max-width: 640px) {
          &:has(.filter-children.is-open) .filter-parents {
            display: none;
          }
        }

        .filter-children {
          display: none;
          margin-top: 0.5rem;

          &.is-open {
            display: flex;
            flex-wrap: wrap;
            justify-content: right;
            gap: 0.5rem 1rem;
          }
        }

        @media (max-width: 640px) {
          .filter-parents, .filter-children.is-open {
            flex-wrap: nowrap;
            overflow-x: auto;
            justify-content: flex-start;
            scrollbar-width: none;
            mask-image: linear-gradient(to right, black 80%, transparent 100%);
            margin-top: 0;
            gap: 1rem;

            span:last-child {
              padding-right: 5rem;
            }
          }
        }

        span {
          color: var(--text-muted-colour);
          cursor: pointer;
          transition: color 0.15s;
          white-space: nowrap;

          &:hover, &.is-active { color: var(--text-colour); }
        }
      }
    }

    @media (max-width: 640px) {
      .spacer {
        display: none;
      }

      &:has(.active-filters span) .triggers {
        display: none;
      }
    }
  }
}

div.project-hero {
  width: 100%;
  max-width: 2000px;
  max-height: 72vh;
  overflow: hidden;
  margin: 0 auto;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

article.project {
  padding: 2.5rem 0;

  header {
    margin-bottom: 1.75rem;

    h1 {
      font-size: clamp(1.75rem, 3.5vw, 2.75rem);
      font-weight: 700;
    }

    p.project-taxonomy {
      text-align: right;
      color: var(--text-muted-colour);
    }
  }

  div.youtube-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin-bottom: 2rem;

    iframe, .placeholder {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      border: 0;
    }

    .placeholder {
      cursor: pointer;

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }

      .play {
        position: absolute;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
        width: 72px; height: 72px;
        border-radius: 50%;
        border: none;
        background: rgba(0,0,0,0.65);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
        pointer-events: none;

        svg {
          width: 28px; height: 28px;
          fill: #fff;
          margin-left: 4px;
        }
      }

      &:hover .play {
        background: rgba(0,0,0,0.85);
      }
    }
  }

  div.content {
    dl.credits {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem 2rem;
      padding: 1rem 0;

      div {
        min-width: 120px;
      }

      dt {
        font-weight: bold;
        color: var(--text-muted-colour);
        font-size: 0.67rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
      }
      dd {
        margin: 0.1rem 0 0;
        color: var(--text-colour);
      }
    }

    div.description {
      margin: 1rem 0;
    }
  }

  div.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;

    @media (max-width: 900px) {
      grid-template-columns: repeat(3, 1fr);
      gap: 0.7rem;
    }

    @media (max-width: 600px) {
      grid-template-columns: repeat(2, 1fr);
      gap: 0.5rem;
    }

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
  }

  section.bts {
    margin-top: 4rem;
    h2 {
      margin-bottom: 1rem;
    }
  }
}

section.page {
  div.content {
    p {
      margin: 1rem 0;

    }
  }
}

article.contact {
  h2 {
    margin-bottom: 1rem;
  }

  div.contact {
    display: grid;
    grid-template-columns: 20% 1fr;
    gap: 1rem;
    align-items: start;

    div.map {
      width: 100%;
      height: 500px;

      iframe {
        width: 100%;
        height: 100%;
        border: 0;
      }
    }


    div.item {
      margin-bottom: 1.5rem;

      h3 {
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-muted-colour);
        margin-bottom: 0.3rem;
      }

      p {
        line-height: 1.6;
      }

      a {
        &:hover {
          color: var(--text-muted-colour);
        }
      }
    }
  }
}



@media (max-width: 640px) {
  article.contact {
    div.contact {
      grid-template-columns: 1fr;
      gap: 2.5rem;
    }
  }
}

footer {
  border-top: 1px solid var(--border-colour);
  margin-top: 3.5rem;
  padding: 2rem 0 1.5rem;
  color: var(--text-muted-colour);
  font-size: 0.8rem;

  div.grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;

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

    >div {
      list-style: none;
      p {
        margin-bottom: 0.25rem;
        line-height: 1.5;
      }
      a {
        transition: color 0.15s;
        &:hover {
          color: var(--text-colour);
        }
      }

      ul {
        list-style: none;
      }

      &.badges {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 0.75rem 0;

        img, svg {
          height: 50px;
          width: auto;
        }
      }
    }
  }
}

section.hires {
  padding: 2.5rem 0 5rem;

  .weather {
    border-color:#be9a7a;
  }
  .atmospherics {
    border-color:#596b49;
  }
  .liquids {
    border-color:#476d6e;
  }
  .motion {
    border-color:#60543a;
  }
  .fire {
    border-color:#c64647;
  }
  .props {
    border-color:#eb9a7c;
  }

  div.videos {
    aspect-ratio: 16 / 9;
    background: #000;
    margin-bottom: 2.5rem;
    overflow: hidden;
    width: calc(100% + 2 * var(--side-padding));
    margin-left: calc(-1 * var(--side-padding));

    video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
  }

  div.content {
    margin-bottom: 1rem;
  }

  nav.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-bottom: 3rem;
    justify-content: center;

    a {
      transition: color 0.15s;
      border-width: 0 0 1px 0;
      border-style: solid;

      &:hover {
        color: var(--text-colour);
      }
    }
  }

  .category {
    margin-bottom: 4rem;

    h2 {
      font-size: clamp(1.4rem, 3vw, 2rem);
      font-weight: 700;
      letter-spacing: -0.01em;
      padding-bottom: 0.6rem;
      border-bottom: 1px solid var(--border-colour);
      margin-bottom: 1.5rem;
    }

    > div {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 1.25rem;

      @media (max-width: 600px) {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
      }
    }

    article {
      background: #1a1a1a;
      border-radius: 4px;
      overflow: hidden;
      border: 1px solid var(--border-colour);

      .thumb {
        position: relative;
        aspect-ratio: 16 / 9;
        overflow: hidden;
        background: #111;

        a {
          display: block;
          width: 100%;
          height: 100%;
        }

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          display: block;
          background: #bbb;
        }

        iframe {
          width: 100%;
          height: 100%;
          border: 0;
          display: block;
        }

      }

      .info {
        padding: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0.4rem;

        h3 {
          font-size: 0.9rem;
          font-weight: 500;

          a {
            color: var(--text-colour);
            opacity: 0.85;
            transition: opacity 0.15s;

            &:hover { opacity: 1; }
          }
        }

        .specs ul {
          list-style: none;
          display: flex;
          flex-wrap: wrap;

          li {
            font-size: 0.72rem;
            color: var(--text-muted-colour);
            white-space: nowrap;

            &:not(:last-child)::after {
              content: ' · ';
              padding: 0 0.15em;
            }
          }
        }

        .see-in-action {
          margin-top: 0.25rem;
          align-self: flex-start;
          background: none;
          border: 1px solid rgba(255,255,255,0.15);
          color: var(--text-muted-colour);
          font: inherit;
          font-size: 0.72rem;
          letter-spacing: 0.06em;
          text-transform: uppercase;
          padding: 0.3rem 0.65rem;
          border-radius: 2px;
          cursor: pointer;
          transition: color 0.15s, border-color 0.15s;

          &:hover {
            color: var(--text-colour);
            border-color: rgba(255,255,255,0.4);
          }
        }
      }
    }
  }
}

#video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;

  &.is-open {
    display: flex;
  }

  .backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    cursor: pointer;
  }

  .inner {
    position: relative;
    width: min(900px, 95vw);
    z-index: 1;
  }

  .close {
    position: absolute;
    top: -2.25rem;
    right: 0;
    background: none;
    border: none;
    color: var(--text-colour);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;

    &:hover { opacity: 1; }
  }

  .video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;

    iframe {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
    }
  }
}

article.hire {
  padding: 2.5rem 0 5rem;

  nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    margin-bottom: 1.25rem;

    a {
      color: inherit;
      transition: color 0.15s;

      &:hover { color: var(--text-colour); }
    }
  }

  h1 {
    font-size: clamp(1.75rem, 3.5vw, 2.75rem);
    font-weight: 700;
    margin-bottom: 2rem;
  }

  .video {
    margin-bottom: 2rem;

    .video-wrap {
      position: relative;
      padding-bottom: 56.25%;
      height: 0;
      overflow: hidden;

      iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
      }
    }
  }

  .bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;

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

    > img {
      width: 100%;
      display: block;
    }

    .specs {
      p {
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: var(--text-muted-colour);
        margin-bottom: 1rem;
      }

      ul {
        list-style: none;
        border-top: 1px solid var(--border-colour);

        li {
          font-size: 0.95rem;
          line-height: 1.5;
          padding: 0.65rem 0;
          border-bottom: 1px solid rgba(255,255,255,0.06);
        }
      }
    }
  }
}

section.about {
  .team {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin: 2rem 0;
    gap: 1rem;

    @media (max-width: 640px) {
      grid-template-columns: repeat(3, 1fr);
      gap: 0.5rem;
    }

    .person {
      img {
        width: 100%;
        object-fit: cover;
        display: block;
      }

      .name {
        font-size: 0.9rem;
        font-weight: 500;
        margin-top: 0.5rem;
      }

      .title {
        font-size: 0.75rem;
        color: var(--text-muted-colour);
        margin-top: 0.15rem;
      }
    }
  }
}

.spacer {
  flex-grow: 1;
}

.label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted-colour);
}

section.list-page {
  header {
    h1 {
      margin-bottom: 1rem;
    }
  }
}
