/* ============ Flat mint portfolio (по мотивам jonrundle.com) ============ */
:root {
  --bg: #56987c;
  --text: #ffffff;
  --text-soft: rgba(255, 255, 255, 0.85);
  --tile-border: #ffffff;
  --shadow: rgba(0, 0, 0, 0.08);
  --font: 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 48px 40px 56px;
}

/* ============ Brand ============ */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 72px;
  animation: fadeDown .7s ease backwards;
}

.brand__mark {
  width: 44px;
  height: 44px;
  color: var(--text);
  flex-shrink: 0;
}

.brand__mark svg {
  width: 100%;
  height: 100%;
}

.brand__name {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
}

.brand__role {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.25;
}

/* ============ Intro ============ */
.intro {
  margin-bottom: 88px;
  animation: fadeDown .7s ease .15s backwards;
}

.intro p {
  font-size: 24px;
  font-weight: 400;
  line-height: 1.65;
}

.intro a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  transition: opacity .2s ease;
}

.intro a:hover {
  opacity: .75;
}

/* ============ Works grid ============ */
.works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 22px;
  margin-bottom: 96px;
}

.tile {
  display: block;
  aspect-ratio: 1;
  background: #fff;
  border: 5px solid var(--tile-border);
  border-radius: 2px;
  box-shadow: 0 1px 3px var(--shadow);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
  animation: fadeIn .6s ease backwards;
}

/* лёгкий каскад появления плиток */
.tile:nth-child(1) {
  animation-delay: .25s;
}

.tile:nth-child(2) {
  animation-delay: .30s;
}

.tile:nth-child(3) {
  animation-delay: .35s;
}

.tile:nth-child(4) {
  animation-delay: .40s;
}

.tile:nth-child(5) {
  animation-delay: .45s;
}

.tile:nth-child(6) {
  animation-delay: .50s;
}

.tile:nth-child(7) {
  animation-delay: .55s;
}

.tile:nth-child(8) {
  animation-delay: .60s;
}

.tile:nth-child(9) {
  animation-delay: .65s;
}

.tile:nth-child(10) {
  animation-delay: .70s;
}

.tile {
  position: relative;
}

/* Подпись проекта, проявляется при наведении */
.tile::after {
  content: attr(data-name);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  padding: 12px 8px 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  background: linear-gradient(to top, rgba(46, 70, 56, 0.92) 0%, rgba(46, 70, 56, 0.55) 45%, rgba(46, 70, 56, 0) 80%);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}

.tile:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 14px var(--shadow);
  z-index: 1;
}

.tile:hover::after,
.tile:focus-visible::after {
  opacity: 1;
}

.tile svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============ Contacts ============ */
.contacts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px;
  animation: fadeUp .6s ease .75s backwards;
}

.contacts__icon {
  width: 40px;
  height: 40px;
  color: var(--text);
  transition: transform .2s ease, opacity .2s ease;
}

.contacts__icon svg {
  width: 100%;
  height: 100%;
}

.contacts__icon:hover {
  transform: translateY(-3px);
  opacity: .8;
}

/* Copy email button */
.copy-email {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.copy-email:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}

.copy-email:active {
  transform: translateY(0);
}

.copy-email__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.copy-email.is-copied {
  background: #ffffff;
  border-color: #ffffff;
  color: #2e4638;
}

.copy-email.is-error {
  background: rgba(255, 255, 255, 0.9);
  border-color: #ffffff;
  color: #8a2b2b;
}

/* ============ Animations ============ */
@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand, .intro, .tile, .contacts {
    animation: none;
  }
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .page {
    padding: 32px 20px 44px;
  }

  .brand {
    margin-bottom: 48px;
  }

  .intro {
    margin-bottom: 56px;
  }

  .intro p {
    font-size: 20px;
  }

  .works {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 14px;
    margin-bottom: 64px;
  }

  .tile {
    border-width: 4px;
  }

  /* Project name always visible at the bottom of the tile on mobile */
  .tile::after {
    opacity: 1;
    font-size: 12px;
    padding: 10px 6px 8px;
    background: linear-gradient(to top,
        rgba(46, 70, 56, 0.95) 0%,
        rgba(46, 70, 56, 0.72) 38%,
        rgba(46, 70, 56, 0) 72%);
  }
}