:root {
  --text-dark: #363636;
  --text-muted: #555555;
  --bg: #f6f7f9;
  --pill-bg: rgba(54, 54, 54, 0.07);
  --hover-tint: #E6EFFA;
  --heading-font: 'Cal Sans', Helvetica, Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --body-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-dark);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
  display: block;
}

/* Header — fixed on top of everything, transparent so the background
   image shows through it */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
  padding: 24px 38px 0;
}

.nav-container {
  display: flex;
  gap: 28px;
}

.nav-link {
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-dark);
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 0.8;
}

.nav-link.active {
  opacity: 1;
}

/* Masthead — fixed full-viewport background layer. It stays pinned behind
   everything; the opaque .site-wrap below slides up and covers it as the
   page scrolls. */

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  background-color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 38px;
}

/* Background image lives on a pseudo-element, oversized by a few percent,
   so it has room to drift via `transform` without ever revealing an edge.
   Transform-only animation is GPU-composited — it doesn't trigger layout
   or repaint on every frame, so it's effectively free performance-wise. */
.masthead:before {
  content: "";
  position: absolute;
  inset: -18%;
  background-image: url("images/masthead-bg.jpg");
  background-size: cover;
  background-position: top left;
  background-repeat: no-repeat;
}

.masthead--animated:before {
  animation: masthead-drift 20s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes masthead-drift {
  0% {
    transform: scale(1) translate(0, 0);
  }
  100% {
    transform: scale(1.12) translate(-3.5%, -2.5%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .masthead--animated:before {
    animation: none;
  }
}

.masthead-placeholder {
  height: 100vh;
}

.masthead-contents {
  position: relative;
  z-index: 1;
  max-width: 700px;
  width: 100%;
  text-align: left;
}

.masthead h1 {
  font-family: var(--heading-font);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-dark);
  margin: 0 0 24px;
}

.masthead p {
  font-family: var(--body-font);
  font-size: 30px;
  line-height: 1.4;
  color: var(--text-dark);
  margin: 0 0 32px;
  max-width: 700px;
}

.social {
  display: flex;
  gap: 12px;
}

.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--pill-bg);
  transition: background 0.2s ease;
}

.social a:hover {
  background: rgba(54, 54, 54, 0.14);
}

.social .icon {
  width: 18px;
  height: 18px;
  fill: var(--text-dark);
}

/* Opaque content layer that scrolls over the fixed masthead */

.site-wrap {
  position: relative;
  z-index: 1;
  background: var(--bg);
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 38px;
}

/* Project grid */

.project-covers {
  display: flex;
  flex-wrap: wrap;
  padding: 48px 0 0;
}

.project-cover {
  width: 50%;
  display: block;
}

.cover-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3.1;
  overflow: hidden;
  background: #e7e9ed;
}

.cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease;
}

.project-cover:hover .cover-image img {
  filter: grayscale(100%);
}

/* Flat color tint that covers the image on hover */
.cover-tint {
  position: absolute;
  inset: 0;
  background-color: var(--hover-tint);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.project-cover:hover .cover-tint {
  opacity: 0.9;
}

/* Title overlay — hidden by default, fades in over the flat color on hover */
.details-wrap {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.project-cover:hover .details-wrap {
  opacity: 1;
}

.details {
  display: flex;
  align-items: flex-end;
  height: 100%;
  width: 100%;
}

.details-inner {
  padding: 0 10% 8% 8%;
}

.title {
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-dark);
}

/* About page */

.about-grid {
  display: flex;
  gap: 64px;
  align-items: flex-start;
  padding: 48px 0 0;
}

.about-photo {
  flex: 0 0 280px;
  width: 280px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #e7e9ed;
}

.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-text {
  flex: 1;
  max-width: 460px;
  padding-top: 8px;
}

.about-text p {
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.about-text .contact-line {
  margin-top: 32px;
  color: var(--text-muted);
}

.about-text .contact-line strong {
  color: var(--text-dark);
  font-weight: 700;
}

.about-text .contact-line a {
  color: var(--text-muted);
  text-decoration: underline;
}

/* Contact page */

.contact-section {
  padding: 48px 0 0;
  max-width: 500px;
}

.contact-intro {
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 40px;
}

.contact-intro strong {
  color: var(--text-dark);
  font-weight: 700;
}

.contact-intro a {
  color: var(--text-muted);
  text-decoration: underline;
}

.contact-form {
  display: flex;
  flex-direction: column;
}

.form-input {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.form-input label {
  font-family: var(--body-font);
  font-size: 14px;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.form-input input,
.form-input textarea {
  font-family: var(--body-font);
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg);
  border: 1px solid #a0a0a0;
  border-radius: 3px;
  padding: 12px 10px;
  outline: none;
}

.form-input input:focus,
.form-input textarea:focus {
  border-color: var(--text-dark);
}

.form-input textarea {
  min-height: 110px;
  resize: vertical;
  font-family: var(--body-font);
}

.submit-button {
  align-self: flex-start;
  height: 40px;
  padding: 0 30px;
  border: none;
  border-radius: 3px;
  background: var(--hover-tint);
  color: var(--text-dark);
  font-family: var(--heading-font);
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s ease;
}

.submit-button:hover {
  background: #d5e4f6;
}

/* Project case-study page */

.project-meta {
  font-family: var(--body-font);
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-muted);
  padding: 48px 0 0;
}

.project-body {
  padding-top: 32px;
}

.project-heading {
  font-family: var(--heading-font);
  font-size: 25px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 48px 0 16px;
}

.project-subheading {
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 40px 0 16px;
}

.project-body > p:first-child,
.project-heading + p,
.project-subheading + p {
  margin-top: 0;
}

.project-body p {
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.project-list {
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 20px;
  padding-left: 0;
}

.project-list li {
  list-style: none;
  padding-left: 18px;
  position: relative;
}

.project-list li:before {
  content: "•";
  position: absolute;
  left: 0;
}

.project-image {
  margin: 40px 0;
}

.project-image img {
  width: 100%;
  height: auto;
  background: #e7e9ed;
}

.project-image img,
.project-row-item img {
  cursor: zoom-in;
}

.project-caption {
  font-family: var(--body-font);
  font-size: 14px;
  color: var(--text-muted);
  margin: 12px 0 0;
}

.project-body strong {
  color: var(--text-dark);
  font-weight: 700;
}

/* Embedded motion/video content (Lottie, Vimeo, etc.) */

.project-embed {
  margin: 40px 0;
}

.project-embed-ratio {
  position: relative;
  height: 0;
  overflow: hidden;
  background: #e7e9ed;
}

.project-embed-ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-embed .project-caption {
  text-align: center;
  margin-top: 12px;
}

/* Row of images with individual captions (media collection) */

.project-row {
  display: flex;
  gap: 16px;
  margin: 40px 0;
}

.project-row-item {
  flex: 1;
  min-width: 0;
}

.project-row-item img {
  width: 100%;
  height: auto;
  display: block;
  background: #e7e9ed;
}

.project-row-item .project-caption {
  margin-top: 8px;
}

/* Continue exploring — related projects */

.other-projects {
  padding: 80px 0 0;
}

.other-projects-title {
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-dark);
  margin: 0 0 40px;
}

.other-projects .project-cover {
  width: 33.333%;
}

/* Back to top */

.back-to-top {
  text-align: center;
  padding: 80px 0 40px;
}

.back-to-top a {
  font-family: var(--heading-font);
  font-size: 14px;
  font-weight: 400;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.back-to-top a:hover {
  opacity: 0.85;
}

/* Footer */

.site-footer {
  padding: 60px 38px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.site-footer .social {
  justify-content: center;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* Lightbox — full-size image viewer with prev/next navigation,
   matching the original site's click-to-enlarge gallery behavior. */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.is-open {
  display: flex;
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
  background: none;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.lightbox-close {
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: #fff;
  color: var(--text-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 18px;
  line-height: 1;
}

.lightbox-close:hover {
  background: #eee;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(105, 105, 105, 0.85);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--text-dark);
}

/* Responsive */

@media (max-width: 640px) {
  .masthead {
    padding: 0 24px;
  }
  .nav-link {
    font-size: 16px;
  }
  .masthead h1 {
    font-size: 34px;
  }
  .masthead p {
    font-size: 18px;
  }
  main {
    padding: 0 24px;
  }
  .project-cover {
    width: 100%;
  }
  .site-header {
    padding: 20px 24px 0;
  }
  .about-grid {
    flex-direction: column;
    gap: 32px;
  }
  .about-photo {
    width: 200px;
    flex: 0 0 200px;
  }
  .about-text {
    max-width: 100%;
  }
  .contact-section {
    max-width: 100%;
  }
  .project-heading {
    font-size: 21px;
  }
  .project-subheading {
    font-size: 18px;
  }
  .project-body p,
  .project-list {
    font-size: 16px;
  }
  .other-projects .project-cover {
    width: 100%;
  }
  .project-row {
    flex-direction: column;
  }
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .lightbox-prev {
    left: 10px;
  }
  .lightbox-next {
    right: 10px;
  }
  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}
