<link href="https://fonts.googleapis.com/css?family=Montserrat:200,400" rel="stylesheet">

  <div class="app">
    <header class="header">
      <div class="header__left">
        <span>Digital Walls</span>
      </div>
      <div class="header__right">
        <p>Thu, 14 Jun | 16:20</p>
      </div>
    </header>
    
    <nav class="nav">
      <ul class="nav__menu">
        <li class="nav__item">
          <a href="#vienna" class="nav__link" data-scroll-to>
            <div class="media">
              <img src="https://lonelyplanetimages.imgix.net/mastheads/stock-photo-st-stephens-church-112868985.jpg?sharp=10&vib=20&w=2000" alt="" class="media__img">
              <p class="media__content">
                <strong>Vienna</strong><br />
                Austria
              </p>
            </div>
          </a>
        </li>
        <li class="nav__item">
          <a href="#lisbon" class="nav__link" data-scroll-to>
            <div class="media">
              <img src="https://lonelyplanetimages.imgix.net/mastheads/54989636.jpg?sharp=10&vib=20&w=2000" alt="" class="media__img">
              <p class="media__content">
                <strong>Lisbon</strong><br />
                Portugal
              </p>
            </div>
          </a>
        </li>
        <li class="nav__item">
          <a href="#newyork" class="nav__link" data-scroll-to>
            <div class="media">
              <img src="https://lonelyplanetimages.imgix.net/mastheads/GettyImages-538096543_medium.jpg?sharp=10&vib=20&w=2000" alt="" class="media__img">
              <p class="media__content">
                <strong>New York</strong><br />
                USA
              </p>
            </div>
          </a>
        </li>
      </ul>
    </nav>
    
    <main class="main">
      <article class="section" id="vienna" data-section>
        <header class="section__header" style="background-image: url('https://lonelyplanetimages.imgix.net/mastheads/stock-photo-st-stephens-church-112868985.jpg?sharp=10&w=2000');">
          <h1 class="section__title">Vienna</h1>
          <p class="section__subtitle">48.21°N, 16.36°E</p>
          <div class="section__controls">
            <button class="btn btn--prev" title="Previous">
              <span class="arrow arrow--left"></span>
            </button>
            <button class="btn btn--next" title="Next">
              <span class="arrow arrow--right"></span>
            </button>
            <div class="user">
              <img src="https://source.unsplash.com/200x200/?people" class="user__img" alt="" />
              <span class="user__name">Jamie</span>
            </div>
          </div>
        </header>
        <div class="section__content">
          <ul class="boxgrid">
            <li class="boxgrid__item">
              <a href="#" class="box box--weather">
                <p><span class="text--large">27°C</span><br />Cloudy</p>
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--wide">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/600x400/?nature" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/300x300/?people" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--cost">
                <p><span class="text--large">120€</span><br />Daily cost</p>
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--video">
                <img src="https://source.unsplash.com/300x300/?art" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--locations">
                <p><span class="text--large">189</span><br />Locations</p>
              </a>
            </li>
          </ul>
        </div>
      </article>
  
      <article class="section" id="lisbon" data-section>
        <header class="section__header" style="background-image: url('https://lonelyplanetimages.imgix.net/mastheads/54989636.jpg?sharp=10&w=2000');">
          <h1 class="section__title">Lisbon</h1>
          <p class="section__subtitle">38.44°N, 09.82°W</p>
          <div class="section__controls">
            <button class="btn btn--prev" title="Previous">
              <span class="arrow arrow--left"></span>
            </button>
            <button class="btn btn--next" title="Next">
              <span class="arrow arrow--right"></span>
            </button>
            <div class="user">
              <img src="https://source.unsplash.com/200x200/?people" class="user__img" alt="" />
              <span class="user__name">Jamie</span>
            </div>
          </div>
        </header>
        <div class="section__content">
          <ul class="boxgrid">
            <li class="boxgrid__item">
              <a href="#" class="box box--weather">
                <p><span class="text--large">22°C</span><br />Rain</p>
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/300x300/?nature" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--video">
                <img src="https://source.unsplash.com/300x300/?art" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--wide">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/600x400/?technology" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--locations">
                <p><span class="text--large">272</span><br />Locations</p>
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--cost">
                <p><span class="text--large">80€</span><br />Daily cost</p>
              </a>
            </li>
            
          </ul>
        </div>
      </article>
  
      <article class="section" id="newyork" data-section>
        <header class="section__header" style="background-image: url('https://lonelyplanetimages.imgix.net/mastheads/GettyImages-538096543_medium.jpg?sharp=10&vib=20&w=2000');">
          <h1 class="section__title">New York</h1>
          <p class="section__subtitle">40.42°N, 74.02°W</p>
          <div class="section__controls">
            <button class="btn btn--prev" title="Previous">
              <span class="arrow arrow--left"></span>
            </button>
            <button class="btn btn--next" title="Next">
              <span class="arrow arrow--right"></span>
            </button>
            <div class="user">
              <img src="https://source.unsplash.com/200x200/?nature" class="user__img" alt="" />
              <span class="user__name">Jamie</span>
            </div>
          </div>
        </header>
        <div class="section__content">
          <ul class="boxgrid">
            <li class="boxgrid__item boxgrid__item--wide">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/600x400/?art" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--weather">
                <p><span class="text--large">30°C</span><br />Sunny</p>
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--video">
                <img src="https://source.unsplash.com/300x300/?art" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/300x300/?people" class="box__img" alt="" />
              </a>
            </li>
            <li class="boxgrid__item boxgrid__item--push">
              <a href="#" class="box box--locations">
                <p><span class="text--large">1.366</span><br />Locations</p>
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--cost">
                <p><span class="text--large">150$</span><br />Daily cost</p>
              </a>
            </li>
            <li class="boxgrid__item">
              <a href="#" class="box box--image">
                <img src="https://source.unsplash.com/300x300/?technology" class="box__img" alt="" />
              </a>
            </li>
          </ul>
        </div>
      </article>
    </main>
    
    <button class="scrollctrl scrollctrl--prev" data-scroll-dir="prev">
      <span class="arrow arrow--large arrow--up"></span>
    </button>
    <button class="scrollctrl scrollctrl--next" data-scroll-dir="next">
      <span class="arrow arrow--large arrow--down"></span>
    </button>
  </div>
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  color: #fff;
  background-color: #121519;
  font-family: "Montserrat", "Roboto", "Droid Sans", "Helvetica Neue", sans-serif;
}

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

a {
  text-decoration: none;
}

p {
  margin: 1rem 0;
}

.app {
  display: grid;
  grid-template-rows: 4rem 1fr 4rem;
  grid-template-columns: 20% 1fr;
  height: 100vh;
}

.header,
.footer {
  font-size: 0.75rem;
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a0a0a0;
}

.header {
  display: flex;
  justify-content: space-between;
  grid-column: 1/-1;
  padding: 0 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.header__left, .header__right {
  display: flex;
  align-items: center;
}

.main {
  grid-column: 1/-1;
  padding: 2rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  perspective: 1px;
  -ms-scroll-snap-type: block proximity;
      scroll-snap-type: block proximity;
  -ms-scroll-snap-destination: 0% 100%;
      scroll-snap-destination: 0% 100%;
  -ms-scroll-snap-points-y: repeat(100%);
      scroll-snap-points-y: repeat(100%);
}
@media screen and (min-width: 1024px) {
  .main {
    grid-column: 2/-1;
  }
}

.footer {
  display: flex;
  align-items: center;
  grid-column: 1/-1;
  padding: 0 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer p {
  margin-right: 1rem;
}
.footer a {
  color: #fff;
}
.footer a:hover, .footer a:focus {
  text-decoration: underline;
}
.footer__more {
  display: none;
  margin-left: auto;
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .footer__more {
    display: block;
  }
}

.nav {
  display: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nav__item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.nav__link {
  display: block;
  color: #fff;
  font-weight: 200;
}
.nav__link:hover, .nav__link:focus {
  background-color: rgba(255, 255, 255, 0.035);
}
@media screen and (min-width: 1024px) {
  .nav {
    display: block;
    grid-column: 1/2;
  }
}

.section {
  min-height: 500px;
  min-height: calc(100vh - 4rem - 4rem);
  padding-top: 300px;
  margin-bottom: 250px;
  position: relative;
  transform-style: preserve-3d;
  scroll-snap-align: start;
}
.section__header {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  height: 500px;
  padding: 2rem;
  border-radius: 0.5rem;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
}
.section__header::after {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);
}
.section__title {
  font-size: 3.5rem;
  font-weight: 200;
  margin-bottom: 0.5rem;
  line-height: 1;
}
.section__subtitle {
  font-size: 1.5rem;
}
.section__controls {
  display: flex;
  align-items: center;
  position: absolute;
  padding: 0 2rem;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-50%);
}
.section__content {
  position: relative;
  z-index: 1;
  padding: 0 1rem;
}
@media screen and (min-width: 1024px) {
  .section {
    margin-bottom: 750px;
  }
  .section__header {
    transform: translateZ(-1px) scale(1.9);
  }
  .section__content {
    padding: 0;
    transform: translateZ(0);
  }
}

.boxgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  grid-auto-rows: minmax(150px, auto);
  grid-gap: 2rem 0.5rem;
}
.boxgrid__item {
  display: flex;
}
.boxgrid__item--wide {
  grid-column: span 2;
}
@media screen and (min-width: 1280px) {
  .boxgrid__item--push {
    grid-column: span 2;
    padding-left: 50%;
  }
}

.box {
  display: flex;
  flex: 1 0 0;
  position: relative;
  padding: 2rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #fff;
  box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22);
  transform: scale(1);
  transition: all 0.25s ease;
  filter: brightness(100%);
}
.box:hover, .box:focus {
  transform: scale(1.07);
  filter: brightness(110%);
  z-index: 10;
}
.box--weather {
  background-color: #89cdce;
}
.box--cost {
  background-color: #66aee5;
}
.box--locations {
  background-color: #6c73dc;
}
.box--image, .box--video {
  padding: 0;
}
.box--video::before, .box--video::after {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
}
.box--video::before {
  width: 50px;
  height: 50px;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.3);
}
.box--video::after {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 15px;
  border-color: transparent transparent transparent #121519;
  margin-left: 2px;
}
.box__img {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  -o-object-fit: cover;
     object-fit: cover;
  -o-object-position: center;
     object-position: center;
  border-radius: 0.5rem;
}

.scrollctrl {
  display: none;
  justify-content: center;
  width: 50vw;
  height: 50vw;
  padding: 0;
  position: fixed;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  background-color: transparent;
  left: 50%;
  margin-left: -25%;
}
.scrollctrl:hover, .scrollctrl:focus {
  background-color: rgba(255, 255, 255, 0.035);
}
.scrollctrl--prev {
  top: 0;
  padding-top: 44%;
  align-items: flex-end;
  transform: translateY(-42vw);
}
.scrollctrl--next {
  bottom: 0;
  padding-bottom: 44%;
  transform: translateY(42vw);
}
@media screen and (min-width: 1024px) {
  .scrollctrl {
    display: flex;
  }
}

.text--large {
  font-size: 2rem;
  font-weight: 200;
}

.arrow {
  display: inline-block;
  padding: 3px;
  border-style: solid;
  border-width: 0 2px 2px 0;
}
.arrow--large {
  padding: 8px;
  border-width: 0 1px 1px 0;
}
.arrow--right {
  transform: rotate(-45deg);
}
.arrow--left {
  transform: rotate(135deg);
}
.arrow--up {
  transform: rotate(-135deg);
}
.arrow--down {
  transform: rotate(45deg);
}

.media {
  display: flex;
  align-items: center;
  padding: 2rem;
}
.media__img {
  width: 60px;
  height: 60px;
  margin-right: 1rem;
  border-radius: 0.25rem;
  -o-object-position: center center;
     object-position: center center;
  -o-object-fit: cover;
     object-fit: cover;
}
.media__content {
  margin: 0;
}

.user {
  margin-left: auto;
  text-align: center;
  padding-top: 2rem;
}
.user__name {
  display: block;
  font-size: 1.5rem;
  font-weight: 200;
}
.user__img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.3);
}

.btn {
  display: flex;
  flex: 0 0 50px;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  border: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background-color: #fff;
  margin: 0 0.5rem;
}

button:focus {
  outline: 0;
  border-color: #66aee5;
  box-shadow: 0 0 0 1px #66aee5;
}
const SELECTORS = {
      section: "[data-section]",
      scrollTo: "[data-scroll-to]",
      scrollDir: "[data-scroll-dir]"
    };
    const sectionsArray = Array.from(document.querySelectorAll(SELECTORS.section));
    const scrollToElements = document.querySelectorAll(SELECTORS.scrollTo);
    const scrollDirElements = document.querySelectorAll(SELECTORS.scrollDir);
    
    let currentSectionIndex = 0;
    
    const getScrollTarget = (dir) => {
      if (dir === "prev" && currentSectionIndex > 0) {
        currentSectionIndex--;
        return sectionsArray[currentSectionIndex];
      }
      if (dir === "next" && currentSectionIndex < sectionsArray.length - 1) {
        currentSectionIndex++;
        return sectionsArray[currentSectionIndex];
      }
      return false;
    };
    
    scrollDirElements.forEach((el) => {
      el.addEventListener("click", () => {
        const direction = el.dataset.scrollDir;
        const target = getScrollTarget(direction);
    
        if (target) {
          target.scrollIntoView({ behavior: "smooth" });
        }
      });
    });
    
    scrollToElements.forEach((el) => {
      el.addEventListener("click", (e) => {
        e.preventDefault();
        const targetId = el.getAttribute("href");
        const target = document.querySelector(targetId);
    
        if (target) {
          sectionsArray.forEach((section, index) => {
            if (section.id === targetId.replace("#", "")) {
              currentSectionIndex = index;
            }
          });
          target.scrollIntoView({ behavior: "smooth" });
        }
      });
    });