/* ==========================================================================
   Fonts: Poppins, self-hosted, subset to Latin + Lithuanian (see OFL.txt)
   ========================================================================== */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/poppins-300.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-500.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600.woff2") format("woff2");
}

/* ==========================================================================
   Tokens and base
   ========================================================================== */

:root {
  --color-text: #666;
  --color-heading: #181818;
  --color-nav: #000;
  --color-dark: #181818;
  --color-dark-hover: #333;
  --color-footer-text: #8d8d8d;
  --color-line: #efefef;
  --color-image-border: #ededed;

  --gutter: 24px;
  --header-height: 90px;
  --header-height-scrolled: 60px;
  --header-height-mobile: 70px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Otherwise the browser compensates for the header shrinking by scrolling
     back up, which cancels small scrolls at the top of the page. */
  overflow-anchor: none;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 26px;
  color: var(--color-text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

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

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

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

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  font-weight: 600;
  letter-spacing: 0.1em;
}

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

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

/* ==========================================================================
   Header: hamburger menu below 1024px; on desktop an inline menu in a header
   that shrinks from 90px to 60px once the page is scrolled
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height-mobile);
  background: #fff;
  border-bottom: 1px solid var(--color-line);
}

.site-header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding-inline: var(--gutter);
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  /* Line the 17px icon up with the page gutter inside the 44px tap target. */
  margin-left: -13px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-heading);
  cursor: pointer;
}

.nav-toggle-lines {
  position: relative;
  width: 17px;
  height: 14px;
}

.nav-toggle-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 12px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-lines span:nth-child(1) { top: 0; }
.nav-toggle-lines span:nth-child(2) { top: calc(50% - 1px); }
.nav-toggle-lines span:nth-child(3) { top: calc(100% - 2px); }

.nav-toggle[aria-expanded="true"] .nav-toggle-lines span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-lines span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-lines span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.main-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-inline: var(--gutter);
  background: #fff;
  border-bottom: 1px solid var(--color-line);
}

.main-nav.is-open {
  display: block;
}

.main-nav a {
  display: block;
  padding: 9px 0 9px 4px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-line);
}

.main-nav li:last-child a {
  border-bottom: 0;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--color-heading);
}

@media (min-width: 1024px) {
  .site-header {
    height: var(--header-height);
    border-bottom: 0;
    transition: height 0.2s ease;
  }

  .site-header.is-scrolled {
    height: var(--header-height-scrolled);
  }

  .site-header-inner {
    justify-content: flex-end;
    padding-inline: 40px;
  }

  .nav-toggle {
    display: none;
  }

  .main-nav,
  .main-nav.is-open {
    display: block;
    position: static;
    padding: 0;
    border: 0;
    background: none;
  }

  .main-nav ul {
    display: flex;
  }

  .main-nav a {
    padding: 0 19px;
    font-size: 12px;
    line-height: 23px;
    color: var(--color-nav);
    border: 0;
  }
}

/* ==========================================================================
   Footer and back-to-top button
   ========================================================================== */

.site-footer {
  padding: 74px var(--gutter) 90px;
  background: var(--color-dark);
  color: var(--color-footer-text);
  text-align: center;
}

.footer-title {
  margin-bottom: 30px;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
}

.site-footer a {
  color: #fff;
}

.social-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 17px;
}

.social-links a {
  display: block;
  transition: color 0.2s ease;
}

.social-links a:hover,
.social-links a:focus-visible {
  color: #808080;
}

.social-links svg {
  display: block;
  width: auto;
  height: 24px;
  fill: currentColor;
}

.back-to-top {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: #414141;
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s 0.15s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.back-to-top svg {
  width: auto;
  height: 20px;
  fill: currentColor;
  transition: transform 0.15s ease 0.05s;
}

.back-to-top:hover svg,
.back-to-top:focus-visible svg {
  transform: translateY(-3px);
}

/* ==========================================================================
   Home
   ========================================================================== */

/* Hero logo */

.hero {
  padding: 40px 0 30px;
}

.hero-logo img {
  width: 200px;
  margin-inline: auto;
  animation: fade-in-scale 1s ease-in-out both;
}

@media (min-width: 1024px) {
  .hero {
    padding: 55px 0 45px;
  }

  .hero-logo img {
    width: 261px;
  }
}

/* Intro text and portrait */

.intro {
  padding: 10px 0 30px;
}

.intro .container-narrow {
  display: grid;
  gap: 24px;
}

.intro-text {
  animation: fade-in-up 1s ease both;
}

.intro-portrait {
  justify-self: center;
  animation: fade-in-left 1.5s ease-out both;
}

.intro-portrait img {
  width: 160px;
}

@media (min-width: 768px) {
  .intro {
    padding-top: 30px;
  }

  .intro .container-narrow {
    grid-template-columns: 3fr 1fr;
    gap: 0;
    align-items: start;
  }

  .intro-text {
    padding: 40px 10% 0 0;
  }

  .intro-portrait img {
    width: 200px;
  }
}

/* Featured projects */

.project-grid {
  padding: 13px clamp(var(--gutter), 4.4vw, 84px) 55px;
}

.project-grid ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px clamp(var(--gutter), 2.8vw, 54px);
}

.project-grid a {
  display: block;
}

.project-grid img {
  width: 100%;
  aspect-ratio: 1380 / 1050;
  object-fit: cover;
  border: 1px solid var(--color-image-border);
  border-radius: 16px;
  box-shadow: 0 12px 13px 0 rgba(0, 0, 0, 0.03);
  transition: transform 0.6s cubic-bezier(0.2, 0.55, 0.1, 0.7);
}

/* Hover is on the whole link, which doesn't move, so the lift can't flicker. */
.project-grid a:hover img,
.project-grid a:focus-visible img {
  transform: translateY(-10px);
}

.project-grid-title {
  margin-top: 32px;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  text-align: center;
}

@media (min-width: 560px) {
  .project-grid ul {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .project-grid ul {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Services list and button */

.services {
  padding: 20px 0 40px;
  overflow-x: clip;
}

.services-inner {
  display: grid;
  gap: 40px;
}

.services-text {
  padding-inline: var(--gutter);
}

.services-title {
  margin-bottom: 24px;
  font-size: 20px;
  line-height: 26px;
}

.check-list li {
  display: flex;
  gap: 16px;
  margin-bottom: 9px;
}

.check-list li::before {
  content: "";
  flex: 0 0 12px;
  height: 12px;
  margin-top: 7px;
  background: url("../img/check.svg") center / contain no-repeat;
}

.services-list li {
  font-size: 18px;
}

.btn {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 32px;
  border: 2px solid transparent;
  background: var(--color-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 21px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background-color 0.2s ease-in-out;
}

.btn:hover,
.btn:focus-visible {
  background: var(--color-dark-hover);
}

/* Card fan: the front card is the last child; each card behind it is 10%
   smaller and 10% further left. main.js moves a clicked card to the front. */

.card-fan-holder {
  padding: 10px var(--gutter);
}

.card-fan {
  position: relative;
  width: min(76%, 779px);
  margin-inline: auto;
  aspect-ratio: 779 / 585;
  /* The back cards stick out 30% of the card width on the left, so shift the
     front card right by half of that to centre the whole fan. */
  transform: translateX(15%);
}

.card-fan-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 16px 0 0 16px;
  box-shadow: 0 12px 24px 0 rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.5s ease-in-out, left 0.3s ease-in-out, margin 0.3s ease-in-out;
}

.card-fan-item:last-child {
  cursor: default;
}

.card-fan-item:not(:last-child):hover {
  margin-left: -20px;
}

.card-fan-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-fan-item:nth-last-child(2) { left: -10%; transform: scale(0.9); }
.card-fan-item:nth-last-child(3) { left: -20%; transform: scale(0.8); }
.card-fan-item:nth-last-child(4) { left: -30%; transform: scale(0.7); }
.card-fan-item:nth-last-child(5) { left: -40%; transform: scale(0.6); }
.card-fan-item:nth-last-child(6) { left: -50%; transform: scale(0.5); }
.card-fan-item:nth-last-child(7) { left: -60%; transform: scale(0.4); }

@media (min-width: 1200px) {
  .services-inner {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 0;
  }

  /* The extra bottom padding lifts the text slightly above the fan's centre. */
  .services-text {
    padding: 0 10% 14px 12%;
  }

  .card-fan-holder {
    padding-inline: 0;
  }

  /* Side by side, the fan runs to the right edge of the window. */
  .card-fan {
    width: min(779px, 82%);
    margin-right: 0;
    transform: none;
  }
}

@media (min-width: 1600px) {
  .services-text {
    padding-left: 24.7%;
  }
}

/* ==========================================================================
   Apie and Paslaugos
   ========================================================================== */

.page-heading {
  font-size: 35px;
  line-height: 1.45em;
}

/* Apie */

.about {
  padding: 4px 0 37px;
}

.about .container-narrow {
  display: grid;
  gap: 40px;
}

.about-text {
  padding-top: 20px;
}

.about-text p {
  max-width: 472px;
  margin-top: 18px;
}

.about-photo {
  justify-self: center;
  width: min(375px, 100%);
  animation: grow-fade-in 1s cubic-bezier(0.77, 0, 0.175, 1) both;
}

/* Portrait frame: crop the photo to it rather than stretching it. */
.about-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

@media (min-width: 1024px) {
  .about .container-narrow {
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: start;
  }

  .about-photo {
    justify-self: start;
    margin-left: 18%;
  }
}

/* Paslaugos: intro */

.services-intro {
  padding-bottom: 73px;
  text-align: center;
}

.page-lead {
  max-width: 550px;
  margin: 19px auto 0;
  font-size: 16px;
  line-height: 30px;
}

/* Paslaugos: slider with two 533x400 images per slide on a 1100x450 stage.
   The images slide in whenever their slide becomes active. */

.pair-slider {
  aspect-ratio: 1100 / 450;
}

.pair-slider picture {
  position: absolute;
  top: 5.556%;
  width: 48.4545%;
}

.pair-slider .pair-left { left: 0; }
.pair-slider .pair-right { right: 0; }

.pair-slider img {
  width: 100%;
}

.pair-slider .swiper-slide-active .pair-left {
  animation: pair-from-left 1s cubic-bezier(0.77, 0, 0.175, 1) both;
}

.pair-slider .swiper-slide-active .pair-right {
  animation: pair-from-right 1s cubic-bezier(0.77, 0, 0.175, 1) both;
}

/* Phones: stack the pair so the images aren't tiny. */
@media (max-width: 559px) {
  .services-intro {
    padding-bottom: 40px;
  }

  .pair-slider {
    aspect-ratio: 779 / 1190;
  }

  .pair-slider picture {
    top: auto;
    width: 100%;
  }

  .pair-slider .pair-left { top: 0; }
  .pair-slider .pair-right { bottom: 0; }
}

/* Paslaugos: service tiers */

.tiers {
  display: grid;
  gap: 60px 55px;
  padding: 36px 0 49px;
}

.tier-title {
  font-size: 20px;
  line-height: 26px;
}

.tier-subtitle {
  margin: 20px 0;
  font-size: 16px;
  line-height: 22px;
}

.tier-title + .check-list,
.tier-title + p {
  margin-top: 24px;
}

@media (min-width: 768px) {
  .tiers {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .tiers {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Galerija: square tiles, two columns from 560px
   ========================================================================== */

.gallery {
  padding: 40px 0 46px;
}

.gallery-grid {
  display: grid;
  gap: 32px 46px;
  align-items: start;
}

.gallery-grid a {
  display: block;
}

.gallery-image {
  position: relative;
  display: block;
}

.gallery-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

/* Dark overlay that fades in over the hovered image. */
.gallery-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(24, 24, 24, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.gallery-grid a:hover .gallery-image::after,
.gallery-grid a:focus-visible .gallery-image::after {
  opacity: 1;
}

.gallery-title {
  margin-top: 25px;
  font-size: 16px;
  line-height: 22px;
}

@media (min-width: 560px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 46px;
  }
}

@media (min-width: 1024px) {
  .gallery {
    padding-top: 90px;
  }
}

/* ==========================================================================
   Project pages: text column, masonry photo grid and prev/next navigation
   ========================================================================== */

.project {
  padding: 23px 0 50px;
}

.project-layout {
  display: grid;
  gap: 32px;
}

.project-heading {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 26px;
}

/* main.js places each photo in the currently shortest column. Without
   JavaScript the photos fall back to CSS columns. */
.masonry {
  --columns: 2;
  --gap: 12px;
  position: relative;
  columns: var(--columns);
  column-gap: var(--gap);
}

.masonry-item {
  display: block;
  margin-bottom: var(--gap);
  break-inside: avoid;
}

.masonry-item img {
  width: 100%;
}

.masonry.is-laid-out {
  columns: auto;
}

.masonry.is-laid-out .masonry-item {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
}

.project-nav {
  position: relative;
  display: flex;
  align-items: center;
  height: 55px;
  margin-top: 60px;
}

.project-nav a {
  display: block;
}

.project-nav svg {
  display: block;
  fill: currentColor;
}

.project-nav-prev,
.project-nav-next {
  color: var(--color-heading);
}

.project-nav-next {
  margin-left: auto;
}

.project-nav-back {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--color-text);
  transition: color 0.2s ease;
}

.project-nav-back:hover,
.project-nav-back:focus-visible {
  color: var(--color-heading);
}

@media (min-width: 768px) {
  .masonry {
    --gap: 30px;
  }

  .masonry[data-columns="3"] {
    --columns: 3;
  }
}

@media (min-width: 1024px) {
  /* Photos on the left, text on the right, in an 8:4 split of the grid. */
  .project-layout {
    grid-template-columns: minmax(0, 723.33fr) minmax(0, 346.67fr);
    gap: 30px;
    align-items: start;
  }

  .project-info-col {
    order: 2;
  }

  /* main.js moves the text down with the page as it scrolls. */
  .project-info {
    padding-top: 40px;
    transition: transform 0.45s linear;
  }

  .project-nav {
    margin-top: 100px;
  }
}

/* ==========================================================================
   404 page
   ========================================================================== */

.not-found {
  padding: 40px 30px;
  text-align: center;
}

.not-found-code {
  color: var(--color-heading);
  font-size: 45px;
  font-weight: 600;
  line-height: 67.5px;
  letter-spacing: 0.1em;
}

.not-found-title {
  font-size: 35px;
  line-height: 50.75px;
}

.not-found-text {
  margin-top: 14px;
}

.not-found .btn {
  margin-top: 31px;
}

/* Beyond phone width the message is centred in the whole window: the empty
   bottom padding matches the header above it. */
@media (min-width: 681px) {
  .not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height-mobile));
    padding: 0 10% var(--header-height-mobile);
  }
}

@media (min-width: 1024px) {
  .not-found {
    min-height: calc(100vh - var(--header-height));
    padding-bottom: var(--header-height);
  }
}

@media (min-width: 1201px) {
  .not-found .btn {
    padding: 13px 66px;
  }
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Appear on scroll: main.js adds .is-visible once the element is 100px into
   the viewport. Elements start hidden only when JavaScript can reveal them. */
@media (scripting: enabled) {
  .reveal-grow {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s cubic-bezier(0, 1, 0.5, 1), transform 1s cubic-bezier(0, 1, 0.5, 1);
  }

  /* "none" rather than scale(1), so the finished item isn't left on its own
     compositing layer, which changes text anti-aliasing. */
  .reveal-grow.is-visible {
    opacity: 1;
    transform: none;
  }

  .reveal-from-right {
    opacity: 0;
  }

  .reveal-from-right.is-visible {
    opacity: 1;
    animation: from-right 0.55s ease;
  }
}

@keyframes fade-in-scale {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-left {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes grow-fade-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* Offsets are 50px on a 533px-wide image. */
@keyframes pair-from-left {
  from { opacity: 0; transform: translateX(-9.38%); }
  to { opacity: 1; transform: none; }
}

@keyframes pair-from-right {
  from { opacity: 0; transform: translateX(9.38%); }
  to { opacity: 1; transform: none; }
}

@keyframes from-right {
  from { opacity: 0; transform: translateX(20%); }
  to { opacity: 1; transform: translateX(0); }
}
