/* Портфолио Ивана — простой стиль, ничего лишнего */

:root {
  --bg: #f7f6f3;
  --paper: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6b66;
  --line: #e3e1db;
  --accent: #2b5bb5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.65;

  /* переход между страницами */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

body.loaded {
  opacity: 1;
  transform: none;
}

body.leaving {
  opacity: 0;
  transform: translateY(-8px);
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Шапка */
header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  text-decoration: none;
  color: var(--ink);
  display: inline-block;
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: rotate(-2deg) scale(1.05);
}

.logo span {
  color: var(--accent);
  display: inline-block;
  animation: dotPulse 2.4s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.5); }
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 22px;
  font-size: 15px;
  position: relative;
  transition: color 0.2s ease;
}

nav a:hover { color: var(--ink); }

/* подчёркивание выезжает слева */
nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.22s ease;
}

nav a:hover::after { width: 100%; }
nav a.active::after { width: 0; }
nav a.active {
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* Основное */
main { padding: 48px 0 70px; }

h1 {
  font-size: 34px;
  line-height: 1.25;
  margin: 0 0 18px;
}

h2 {
  font-size: 23px;
  margin: 42px 0 14px;
}

p { margin: 0 0 16px; }

.lead {
  font-size: 19px;
  color: var(--ink);
}

.muted { color: var(--muted); }
.small { font-size: 14px; }

a {
  color: var(--accent);
  transition: color 0.18s ease;
}

/* ссылки в тексте — подчёркивание выезжает */
main p a, main li a, .note a, footer a {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.25s ease;
  padding-bottom: 1px;
}

main p a:hover, main li a:hover, .note a:hover, footer a:hover {
  background-size: 100% 1px;
}

/* Кнопка-ссылка на телеграм */
.tg-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 22px;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  background: var(--paper);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.tg-link:hover {
  background: var(--ink);
  color: #fff;
  transform: translateY(-2px);
}

.tg-link:active {
  transform: translateY(0);
}

/* Карточки работ */
.work {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px 26px;
  margin-bottom: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;

  /* появление при загрузке */
  opacity: 0;
  animation: cardIn 0.45s ease forwards;
}

.work:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 0 6px 18px rgba(29, 29, 27, 0.08);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.work h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.work .tag {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 1px 9px;
  margin: 4px 6px 10px 0;
}

.work p { margin-bottom: 10px; }
.work p:last-child { margin-bottom: 0; }

/* теги чуть подпрыгивают при наведении */
.work .tag {
  transition: background 0.2s ease, color 0.2s ease;
}

.work:hover .tag {
  background: var(--bg);
  color: var(--ink);
}

/* Списки */
ul { padding-left: 22px; }
li {
  margin-bottom: 8px;
  transition: transform 0.18s ease;
}

li:hover {
  transform: translateX(4px);
}

/* Таблица цен */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  margin: 18px 0 26px;
  font-size: 16px;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--ink);
}

td:last-child, th:last-child {
  text-align: right;
  white-space: nowrap;
}

/* строки таблицы подсвечиваются */
tbody tr, tr {
  transition: background 0.18s ease;
}

tr:hover td {
  background: var(--bg);
}

td {
  transition: background 0.18s ease;
}

/* Заметка-рамка */
.note {
  border-left: 3px solid var(--accent);
  background: var(--paper);
  padding: 14px 20px;
  margin: 24px 0;
  font-size: 16px;
  transition: border-left-width 0.2s ease, transform 0.2s ease;
}

.note:hover {
  border-left-width: 6px;
  transform: translateX(3px);
}

/* появление контента по очереди */
.rise {
  opacity: 0;
  animation: riseIn 0.5s ease forwards;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Подвал */
footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 22px 0;
  font-size: 14px;
  color: var(--muted);
}

/* Телефоны */
@media (max-width: 560px) {
  h1 { font-size: 27px; }
  nav a { margin-left: 14px; }
  main { padding: 34px 0 50px; }
}
