html {
  /* In-page nav scroll is handled in js/smooth-scroll.js for cross-browser consistency */
  scroll-behavior: auto;
}

/* Home ↔ project page fade (js/page-transition.js) */
html.is-page-entering,
html.is-page-leaving {
  opacity: 0;
}

html.is-page-visible {
  opacity: 1;
  transition: opacity 320ms ease;
}

html.is-page-leaving {
  transition: opacity 280ms ease;
}

@media (prefers-reduced-motion: reduce) {
  html.is-page-entering,
  html.is-page-leaving {
    opacity: 1;
    transition: none;
  }

  html.is-page-visible {
    transition: none;
  }
}

body {
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-regular);
  color: var(--Foundation-Black);
  background: linear-gradient(180deg, var(--Foundation-White) 0%, var(--Lime-50) 100%);
  overflow-x: clip;
}

#hero {
  padding: var(--Scale-1500) var(--page-gutter-inline) 0;
  margin-bottom: var(--Scale-1700);
  box-sizing: border-box;
}

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

/* Full-bleed name: in document flow so it scrolls away; edge-to-edge via viewport width trick */
.hero-wordmark {
  display: block;
  width: 100vw;
  max-width: none;
  height: auto;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  transform: translateY(-2px);
}

.hero-wordmark--stacked {
  display: none;
}

/* Sticks 16px below top of viewport once the name has scrolled past */
.hero-nav {
  position: sticky;
  top: var(--Scale-400);
  z-index: 20;
  display: flex;
  justify-content: flex-start;
  gap: var(--Scale-200);
  margin-block: var(--Scale-1000);
  margin-inline: var(--page-gutter-inline) 0;
  padding: 0;
  flex-shrink: 0;
}

.hero-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: var(--Scale-200) var(--Scale-400);
}

a,
a:hover,
a:visited,
a:active,
a:focus,
a:focus-visible {
  text-decoration: none;
  color: inherit;
}

.back-to-top {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  position: fixed;
  right: var(--page-gutter-inline);
  bottom: 240px;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(16px);
  cursor: pointer;
}

.back-to-top.is-visible {
  pointer-events: auto;
}

.back-to-top:focus-visible {
  outline: 2px solid var(--Foundation-Black);
  outline-offset: 2px;
}

.back-to-top-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.contact-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: var(--Scale-600);
  /* rgba fallback for Safari 12 (no color-mix) */
  background-color: rgba(0, 0, 0, 0.3);
  background-color: color-mix(in srgb, var(--Foundation-Black) 30%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.contact-overlay[hidden] {
  display: none;
}

.contact-overlay-dialog {
  position: relative;
  width: min(100%, 640px);
  background: linear-gradient(180deg, var(--Foundation-White) 0%, var(--Lime-50) 100%);
  border: 1px solid var(--Warm-Grey-200);
  border-radius: var(--Scale-400);
  padding: var(--Scale-1000);
}

.contact-overlay-close {
  position: absolute;
  top: var(--Scale-400);
  right: var(--Scale-400);
  box-sizing: border-box;
  width: var(--Scale-1000);
  height: var(--Scale-1000);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--Lime-500);
  border-radius: var(--Scale-1900);
  background-color: var(--Foundation-White);
  padding: 0;
  line-height: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 400ms ease-in-out;
}

.contact-overlay-close:hover {
  background-color: var(--Lime-500);
}

.contact-overlay-close-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.contact-overlay-title {
  margin: 0 0 var(--Scale-700);
  padding-right: var(--Scale-1200);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Headings-Contact-title-text-size);
  line-height: var(--Font-Headings-Contact-title-line-height);
  font-weight: var(--font-weight-regular);
  color: var(--Foundation-Black);
}

.contact-overlay-form {
  display: grid;
  gap: var(--Scale-400);
}

.contact-overlay-field {
  display: grid;
  gap: var(--Scale-100);
}

.contact-overlay-label {
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Paragraph-text-size);
  line-height: var(--Font-Body-Paragraph-line-height);
  color: var(--Foundation-Black);
}

.contact-overlay-input,
.contact-overlay-textarea {
  width: 100%;
  border: 1px solid var(--Warm-Grey-300);
  border-radius: var(--Scale-200);
  background-color: var(--Foundation-White);
  color: var(--Foundation-Black);
  padding: var(--Scale-300) var(--Scale-400);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Paragraph-text-size);
  line-height: var(--Font-Body-Paragraph-line-height);
}

.contact-overlay-textarea {
  resize: vertical;
}

.contact-overlay-status {
  margin: 0;
  min-height: 1.25em;
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Caption-text-size);
  line-height: var(--Font-Body-Caption-line-height);
}

.contact-overlay-status.is-success {
  color: var(--Lime-800);
}

.contact-overlay-status.is-error {
  color: var(--Rosso-Corsa-700);
}

.contact-overlay-send:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.contact-overlay-send {
  margin-top: var(--Scale-300);
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--Scale-200) var(--Scale-400);
  cursor: pointer;
}

.contact-overlay-close:focus-visible {
  outline: 2px solid var(--Foundation-Black);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .contact-overlay-close {
    transition: none;
  }
}

.contact-overlay-send:focus-visible,
.contact-overlay-input:focus-visible,
.contact-overlay-textarea:focus-visible {
  outline: 2px solid var(--Lime-500);
  outline-offset: 2px;
}

/* Contact form: below 768px, ease outer + inner padding for narrower viewports */
@media (max-width: 767px) {
  .contact-overlay {
    padding: var(--Scale-400);
  }

  .contact-overlay-dialog {
    padding: var(--Scale-600);
  }
}

@media (max-width: 390px) {
  .contact-overlay-dialog {
    padding: var(--Scale-500);
  }

  .contact-overlay-title {
    margin-bottom: var(--Scale-500);
  }
}

.hero-heading {
  margin: 0;
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Home-hero-text-size);
  line-height: var(--Font-Body-Home-hero-line-height);
  font-weight: var(--font-weight-light);
  color: var(--Foundation-Black);
}

.hero-heading-line--lead {
  font-weight: var(--font-weight-semibold);
}

/* Figma hero text fill (node 393:18167): radial mint → teal → blue */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-heading {
    background-image: radial-gradient(
      120.41% 249.89% at 18.35% 85.32%,
      rgb(46 209 137) 0%,
      rgb(38 180 177) 50%,
      rgb(30 151 217) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

#work {
  color: var(--Foundation-Black);
  padding: 0 var(--page-gutter-inline) var(--Scale-1700);
  /* Anchor landings: sticky nav top + pill row + 40px gap */
  scroll-margin-top: var(--Scale-1600);
}

.content-section {
  min-height: 420px;
  min-width: 0;
  max-width: 100%;
  padding: var(--Scale-1100) var(--page-gutter-inline);
}

.section-container {
  width: min(100%, 1728px);
  margin: 0 auto;
}

#work .section-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--Scale-1500);
  border-top: 1px solid var(--Lime-500);
  padding-top: var(--Scale-1000);
}

.section-tone-light {
  background-color: transparent;
}

.section-tone-dark {
  background-color: transparent;
}

.work-heading {
  color: var(--Foundation-Black);
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-regular);
  font-size: var(--Font-Headings-Hero-text-size);
  line-height: var(--Font-Headings-Hero-line-height);
  text-align: left;
  margin-bottom: var(--Scale-600);
}

.work-section-block {
  display: flex;
  flex-direction: column;
  gap: var(--Scale-1000);
  width: 100%;
}

.work-section-heading {
  margin: 0;
  color: var(--Foundation-Black);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Headings-Section-text-size);
  font-weight: var(--font-weight-regular);
  line-height: var(--Font-Headings-Section-line-height);
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--Scale-600);
  width: 100%;
}

/* Selected Projects: 1 → 2 @ 640px → 3 @ 1024px */
@media (min-width: 640px) {
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: var(--Scale-600);
}

.work-card-large {
  width: 100%;
  min-width: 0;
  cursor: pointer; /* cards are / will be clickable project entry points */
}

.work-card-image {
  width: 100%;
  display: block;
  object-fit: cover;
}

.work-card-media {
  border: 1px solid var(--Warm-Grey-100);
  border-radius: var(--Scale-600);
  overflow: hidden;
  box-shadow: 0 0 0 0 var(--Lime-300);
  transition: box-shadow 220ms ease;
}

.work-card-image-large {
  aspect-ratio: 394 / 300;
  transform: scale(1);
  transform-origin: center;
  transition: transform 220ms ease;
}

.work-card-image-fallback {
  display: none;
}

.work-card-media.is-static-fallback video {
  display: none;
}

.work-card-media.is-static-fallback .work-card-image-fallback {
  display: block;
}

.work-card-title {
  margin: 0;
  color: var(--Foundation-Black);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Headings-Card-title-text-size);
  font-weight: var(--font-weight-regular);
  line-height: var(--Font-Headings-Card-title-line-height);
}

.work-card-text {
  display: flex;
  flex-direction: column;
  gap: var(--Scale-200);
}

.work-card-description {
  margin: 0;
  color: var(--Warm-Grey-700);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Paragraph-text-size);
  font-weight: var(--font-weight-regular);
  line-height: var(--Font-Body-Paragraph-line-height);
  max-width: 340px;
}

.work-card-large:hover .work-card-media {
  box-shadow: var(--Scale-200) var(--Scale-200) 0 0 var(--Lime-300);
}

.work-card-large:hover .work-card-image-large {
  transform: scale(1.05);
}

.playground-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--Scale-400);
  width: 100%;
}

.playground-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  border: 1px solid var(--Warm-Grey-100);
  border-radius: var(--Scale-600);
  overflow: hidden;
  text-decoration: none;
  aspect-ratio: 316.8 / 200;
}

.playground-card:focus-visible {
  outline: 2px solid var(--Foundation-Black);
  outline-offset: 2px;
}

/* Temporary fill until curated experimentation thumbnails are added */
.playground-card-image {
  width: 100%;
  min-height: 0;
  display: block;
  background-color: rgb(255 0 255 / 20%); /* #ff00ff @ 20% */
}

@media (min-width: 811px) {
  .playground-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--Scale-400);
  }

  .playground-card {
    height: 200px;
    aspect-ratio: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .work-card-media,
  .work-card-image-large {
    transition: none;
  }

  .work-card-media:has(video[data-loop-pause-ms]) video {
    display: none;
  }

  .work-card-media:has(video[data-loop-pause-ms]) .work-card-image-fallback {
    display: block;
  }
}

.about-positioning-statement {
  width: 100%;
  margin: 0;
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-regular);
  font-size: var(--Font-Body-Intro-text-size);
  line-height: var(--Font-Body-Intro-line-height);
}

.about-positioning-statement-primary {
  color: var(--Warm-Grey-900);
}

.about-positioning-statement-secondary {
  color: var(--Warm-Grey-500);
}

.about-profile-photo {
  display: block;
  margin-top: var(--Scale-1000);
  margin-left: auto;
  width: auto;
  max-width: 100%;
  height: auto;
}

.about-subsection {
  margin-top: var(--Scale-1300);
}

.about-subheading {
  margin: 0 0 var(--Scale-600);
  color: var(--Foundation-Black);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Headings-Card-title-text-size);
  font-weight: var(--font-weight-medium);
  line-height: var(--Font-Headings-Card-title-line-height);
}

.about-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--Scale-500);
}

.about-stat-card {
  min-height: 180px;
  padding: var(--Scale-500);
  background-color: #ff00ff1a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--Scale-300);
}

.about-stat-value {
  margin: 0;
  color: var(--Warm-Grey-900);
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-regular);
  font-size: var(--Font-Headings-Hero-text-size);
  line-height: var(--Font-Headings-Hero-line-height);
}

.about-stat-label {
  margin: 0;
  color: var(--Warm-Grey-700);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Large-text-size);
  line-height: var(--Font-Body-Large-line-height);
}

.about-timeline {
  border-left: 2px solid var(--Warm-Grey-400);
  padding-left: var(--Scale-700);
  display: grid;
  gap: var(--Scale-800);
}

.about-timeline-item {
  display: grid;
  gap: var(--Scale-200);
}

.about-timeline-period {
  margin: 0;
  color: var(--Warm-Grey-600);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Paragraph-text-size);
  line-height: var(--Font-Body-Paragraph-line-height);
}

.about-timeline-title {
  margin: 0;
  color: var(--Warm-Grey-900);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Large-text-size);
  line-height: var(--Font-Body-Large-line-height);
}

.about-companies {
  margin-top: var(--Scale-1000);
  padding: var(--Scale-500);
  background-color: #ff00ff1a;
}

.about-companies-label {
  margin: 0 0 var(--Scale-300);
  color: var(--Warm-Grey-600);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Caption-text-size);
  line-height: var(--Font-Body-Caption-line-height);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.about-companies-list {
  margin: 0;
  color: var(--Warm-Grey-900);
  font-family: var(--font-family-primary);
  font-size: var(--Font-Body-Large-text-size);
  line-height: var(--Font-Body-Large-line-height);
}

@media (max-width: 810px) {
  .hero-nav {
    margin-block: var(--Scale-800);
  }

  #hero {
    padding-top: var(--Scale-1200);
  }

  .hero-heading {
    font-size: var(--Font-Body-Home-hero-text-size);
    line-height: var(--Font-Body-Home-hero-line-height);
  }

  .playground-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .about-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .hero-nav {
    margin-block: var(--Scale-600);
  }

  .hero-heading {
    font-size: var(--Font-Body-Home-hero-text-size);
    line-height: var(--Font-Body-Home-hero-line-height);
    font-weight: var(--font-weight-regular);
  }

  .hero-heading-line--lead {
    font-weight: var(--font-weight-semibold);
  }

  #hero {
    padding-top: var(--Scale-1000);
    margin-bottom: var(--Scale-1300);
  }
}

@media (max-width: 440px) {
  .hero-wordmark--wide {
    display: none;
  }

  .hero-wordmark--stacked {
    display: block;
  }
}

@media (max-width: 390px) {
  .hero-nav {
    margin-block: var(--Scale-600);
  }

  .hero-heading {
    font-size: var(--Font-Body-Home-hero-text-size);
    line-height: var(--Font-Body-Home-hero-line-height);
    font-weight: var(--font-weight-regular);
  }

  .hero-heading-line--lead {
    font-weight: var(--font-weight-semibold);
  }

  #work {
    padding-bottom: var(--Scale-1100);
  }

  .content-section {
    min-height: 320px;
    padding-top: var(--Scale-700);
    padding-bottom: var(--Scale-700);
  }

  .work-grid {
    gap: var(--Scale-1000);
  }

  .playground-row {
    grid-template-columns: 1fr;
  }

  .about-stats-grid {
    grid-template-columns: 1fr;
  }

  .about-subsection {
    margin-top: var(--Scale-1000);
  }

  .about-timeline {
    padding-left: var(--Scale-500);
    gap: var(--Scale-700);
  }
}
