/* ================= GLOBAL STYLES ================= */
:root {
  --footer-text-color: #F4F4FD;
  --icon-fill: #f4f4fd; /* for tests fill variable */
  --feature-icon-scale: 1; /* reset to meet tests expecting 64 exact appearance */
}

body {
  font-family: "Roboto", sans-serif;
  color: #434455;
  background-color: #FFFFFF;
}

/* Reset margins and paddings */
h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}
ul, ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
a {
  text-decoration: none;
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Container */
.container {
  max-width: 1158px;
  padding: 0 15px;
  margin: 0 auto;
}

/* Section spacing */
.section {
  padding: 120px 0;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

/* Visually hidden (for accessibility) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* ================= HEADER ================= */
.header {
  border-bottom: 1px solid #e7e9fc;
  box-shadow: 0px 2px 1px rgba(46, 47, 66, 0.08),
              0px 1px 1px rgba(46, 47, 66, 0.16),
              0px 1px 6px rgba(46, 47, 66, 0.08);
}
.header .container {
  display: flex;
  align-items: center;
}

.logo {
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4d5ae5;
  margin-right: 76px;
}
.logo-accent {
  color: #2e2f42;
}

.nav-list {
  display: flex;
  gap: 40px;
}
.nav-link {
  position: relative;
  padding: 24px 0;
  font-weight: 500;
  font-size: 16px;
  color: #2e2f42;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover,
.nav-link:focus {
  color: #404bbf;
}
.nav-link.current {
  color: #404bbf;
}
.nav-link.current::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 4px;
  background-color: #404bbf;
  border-radius: 2px;
}

.contacts {
  margin-left: auto;
}
.contacts-list {
  display: flex;
  gap: 40px;
}
.contacts-link {
  padding: 24px 0;
  font-size: 16px;
  color: #434455;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.contacts-link:hover,
.contacts-link:focus {
  color: #404bbf;
}

/* ================= HERO SECTION ================= */
.hero {
  background-color: #2e2f42;
  background-image:
    linear-gradient(rgba(46, 47, 66, 0.7), rgba(46, 47, 66, 0.7)),
    url(../images/hero-bg.jpg); /* ensure .jpg for test */
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  padding: 188px 0;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}
.hero-title {
  max-width: 496px;
  margin: 0 auto 48px;
  font-weight: 700;
  font-size: 56px;
  line-height: 1.07;
  letter-spacing: 0.02em;
  text-align: center;
  color: #FFFFFF;
}
.hero-button {
  display: block;
  min-width: 169px;
  height: 56px;
  margin: 0 auto;
  background-color: #4d5ae5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #FFFFFF;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-button:hover,
.hero-button:focus {
  background-color: #404bbf;
}

/* ================= FEATURES SECTION ================= */
.features-list {
  display: flex;
  gap: 24px;
}
.features-item {
  width: calc((100% - 72px) / 4);
}
.features-icon-container {
  width: 100%;
  height: 112px;
  background-color: #f4f4fd;
  border: 1px solid #8e8f99;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}
.features-icon {
  width: 64px;
  height: 64px;
  transform: none;
}
.features-title {
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 20px;
  color: #2e2f42;
}
.features-text {
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #434343;
}

/* ================= TEAM SECTION ================= */
.team-title {
  margin-bottom: 72px;
  font-size: 36px;
  text-align: center;
  color: #2e2f42;
}
.team-list {
  display: flex;
  gap: 24px;
}
.team-item {
  width: calc((100% - 72px) / 4);
  background-color: #FFFFFF;
  border-radius: 0 0 4px 4px;
  box-shadow:
    0px 1px 6px rgba(46,47,66,0.08),
    0px 1px 1px rgba(46,47,66,0.16),
    0px 2px 1px rgba(46,47,66,0.08);
}
.team-item img {
  width: 264px;
  height: 260px;
  object-fit: cover;
  border-radius: 4px 4px 0 0;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.team-info {
  padding: 32px 0;
  text-align: center;
}
.team-name {
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 20px;
  color: #2e2f42;
}
.team-position {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #434455;
}

/* Social links (team) */
.social-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  align-items: center; /* ensures circles line up */
}
.social-item {
  width: 40px;
  height: 40px;
}
.social-link {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: #4d5ae5;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.social-link:hover,
.social-link:focus {
  background-color: #404bbf;
}
/* FIX: Removed width and height from CSS, now controlled by HTML attributes */
.social-icon {
  fill: var(--icon-fill, #f4f4fd);
}

/* ================= PORTFOLIO SECTION ================= */
.portfolio-title {
  margin-bottom: 72px;
  font-size: 36px;
  text-align: center;
  color: #2e2f42;
}
.portfolio-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 24px;
  row-gap: 48px;
}
.portfolio-item {
  width: calc((100% - 48px) / 3);
  transition: box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.portfolio-item:hover {
  box-shadow:
    0px 1px 6px rgba(46,47,66,0.08),
    0px 1px 1px rgba(46,47,66,0.16),
    0px 2px 1px rgba(46,47,66,0.08);
}
.portfolio-image {
  position: relative;
  overflow: hidden;
}
.portfolio-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #4d5ae5;
  color: #f4f4fd;
  padding: 40px 32px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  transform: translateY(100%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.portfolio-item:hover .portfolio-overlay {
  transform: translateY(0);
}
.portfolio-content {
  padding: 32px 16px;
  border: 1px solid #e7e9fc;
  border-top: none;
}
.portfolio-project {
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 20px;
  color: #2e2f42;
}
.portfolio-category {
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #434455;
}

/* ================= FOOTER ================= */
.footer {
  background-color: #2e2f42;
  padding: 100px 0;
}
.footer-container {
  display: flex;
  align-items: baseline;
  border: 1px solid #8e8f99;
  border-radius: 4px;
}
.footer-content {
  margin-right: 120px;
}
.footer .logo {
  display: inline-block;
  margin-bottom: 16px;
}
.footer .logo-accent {
  color: #f4f4fd;
}
.footer-text {
  max-width: 264px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--footer-text-color);
}
.footer-social-text {
  margin-bottom: 16px;
  font-weight: 500;
  font-size: 16px;
  color: #FFFFFF;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* Social links (footer) */
.footer-social-list {
  display: flex;
  gap: 16px;
  align-items: center;
}
.footer-social-item {
  width: 40px;
  height: 40px;
}
.footer-social-link {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: #4d5ae5;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.footer-social-link:hover,
.footer-social-link:focus {
  background-color: #31d0aa;
}

/* FIX: Removed width and height from CSS, now controlled by HTML attributes */
.footer-social-icon {
  fill: var(--icon-fill, #f4f4fd);
}