@layer reset, tokens, base, layout, components, cms;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    hanging-punctuation: first last;
    interpolate-size: allow-keywords;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  ul,
  ol,
  dl,
  dd,
  address {
    margin: 0;
  }

  ul,
  ol {
    padding: 0;
    list-style: none;
  }

  img,
  svg,
  iframe,
  video {
    display: block;
    max-width: 100%;
  }

  img {
    height: auto;
  }

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

  table {
    border-collapse: collapse;
    width: 100%;
  }

  button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  a {
    color: inherit;
  }
}

@layer tokens {
  :root {
    color-scheme: light;
    --paper: #f3efe7;
    --paper-2: #e7e0d3;
    --ink: #1c1917;
    --ink-soft: #3f3a34;
    --muted: #6f6a62;
    --forest: #2c4a3c;
    --forest-deep: #1e3329;
    --hero-fg: #f3efe7;
    --line: color-mix(in oklab, var(--ink) 12%, transparent);
    --line-strong: color-mix(in oklab, var(--ink) 22%, transparent);
    --shadow: 0 18px 40px color-mix(in oklab, var(--ink) 14%, transparent);

    --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;

    --text-xs: 0.75rem;
    --text-sm: 0.9375rem;
    --text-base: 1.0625rem;
    --text-lg: 1.25rem;
    --text-xl: clamp(1.5rem, 1.1rem + 1.2vw, 2rem);
    --text-2xl: clamp(2rem, 1.2rem + 2.4vw, 3.25rem);
    --text-display: clamp(2.6rem, 1.1rem + 5.5vw, 5.4rem);

    --leading-tight: 1.08;
    --leading-snug: 1.25;
    --leading-body: 1.6;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;
    --space-9: 7rem;
    --space-10: 9rem;

    --wrap: 74rem;
    --wrap-narrow: 40rem;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);
    --header-h: 4.5rem;

    --radius-sm: 0.4rem;
    --radius-md: 0.85rem;
    --radius-lg: 1.35rem;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --motion-fast: 180ms;
    --motion-med: 320ms;
  }
}

@layer base {
  html {
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
  }

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

  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    min-height: 100svh;
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: var(--leading-tight);
    letter-spacing: -0.03em;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--text-display);
    font-variation-settings: "opsz" 72;
  }

  h2 {
    font-size: var(--text-2xl);
    font-variation-settings: "opsz" 48;
  }

  h3 {
    font-size: var(--text-xl);
    font-variation-settings: "opsz" 36;
  }

  p,
  li,
  td,
  th,
  address {
    text-wrap: pretty;
  }

  p + p,
  p + blockquote,
  blockquote + p,
  p + figure,
  figure + p,
  p + table,
  table + p,
  p + address,
  address + p {
    margin-top: 1.1em;
  }

  a:not(.button):not(.logo) {
    text-underline-offset: 0.18em;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in oklab, currentColor 45%, transparent);
  }

  a:not(.button):not(.logo):hover {
    text-decoration-color: currentColor;
  }

  :focus-visible {
    outline: 2px solid var(--forest);
    outline-offset: 3px;
  }

  ::selection {
    background: color-mix(in oklab, var(--forest) 28%, var(--paper));
    color: var(--ink);
  }

  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: absolute;
    left: var(--gutter);
    top: 0.75rem;
    z-index: 20;
    padding: 0.6rem 0.9rem;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transform: translateY(-150%);
  }

  .skip-link:focus {
    transform: none;
  }
}

@layer layout {
  .wrap {
    width: min(100% - var(--gutter) * 2, var(--wrap));
    margin-inline: auto;
  }

  .wrap-narrow {
    width: min(100% - var(--gutter) * 2, var(--wrap-narrow));
    margin-inline: auto;
  }

  .section-head {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-7);

    & h2 {
      max-width: 16ch;
    }
  }

  #work,
  #approach,
  #studio,
  #visit,
  #gallery,
  #main {
    scroll-margin-top: calc(var(--header-h) + 0.75rem);
  }
}

@layer components {
  .eyebrow {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.3;
  }

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.7rem 1.15rem;
    border: 1px solid var(--forest);
    border-radius: 999px;
    background: var(--forest);
    color: var(--paper);
    font-weight: 500;
    font-size: var(--text-sm);
    text-decoration: none;
    transition:
      background-color var(--motion-fast) var(--ease),
      color var(--motion-fast) var(--ease),
      transform var(--motion-fast) var(--ease);

    &:hover {
      background: var(--forest-deep);
    }

    &:active {
      transform: scale(0.98);
    }
  }

  .button--small {
    min-height: 2.4rem;
    padding-inline: 1rem;
  }

  .button--on-dark {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--paper);

    &:hover {
      background: color-mix(in oklab, var(--paper) 88%, white);
    }
  }

  .text-link {
    display: inline-flex;
    margin-top: var(--space-5);
    font-weight: 500;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 8;
    height: var(--header-h);
    background: color-mix(in oklab, var(--paper) 88%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);

    @supports (background: color-mix(in oklab, black 50%, white)) {
      background: color-mix(in oklab, var(--paper) 82%, transparent);
    }
  }

  .site-header.is-scrolled {
    box-shadow: 0 1px 0 var(--line);
  }

  .site-header__inner {
    width: min(100% - var(--gutter) * 2, var(--wrap));
    margin-inline: auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-4);
  }

  .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    text-decoration: none;
    margin-right: auto;
  }

  .logo__mark {
    width: 1.55rem;
    height: 1.55rem;
    fill: var(--forest);
    stroke: var(--forest);
    stroke-width: 1.4;
    stroke-linecap: round;
  }

  .site-nav ul {
    display: flex;
    gap: 1.35rem;
  }

  .site-nav a {
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--ink-soft);

    &:hover {
      color: var(--ink);
    }
  }

  .nav-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: var(--radius-sm);
  }

  .nav-toggle__bars {
    display: block;
    width: 1.15rem;
    height: 1.5px;
    background: var(--ink);
    position: relative;

    &::before,
    &::after {
      content: "";
      position: absolute;
      inset-inline: 0;
      height: 1.5px;
      background: var(--ink);
    }

    &::before {
      top: -5px;
    }
    &::after {
      top: 5px;
    }
  }

  .hero {
    min-height: calc(100svh - var(--header-h));
    background-size: cover;
    background-position: center;
    color: var(--hero-fg);
    display: grid;
    align-items: end;
    padding: var(--space-8) var(--gutter) var(--space-8);
    position: relative;
    isolation: isolate;

    &::before {
      content: "";
      position: absolute;
      inset: 0;
      background:
        linear-gradient(
          180deg,
          color-mix(in oklab, var(--forest-deep) 18%, transparent) 0%,
          color-mix(in oklab, var(--forest-deep) 72%, transparent) 100%
        );
      z-index: -1;
    }
  }

  .hero__content {
    width: min(100%, 42rem);

    & h1 em {
      font-style: italic;
      font-weight: 400;
    }
  }

  .hero .eyebrow {
    color: color-mix(in oklab, var(--hero-fg) 72%, transparent);
    margin-bottom: var(--space-4);
  }

  .hero__lede {
    margin-top: var(--space-5);
    max-width: 36ch;
    font-size: var(--text-lg);
    line-height: var(--leading-snug);
    color: color-mix(in oklab, var(--hero-fg) 88%, transparent);
  }

  .hero .button {
    margin-top: var(--space-6);
  }

  .intro {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-7);
    padding-block: var(--space-9);
    align-items: start;

    @media (min-width: 860px) {
      grid-template-columns: 1.1fr 0.9fr;
      gap: var(--space-8);
      align-items: center;
    }
  }

  .intro__copy {
    max-width: 38rem;

    & h2 {
      margin-block: var(--space-3) var(--space-5);
    }
  }

  .intro__figure img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: var(--radius-lg);
  }

  blockquote {
    border-left: 2px solid var(--forest);
    padding: 0.15rem 0 0.15rem 1.15rem;
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-style: italic;
    line-height: var(--leading-snug);
    color: var(--ink-soft);

    & footer {
      margin-top: 0.7rem;
      font-family: var(--font-body);
      font-size: var(--text-sm);
      font-style: normal;
      color: var(--muted);
    }
  }

  .featured {
    padding-bottom: var(--space-9);
  }

  .featured__media img {
    width: 100%;
    max-height: 78vh;
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }

  .featured__body {
    padding-top: var(--space-7);

    & h2 {
      margin-block: var(--space-3) var(--space-5);
    }
  }

  figure.image {
    margin-top: var(--space-6);

    & img {
      width: 100%;
      border-radius: calc(var(--radius-lg) - 4px);
      aspect-ratio: 3 / 2;
      object-fit: cover;
    }

    & figcaption {
      margin-top: var(--space-3);
      font-size: var(--text-sm);
      color: var(--muted);
    }
  }

  .work {
    padding-bottom: var(--space-9);
  }

  .work-grid {
    display: grid;
    gap: var(--space-6);

    @media (min-width: 760px) {
      grid-template-columns: repeat(3, 1fr);
      gap: var(--space-5);
    }
  }

  .work-card {
    display: grid;
    align-content: start;
    gap: var(--space-3);

    & img {
      width: 100%;
      aspect-ratio: 4 / 3;
      object-fit: cover;
      border-radius: var(--radius-md);
    }

    & h3 {
      font-size: 1.45rem;
    }
  }

  .work-card__meta {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: var(--space-2);
  }

  .gallery-section {
    padding-bottom: var(--space-9);
  }

  .gallery {
    width: min(100% - var(--gutter) * 2, var(--wrap));
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;

    @media (min-width: 860px) {
      grid-template-columns: repeat(4, 1fr);
      grid-auto-rows: 11rem;

      & li:nth-child(1) {
        grid-column: span 2;
        grid-row: span 2;
      }

      & li:nth-child(4) {
        grid-column: span 2;
      }
    }

    & a {
      display: block;
      height: 100%;
      text-decoration: none;
    }

    & img {
      width: 100%;
      height: 100%;
      aspect-ratio: 5 / 4;
      object-fit: cover;
      border-radius: var(--radius-sm);
      transition: transform var(--motion-med) var(--ease);
    }

    @media (min-width: 860px) {
      & li:nth-child(1) img,
      & li:nth-child(4) img {
        aspect-ratio: auto;
      }
    }

    & a:hover img {
      transform: scale(1.02);
    }
  }

  .approach {
    padding-bottom: var(--space-9);
  }

  .steps {
    display: grid;
    gap: var(--space-6);
    border-top: 1px solid var(--line);
    padding-top: var(--space-7);

    @media (min-width: 800px) {
      grid-template-columns: repeat(3, 1fr);
      gap: var(--space-7);
    }
  }

  .step {
    display: grid;
    align-content: start;
    gap: var(--space-3);
  }

  .step__num {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 400;
    letter-spacing: -0.04em;
    color: var(--forest);
    line-height: 1;
  }

  .film {
    display: grid;
    gap: var(--space-6);
    padding-bottom: var(--space-9);

    @media (min-width: 880px) {
      grid-template-columns: 0.8fr 1.2fr;
      align-items: center;
      gap: var(--space-8);
    }
  }

  .film__copy h2 {
    margin-block: var(--space-3) var(--space-5);
  }

  .film__frame {
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--forest-deep);
    box-shadow: var(--shadow);
  }

  .people {
    padding-bottom: var(--space-9);
  }

  .people-grid {
    display: grid;
    gap: var(--space-7);

    @media (min-width: 760px) {
      grid-template-columns: 1fr 1fr;
      gap: var(--space-8);
    }
  }

  .person {
    display: grid;
    align-content: start;
    gap: var(--space-3);

    & img {
      width: 100%;
      max-width: 22rem;
      aspect-ratio: 4 / 5;
      object-fit: cover;
      border-radius: var(--radius-lg);
    }

    & h3 {
      margin-top: var(--space-3);
    }
  }

  .person__role {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--forest);
    letter-spacing: 0.04em;
  }

  .visit {
    display: grid;
    background: var(--paper-2);

    @media (min-width: 880px) {
      grid-template-columns: 1.05fr 0.95fr;
      min-height: 36rem;
    }
  }

  .visit__image img {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;

    @media (min-width: 880px) {
      aspect-ratio: auto;
      min-height: 36rem;
    }
  }

  .visit__panel {
    padding: var(--space-8) var(--gutter);
    display: grid;
    align-content: center;
    gap: var(--space-4);
    max-width: 36rem;

    & h2 {
      margin: 0;
    }

    & address {
      font-style: normal;
      font-weight: 500;
    }

    & table {
      margin-top: 1.25rem;
      font-size: var(--text-sm);
    }

    & th,
    & td {
      padding: 0.7rem 0;
      border-top: 1px solid var(--line);
      text-align: left;
      vertical-align: top;
    }

    & th {
      font-weight: 600;
      width: 8.5rem;
      color: var(--ink-soft);
    }
  }

  .visit__contact {
    margin-top: var(--space-4);
    font-weight: 500;
  }

  .site-footer {
    background: var(--forest-deep);
    color: color-mix(in oklab, var(--paper) 88%, white);
    padding-block: var(--space-8);
  }

  .site-footer__inner {
    display: grid;
    gap: var(--space-6);

    @media (min-width: 760px) {
      grid-template-columns: 1.4fr 0.8fr;
      align-items: end;
    }

    & a {
      color: inherit;
    }

    & small {
      color: color-mix(in oklab, var(--paper) 70%, white);
    }
  }

  .footer-credit {
    font-size: var(--text-sm);
    color: color-mix(in oklab, var(--paper) 62%, white);
  }

  .lightbox {
    width: min(92vw, 64rem);
    max-height: 92svh;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--paper);

    &::backdrop {
      background: color-mix(in oklab, var(--ink) 82%, transparent);
    }

    & img {
      width: 100%;
      max-height: 78svh;
      object-fit: contain;
      border-radius: var(--radius-md);
      margin-inline: auto;
    }
  }

  .lightbox__close {
    position: absolute;
    top: -2.4rem;
    right: 0;
    color: var(--paper);
    font-size: var(--text-sm);
    font-weight: 500;
  }

  .lightbox__caption {
    margin-top: var(--space-3);
    text-align: center;
    font-size: var(--text-sm);
  }

  @media (max-width: 759px) {
    .nav-toggle {
      display: grid;
      order: 3;
    }

    .site-header__inner .button {
      display: none;
    }

    .site-nav {
      position: absolute;
      inset: var(--header-h) var(--gutter) auto;
      background: var(--paper);
      border: 1px solid var(--line);
      border-radius: var(--radius-md);
      padding: 0.75rem;
      display: none;
      box-shadow: var(--shadow);

      & ul {
        flex-direction: column;
        gap: 0;
      }

      & a {
        display: flex;
        min-height: 2.75rem;
        align-items: center;
        padding-inline: 0.65rem;
        border-radius: var(--radius-sm);
      }
    }

    .site-header.is-open .site-nav {
      display: block;
    }
  }

  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .intro__copy,
      .featured__body,
      .work-card,
      .step,
      .person,
      .film__copy {
        animation: reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 28%;
      }
    }
  }

  @keyframes reveal {
    from {
      opacity: 0.35;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .gallery img,
    .button {
      transition: none;
    }

    .gallery a:hover img {
      transform: none;
    }
  }
}

@layer cms {
  html.is-cms {
    .nav-toggle {
      display: none;
    }

    .site-nav {
      display: block;
      position: static;
      border: 0;
      box-shadow: none;
      padding: 0;
      background: transparent;

      & ul {
        flex-direction: row;
        flex-wrap: wrap;
      }
    }

    .lightbox {
      display: none !important;
    }

    .gallery img {
      transform: none !important;
    }
  }
}
