:root {
  --color-text: #111111;
  --color-muted: #555555;
  --color-border: #e7e7e7;
  --color-background: #ffffff;
  --site-background: url("../images/backgrounds/website-cover.svg");
  --container-width: 880px;
  --side-margin: clamp(20px, 5vw, 56px);
  --header-height: 92px;
  --header-offset: 48px;
  --text-scale: 1.25;
  --work-column-gap: clamp(24px, 4vw, 44px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding-top: var(--header-offset);
  min-height: 100vh;
  isolation: isolate;
  background: var(--color-background);
  color: var(--color-text);
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}

/* A fixed layer keeps the same cover visible on short and scrolling pages. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--color-background) var(--site-background) center / cover no-repeat;
}

body.modal-open {
  overflow: hidden;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: min(calc(100% - (var(--side-margin) * 2)), var(--container-width));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #ffffff;
  border-bottom: 1px solid transparent;
}

.header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  width: clamp(156px, 22vw, 230px);
}

.site-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(16px, 3vw, 34px);
  font-size: calc(13px * var(--text-scale));
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.site-main {
  flex: 1;
  padding-top: 0;
}

.site-footer {
  display: grid;
  justify-items: center;
  padding-block: 8px 32px;
}

.footer-apple {
  display: block;
  width: max(48px, calc((100% - 2 * var(--work-column-gap)) / 9));
  height: auto;
}

.home-feature {
  min-height: calc(100vh - var(--header-height) - var(--header-offset));
  display: flex;
  align-items: center;
  padding-block: clamp(56px, 10vw, 116px);
}

.featured-work {
  width: 100%;
  margin: 0 auto;
}

.featured-work img,
.work-button img {
  display: block;
  width: 100%;
  height: auto;
}

.work-section,
.text-page {
  padding-block: clamp(48px, 8vw, 88px);
}

.page-title {
  margin: 0 0 36px;
  font-size: calc(18px * var(--text-scale));
  font-weight: 400;
  line-height: 1.3;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(34px, 5vw, 64px) var(--work-column-gap);
  align-items: start;
}

.work-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  text-align: left;
  display: block;
  min-width: 0;
}

.work-button:focus-visible {
  outline: 1px solid var(--color-text);
  outline-offset: 6px;
}

.text-page {
  max-width: 720px;
  font-size: calc(1em * var(--text-scale));
}

.text-page p {
  margin: 0 0 1.25rem;
}

.text-page a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.fallback-message {
  color: var(--color-muted);
}

.modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  align-items: center;
  justify-content: center;
  padding: 60px clamp(16px, 4vw, 48px) 24px;
  background: rgba(255, 255, 255, 0.96);
}

.modal[open] {
  display: flex;
}

.modal::backdrop {
  background: rgba(255, 255, 255, 0.96);
}

.modal-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-close {
  position: fixed;
  top: 18px;
  right: var(--side-margin);
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.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;
}

@media (max-width: 640px) {
  :root {
    --header-height: 68px;
    --work-column-gap: 12px;
  }

  body {
    font-size: 13px;
  }

  .header-inner {
    gap: 14px;
    flex-wrap: wrap;
  }

  .site-logo {
    width: clamp(124px, 36vw, 154px);
  }

  .site-nav {
    gap: 14px;
    margin-left: auto;
    font-size: calc(12px * var(--text-scale));
  }

  .home-feature {
    align-items: flex-start;
    padding-block: 38px 56px;
  }

  .work-grid {
    gap: 20px var(--work-column-gap);
  }
}

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