:root {
  --teal: #00b2ca;
  --cream: #f3ede1;
  --cream-2: #f4ede1;
  --ink: #1a1a1a;
  --muted: #626262;
  --footer-1: #c2c2c2;
  --footer-2: #ababab;
  --font: "Roboto", system-ui, sans-serif;
  --ref-vw: 1216;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

button {
  font: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ========== HEADER ========== */
.header {
  background: var(--teal);
  position: relative;
  z-index: 20;
  height: 132px;
}

.header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 46px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.header__logo {
  width: 240px;
  height: auto;
  flex: 0 0 auto;
}

.header__tagline {
  margin: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.35);
  padding-left: 14px;
  color: rgba(0, 0, 0, 0.55);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  white-space: pre-line;
}

.header__contacts {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding-right: 8px;
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111;
  font-size: 15px;
  font-weight: 400;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.contact:hover {
  opacity: 0.75;
}

.contact img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.contact--phone img {
  width: 23px;
  height: 23px;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: #111;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  top: -7px;
}

.menu-toggle span::after {
  top: 7px;
}

/* Balloons */
.balloon {
  position: absolute;
  z-index: 30;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.16));
}

.balloon:hover {
  transform: translateY(-3px) scale(1.02);
}

.balloon img {
  width: 100%;
  height: auto;
}

.balloon--draw {
  top: 92px;
  left: calc(100vw * 676 / 1216);
  right: auto;
  width: 230px;
}

.balloon--drawn {
  position: absolute;
  left: -54px;
  top: 697px;
  width: 250px;
  z-index: 25;
}

/* ========== SERVICES ========== */
.services {
  background: var(--cream);
  padding: 0 0 100px;
  position: relative;
}

.services__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 0;
  width: calc(100% - 92px);
}

.service-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 100px;
}

.service-row--identity {
  padding-top: 35px;
  padding-bottom: 6px;
}

.service-row--visual {
  padding-top: 20px;
  padding-bottom: 6px;
}

.service-row--poly {
  padding-top: 20px;
  padding-bottom: 6px;
}

.service-row--web {
  padding-top: 20px;
  padding-bottom: 0;
}

.service-row__title {
  display: block;
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.service-row__title img {
  display: block;
  height: auto;
  transition: opacity 0.25s ease;
}

.service-row__title .hover-src {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}

.service-row__title:hover .base-src[data-hover] {
  opacity: 0;
}

.service-row__title:hover .hover-src {
  opacity: 1;
}

.service-row--identity .service-row__title {
  justify-self: end;
  padding-right: 12px;
}

.service-row--identity .service-row__title img.base-src,
.service-row--identity .service-row__title img.hover-src {
  width: min(369px, 100%);
}

.service-row--visual .service-row__title {
  justify-self: start;
  padding-left: 18px;
}

.service-row--visual .service-row__title img.base-src,
.service-row--visual .service-row__title img.hover-src {
  width: min(456px, 100%);
}

.service-row--poly .service-row__title {
  justify-self: end;
  padding-right: 12px;
}

.service-row--poly .service-row__title img.base-src,
.service-row--poly .service-row__title img.hover-src {
  width: min(405px, 100%);
}

.service-row--web .service-row__title {
  justify-self: start;
  padding-left: 18px;
}

.service-row--web .service-row__title img.base-src {
  width: 133px;
  height: 50px;
  object-fit: contain;
}

.service-row__links {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}

.service-row__links a {
  display: block;
  width: fit-content;
  transition: color 0.2s ease, transform 0.2s ease;
}

.service-row__links a:hover {
  color: var(--teal);
}

.service-row--identity .service-row__links,
.service-row--poly .service-row__links {
  justify-self: start;
  padding-left: 18px;
}

.service-row--visual .service-row__links,
.service-row--web .service-row__links {
  justify-self: end;
  padding-right: 24px;
  text-align: left;
}

.service-row--visual .service-row__links a,
.service-row--web .service-row__links a {
  margin-left: auto;
}

.service-row--identity .service-row__links a:hover,
.service-row--poly .service-row__links a:hover {
  transform: translateX(3px);
}

.service-row--visual .service-row__links a:hover,
.service-row--web .service-row__links a:hover {
  transform: translateX(3px);
}

/* headShake-like nudge on identity title */
@keyframes headShake {
  0% { transform: translateX(0); }
  6.5% { transform: translateX(-4px) rotateY(-5deg); }
  18.5% { transform: translateX(3px) rotateY(3deg); }
  31.5% { transform: translateX(-2px) rotateY(-2deg); }
  43.5% { transform: translateX(1px) rotateY(1deg); }
  50% { transform: translateX(0); }
}

.service-row--identity .service-row__title.is-shake {
  animation: headShake 2s ease both;
}

/* ========== INTERESTING ========== */
.interesting {
  background: #fff;
  padding: 0;
  position: relative;
}

.interesting__title {
  display: flex;
  justify-content: center;
  padding: 28px 0 0;
}

.interesting__title img {
  width: 200px;
  height: auto;
}

/*
  Portfolio matches original SP Page Builder layout:
  - 1170px row container
  - uneven columns, clipped windows 470/370/270
  - image centered inside window (overflow hidden)
  - hover: margin-left -20px + brightness/grayscale
*/
.portfolio {
  width: 100%;
  max-width: 1170px;
  margin: 0 auto;
  overflow: visible;
}

.portfolio-row {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  padding: 7px 0;
  box-sizing: border-box;
}

.portfolio-row--first {
  padding-top: 38px;
  padding-bottom: 9px;
}

.portfolio-row--last {
  padding-bottom: 80px;
}

.portfolio-col {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-width: 0;
}

/* Pattern A: ~41.84% / 33.16% / 25% → windows 470 / 370 / 270 */
.portfolio-row--a .portfolio-col:nth-child(1) {
  flex: 0 0 41.83764017094017%;
  max-width: 41.83764017094017%;
}
.portfolio-row--a .portfolio-col:nth-child(2) {
  flex: 0 0 33.16235982905983%;
  max-width: 33.16235982905983%;
}
.portfolio-row--a .portfolio-col:nth-child(3) {
  flex: 0 0 25%;
  max-width: 25%;
}

.portfolio-row--a .portfolio-col:nth-child(1) .portdiv {
  width: 470px;
}
.portfolio-row--a .portfolio-col:nth-child(2) .portdiv {
  width: 370px;
}
.portfolio-row--a .portfolio-col:nth-child(3) .portdiv {
  width: 270px;
}

/* Pattern B: ~24.66% / 33.25% / 42.09% → windows 270 / 370 / 470 */
.portfolio-row--b .portfolio-col:nth-child(1) {
  flex: 0 0 24.658129914529916%;
  max-width: 24.658129914529916%;
}
.portfolio-row--b .portfolio-col:nth-child(2) {
  flex: 0 0 33.24785982905983%;
  max-width: 33.24785982905983%;
}
.portfolio-row--b .portfolio-col:nth-child(3) {
  flex: 0 0 42.09404017094017%;
  max-width: 42.09404017094017%;
}

.portfolio-row--b .portfolio-col:nth-child(1) .portdiv {
  width: 270px;
}
.portfolio-row--b .portfolio-col:nth-child(2) .portdiv {
  width: 370px;
}
.portfolio-row--b .portfolio-col:nth-child(3) .portdiv {
  width: 470px;
}

.portdiv {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  height: 370px;
  overflow: hidden;
  border: 1px solid #bdbdbd;
  box-sizing: border-box;
  background: #fff;
}

.sidepan:hover {
  -webkit-filter: grayscale(100%);
  filter: grayscale(20%);
}

.sidepan img {
  display: block;
  height: 370px;
  max-width: none !important;
  width: auto;
  margin-left: 0;
  flex-shrink: 0;
  -webkit-transition: margin 1s ease;
  transition: margin 1s ease;
}

.sidepan img:hover,
.sidepan:hover img {
  -webkit-filter: brightness(85%);
  filter: brightness(85%);
  margin-left: -20px;
}

/* ========== FOOTER ========== */
.footer {
  margin-top: 0;
}

.footer__top {
  background: #c2c2c2;
  padding: 50px 0 40px;
}

.footer__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 46px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.footer__logo {
  width: 200px;
}

.footer__contacts {
  display: grid;
  gap: 8px;
}

.footer__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 16px;
}

.footer__col h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.footer__col a {
  display: block;
  color: #626262;
  font-size: 14px;
  line-height: 22px;
  transition: color 0.2s ease;
}

.footer__col a:hover {
  color: #111;
}

.footer__bottom {
  background: #ababab;
  color: #333;
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  padding: 22px 24px 28px;
}

/* Back to top */
.back-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #9a9a9a;
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.back-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-top:hover {
  background: var(--teal);
}

.back-top svg {
  width: 16px;
  height: 16px;
}

/* Offcanvas */
.offcanvas {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.offcanvas.is-open {
  pointer-events: auto;
}

.offcanvas__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.offcanvas.is-open .offcanvas__backdrop {
  opacity: 1;
}

.offcanvas__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 88vw);
  height: 100%;
  background: #789296;
  color: #fff;
  padding: 24px 20px;
  transform: translateX(105%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.offcanvas.is-open .offcanvas__panel {
  transform: translateX(0);
}

.offcanvas__close {
  align-self: flex-end;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.offcanvas__nav {
  display: grid;
  gap: 12px;
  font-size: 18px;
}

body.is-locked {
  overflow: hidden;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991px) {
  .header {
    height: auto;
    min-height: 96px;
  }

  .header__inner {
    padding: 12px 16px;
  }

  .header__logo {
    width: 160px;
  }

  .header__tagline,
  .header__contacts {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .balloon--draw {
    top: 70px;
    right: 10px;
    width: 130px;
  }

  .balloon--drawn {
    display: none;
  }

  .services__inner {
    width: calc(100% - 32px);
  }

  .service-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 20px !important;
    min-height: 0;
  }

  .service-row--identity .service-row__title,
  .service-row--poly .service-row__title,
  .service-row--visual .service-row__title,
  .service-row--web .service-row__title {
    justify-self: start;
    padding: 0;
    order: -1;
  }

  .service-row--visual .service-row__links,
  .service-row--web .service-row__links {
    justify-self: start;
    padding: 0;
  }

  .service-row--visual .service-row__links a,
  .service-row--web .service-row__links a {
    margin-left: 0;
  }

  .service-row--web .service-row__title img.base-src {
    width: 133px;
  }

  .portfolio {
    max-width: 100%;
    padding: 0 8px;
  }

  .portfolio-row,
  .portfolio-row--first,
  .portfolio-row--last {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px 0;
    flex-wrap: wrap;
  }

  .portfolio-col {
    flex: none !important;
    max-width: none !important;
    width: 100%;
  }

  .portdiv {
    width: 100% !important;
    height: auto;
    aspect-ratio: 490 / 370;
  }

  .sidepan img {
    width: 100% !important;
    max-width: none !important;
    height: 100%;
    object-fit: cover;
    margin-left: 0 !important;
  }

  .sidepan:hover,
  .sidepan:hover img {
    filter: brightness(85%);
    -webkit-filter: brightness(85%);
  }

  .sidepan:hover img {
    margin-left: 0 !important;
  }

  .footer__inner {
    padding: 0 16px;
    grid-template-columns: 1fr;
  }

  .footer__nav {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 575px) {
  .portfolio-row {
    grid-template-columns: 1fr;
  }

  .header__logo {
    width: 140px;
  }

  .balloon--draw {
    width: 110px;
  }
}

/* ========== PORTFOLIO PROJECT ========== */
.page-portfolio .header .balloon--draw {
  display: none;
}

.project {
  background: #fff;
  padding: 36px 0 64px;
}

.project__inner {
  max-width: 1290px;
  margin: 0 auto;
  padding: 0 16px;
}

.project__title {
  margin: 0 0 28px;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.project__figure {
  margin: 0 0 18px;
}

.project__figure img {
  width: 100%;
  height: auto;
}

.project__back {
  margin: 40px 0 0;
  font-size: 15px;
}

.project__back a {
  color: var(--teal);
  font-weight: 500;
}

.project__back a:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .project {
    padding: 24px 0 48px;
  }

  .project__figure {
    margin-bottom: 12px;
  }
}
