/* Визитка Ильи Козлова. Палитра в духе maryrose.by: белое поле, графит, серый, светлые подложки,
   чёрные кнопки-пилюли, синий — редким акцентом. Один гротеск (Inter). Сначала телефон, потом широкие экраны. */

:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --surface-2: #efeff1;
  --ink: #262633;
  --ink-strong: #151617;
  --muted: #8e8e93;
  --line: #e7e7ea;
  --accent: #0064ff;
  --live: #1f9d55;
  --radius: 1.75rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 5vw, 2.5rem);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.75rem;
}

/* ——— Шапка ——— */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(0.75rem, env(safe-area-inset-top)) max(var(--pad), calc((100% - 72rem) / 2)) 0.75rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.mark {
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 1.125rem;
  color: var(--ink-strong);
}

.top-save {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 0.2s;
}
.top-save:hover {
  background: var(--surface-2);
}
.top-save svg {
  width: 1rem;
  height: 1rem;
}

main {
  padding: 0 var(--pad);
  /* Узор за фото шире экрана — обрезаем по краю, чтобы страницу нельзя было сдвинуть вбок */
  overflow-x: clip;
}

/* ——— Первый экран ——— */
.hero {
  display: grid;
  gap: 1.75rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 0 3.5rem;
}

.hero-photo {
  position: relative;
}

/* Свой узор: тонкие окружности и оси за фото — рисуются линией при загрузке */
.lines {
  position: absolute;
  inset: -12% -18%;
  width: 136%;
  height: 124%;
  color: var(--line);
  stroke-width: 1;
  pointer-events: none;
}
.lines circle,
.lines path {
  stroke-dasharray: 1800;
  stroke-dashoffset: 1800;
  animation: draw 2.4s var(--ease) forwards;
}
.lines circle:nth-child(2) {
  animation-delay: 0.12s;
}
.lines circle:nth-child(3) {
  animation-delay: 0.24s;
}
.lines circle:nth-child(4) {
  animation-delay: 0.36s;
}
.lines path {
  animation-delay: 0.5s;
}

.portrait {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #f4f3f1 0%, #ecebe8 100%);
  box-shadow:
    0 1px 1px rgba(21, 22, 23, 0.03),
    0 2.5rem 4rem -2.5rem rgba(21, 22, 23, 0.28);
}
/* Фото без фона стоит на карточке-подложке и выходит головой за её верхний край */
.portrait:has(img) {
  overflow: visible;
  background: none;
  box-shadow: none;
}
.portrait:has(img)::before {
  content: "";
  position: absolute;
  inset: 16% 0 0;
  border-radius: var(--radius);
  background: linear-gradient(165deg, #f5f4f1 0%, #e9e7e3 100%);
  box-shadow:
    0 1px 1px rgba(21, 22, 23, 0.03),
    0 2.5rem 4rem -2.5rem rgba(21, 22, 23, 0.3);
}
.portrait img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  /* Низ фигуры уходит в подложку мягко, без резкого среза */
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}
/* Дуотон — на кремовой подложке */
.style-b .portrait::before {
  background: linear-gradient(165deg, #f6f1e8 0%, #ebe3d6 100%);
}
/* Гравюра — как на ценной бумаге: без заливки, тонкая двойная рамка с уголками, узор заметнее */
.style-c .portrait::before {
  inset: 12% 0 0;
  background: none;
  box-shadow: none;
  border: 1px solid #d9d9de;
  outline: 1px solid #ececf0;
  outline-offset: -0.6rem;
  border-radius: 0.25rem;
}
.style-c .portrait img {
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 88%, transparent 100%);
}
.style-c .lines {
  color: #dcdce2;
}
.portrait-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  color: #c9c8c4;
}
.portrait-empty span {
  font-size: clamp(5rem, 28vw, 9rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
}
.portrait-empty small {
  font-size: 0.8125rem;
  color: var(--muted);
}

.hero-text {
  display: grid;
  gap: 0;
}

.name {
  margin: 0;
  font-size: clamp(2.75rem, 12vw, 5.25rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
  color: var(--ink-strong);
}
.name span {
  display: inline-block;
}

.role {
  margin: 0.75rem 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.motto {
  margin: 0.5rem 0 0;
  max-width: 24rem;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 0.625rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.375rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform 0.25s var(--ease),
    background-color 0.2s,
    box-shadow 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.98);
}
.btn-dark {
  background: var(--ink-strong);
  color: #fff;
}
.btn-dark:hover {
  background: #2c2d33;
  box-shadow: 0 0.75rem 1.75rem -0.9rem rgba(21, 22, 23, 0.55);
}
.btn-light {
  background: var(--surface);
  color: var(--ink-strong);
}
.btn-light:hover {
  background: var(--surface-2);
}
.btn-wide {
  width: 100%;
  margin-top: 1.5rem;
}

.socials {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  transition:
    border-color 0.2s,
    color 0.2s;
}
.socials a:hover {
  border-color: var(--ink);
  color: var(--ink-strong);
}
.socials svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* ——— Разделы ——— */
.section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
}

.heading {
  margin: 0 0 1.75rem;
  font-size: clamp(2rem, 8vw, 3.25rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.02;
  color: var(--ink-strong);
}
.heading span {
  display: block;
  color: var(--muted);
}

/* ——— Проекты ——— */
.projects {
  display: grid;
  gap: 1rem;
}

.project {
  position: relative;
  display: grid;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.5s var(--ease),
    box-shadow 0.5s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.project:hover {
  transform: translateY(-3px);
  box-shadow: 0 1.75rem 3rem -2rem rgba(21, 22, 23, 0.35);
}
.project:active {
  transform: scale(0.985);
}

.project-media {
  position: relative;
  display: block;
  height: 15rem;
  overflow: hidden;
}
.project-media img {
  transition: transform 0.9s var(--ease);
}
.project:hover .project-media img {
  transform: scale(1.03);
}
/* Магазин: в карточке — первый экран сайта с заголовком, в панели — сайт в телефоне */
.media-shop {
  background: radial-gradient(70% 90% at 50% 10%, #2b2f6b 0%, #0e1030 70%);
}
.project .media-shop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 8% 35%;
}
.sheet-media.media-shop img {
  width: 14rem;
  margin: 2.25rem auto 0;
  border-radius: 1.6rem 1.6rem 0 0;
  box-shadow: 0 0 0 0.4rem #05061a, 0 2rem 3rem -1rem rgba(0, 0, 0, 0.6);
}
/* SHOPPILOT — сцена с ноутбуком целиком */
.media-pilot {
  background: #0b0c0e;
}
.media-pilot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 50%;
}

.project-body {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem 4.5rem 1.4rem 1.4rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  justify-self: start;
  margin-bottom: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.status::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}
.status-live {
  color: var(--live);
}
.status-live::before {
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent);
  animation: pulse 2.4s ease-out infinite;
}
.status-soon {
  color: var(--accent);
}

.project-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink-strong);
}
.project-lead {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
}

.project-open {
  position: absolute;
  right: 1.1rem;
  bottom: 1.25rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--ink-strong);
  color: #fff;
  transition: transform 0.5s var(--ease);
}
.project:hover .project-open {
  transform: rotate(90deg);
}
.project-open svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ——— Контакты ——— */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.rows li {
  border-bottom: 1px solid var(--line);
}
.rows a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  padding: 1.05rem 0;
  -webkit-tap-highlight-color: transparent;
}
.row-label {
  grid-column: 1;
  font-size: 0.8125rem;
  color: var(--muted);
}
.row-value {
  grid-column: 1;
  font-size: 1.1875rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}
.row-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--muted);
  transition:
    transform 0.4s var(--ease),
    color 0.2s;
}
.rows a:hover .row-arrow {
  transform: translate(2px, -2px);
  color: var(--ink-strong);
}

/* ——— Подвал ——— */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem max(var(--pad), calc((100% - 72rem) / 2)) max(2rem, env(safe-area-inset-bottom));
  font-size: 0.8125rem;
  color: var(--muted);
}
.foot a:hover {
  color: var(--ink-strong);
}

/* ——— Панель проекта ——— */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
}
.sheet[hidden] {
  display: none;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 22, 23, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sheet-card {
  position: relative;
  width: 100%;
  max-height: 100%;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  outline: none;
}
.sheet-close {
  position: sticky;
  top: max(0.75rem, env(safe-area-inset-top));
  z-index: 2;
  float: right;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: max(0.75rem, env(safe-area-inset-top)) 0.75rem -3.5rem 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-strong);
  box-shadow: 0 0.5rem 1.5rem -0.75rem rgba(0, 0, 0, 0.35);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sheet-media {
  height: 22rem;
  overflow: hidden;
}
.sheet-body {
  display: grid;
  gap: 0.25rem;
  padding: 1.5rem var(--pad) max(2.5rem, env(safe-area-inset-bottom));
}
.sheet-title {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink-strong);
}
.sheet-lead {
  margin: 0.75rem 0 0;
  font-size: 1.1875rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
}
.sheet-text {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}
.points {
  display: grid;
  gap: 0;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.points li {
  display: grid;
  gap: 0.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}
.points b {
  font-weight: 500;
  color: var(--ink-strong);
  font-size: 1rem;
}
.sheet-wide {
  margin: 1.75rem 0 0.5rem;
  border-radius: 1.25rem;
  border: 1px solid var(--line);
}
.sheet-body .btn {
  margin-top: 1.25rem;
}

/* Содержимое панели проявляется следом за картинкой и заголовком */
.sheet.is-open .sheet-body > :not([data-vt]) {
  animation: rise 0.7s var(--ease) both;
}
.sheet.is-open .sheet-body > :nth-child(3) {
  animation-delay: 0.08s;
}
.sheet.is-open .sheet-body > :nth-child(4) {
  animation-delay: 0.14s;
}
.sheet.is-open .sheet-body > :nth-child(5) {
  animation-delay: 0.2s;
}
.sheet.is-open .sheet-body > :nth-child(n + 6) {
  animation-delay: 0.26s;
}

/* Где браузер не умеет перетекание — простое появление снизу */
.sheet.fallback .sheet-card {
  animation: sheet-in 0.55s var(--ease) both;
}
.sheet.fallback .sheet-backdrop {
  animation: fade 0.4s ease both;
}
.sheet.closing .sheet-card {
  animation: sheet-out 0.35s var(--ease) both;
}
.sheet.closing .sheet-backdrop {
  animation: fade 0.3s ease reverse both;
}

::view-transition-group(*) {
  animation-duration: 0.6s;
  animation-timing-function: var(--ease);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
}

html.lock,
html.lock body {
  overflow: hidden;
}

/* ——— Появление ——— */
[data-in] {
  opacity: 0;
  transform: translateY(1rem);
  animation: rise 1s var(--ease) forwards;
}
.hero-photo[data-in] {
  transform: scale(1.02);
  filter: blur(8px);
  animation: develop 1.4s var(--ease) forwards;
}
.name[data-in] {
  animation-delay: 0.15s;
}
.role[data-in] {
  animation-delay: 0.25s;
}
.motto[data-in] {
  animation-delay: 0.32s;
}
.actions[data-in] {
  animation-delay: 0.4s;
}
.socials[data-in] {
  animation-delay: 0.48s;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition:
    opacity 0.9s var(--ease),
    transform 0.9s var(--ease);
}
.js [data-reveal].in {
  opacity: 1;
  transform: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes develop {
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 45%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0.55rem transparent;
  }
}
@keyframes sheet-in {
  from {
    transform: translateY(8%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes sheet-out {
  to {
    transform: translateY(6%);
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ——— Широкие экраны ——— */
@media (min-width: 48rem) {
  .actions {
    grid-auto-flow: column;
    justify-content: start;
  }
  .projects {
    grid-template-columns: 1fr 1fr;
  }
  .project-media {
    height: 20rem;
  }
  .section {
    padding: 5rem 0;
  }
  .rows a {
    grid-template-columns: 12rem 1fr auto;
    padding: 1.4rem 0;
  }
  .row-label {
    grid-column: 1;
    font-size: 0.9375rem;
  }
  .row-value {
    grid-column: 2;
    font-size: 1.375rem;
  }
  .row-arrow {
    grid-column: 3;
    grid-row: 1;
  }
  .btn-wide {
    width: auto;
  }
  /* Панель — большое окно по центру */
  .sheet {
    align-items: center;
    justify-items: center;
    padding: 2rem;
  }
  .sheet-card {
    max-width: 60rem;
    height: auto;
    max-height: calc(100dvh - 4rem);
    border-radius: 2rem;
    box-shadow: 0 3rem 6rem -2rem rgba(0, 0, 0, 0.45);
  }
  .sheet-media {
    height: 26rem;
  }
  .sheet-media.media-shop img {
    width: 17rem;
  }
}

@media (min-width: 64rem) {
  .hero {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 4rem;
    min-height: calc(100dvh - 4rem);
    padding: 2rem 0 4rem;
  }
  .hero-photo {
    order: 2;
  }
  .hero-text {
    order: 1;
  }
  .name {
    font-size: clamp(4.5rem, 7vw, 6.5rem);
  }
  .role {
    font-size: 1.375rem;
    margin-top: 1.25rem;
  }
  .motto {
    font-size: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
